Commit c13d8df6 authored by Tt's avatar Tt

桥接完成 待测试

parent c9c5ac5c
......@@ -21,7 +21,7 @@
"__id__": 2
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 5
......@@ -177,7 +177,7 @@
"__uuid__": "ef2c3639-6259-495b-9b46-6958888540bb"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 9,
"_N$_animationIndex": 0,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
......
......@@ -3,6 +3,8 @@ import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent_DG16";
import Boy from "../script/ui/boy_DG16";
import QuestionView from "../script/ui/question_DG16";
import videoCtrl from "../script/ui/videoCtrl_DG16";
import pg from "../../scene/pg_dg29_museum";
import dg29_museum_game from "../../scene/dg29_museum_game";
const { ccclass, property } = cc._decorator;
......@@ -59,11 +61,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
@property(dg29_museum_game) root_game: dg29_museum_game;
async onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData();
this.initView();
this.root_game.init(this.data);
}
_cantouch = null;
......@@ -76,10 +79,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.touchlayer._touchListener.setSwallowTouches(false)
this.vplayer.node.active = true;
this.vplayer.remoteURL = this.data.video_url;
this.vplayer.remoteURL = this.data.video;
this.vplayer.resourceType = cc.VideoPlayer.ResourceType.REMOTE;
pg.event.on('play_video', () => { this.playVideo() })
}
tryPlayVideo() {
......@@ -102,50 +105,50 @@ export default class SceneComponent extends MyCocosSceneComponent {
initView() {
this.initBg();
this.btn_next.on("click", () => {
// this.btn_next.on("click", () => {
this.playLocalAudio("btn")
if (!cc.find('middleLayer')) {
console.log("==点击了下一页按钮==")
return;
}
const middleLayer = cc.find('middleLayer').getComponent('middleLayer');
middleLayer.goNextPage(); // 跳转到下一页
}, this)
// this.playLocalAudio("btn")
// if (!cc.find('middleLayer')) {
// console.log("==点击了下一页按钮==")
// return;
// }
// const middleLayer = cc.find('middleLayer').getComponent('middleLayer');
// middleLayer.goNextPage(); // 跳转到下一页
// }, this)
this.videoCtrl.active = false;
this.qustionCom = this.qustionLayer.getComponent(QuestionView);
this._totalIndex = this.data.contentObj.dataArray.length;
// this._totalIndex = this.data.contentObj.dataArray.length;
this._roundIndex = 0;
this.firstRound = true
this.doWrongTime = 0;
cc.log(JSON.stringify(this.data, null, 2))
// cc.log(JSON.stringify(this.data, null, 2))
this.WrongList = [];
this.qustionCom.hide();
this.boyNode.x = cc.winSize.width;
this.boyNode.getComponent(Boy).playRun(-1);
cc.tween(this.boyNode).to(3, { x: 0 }).call(() => {
this.boyNode.getComponent(Boy).playtalk(-1);
this.playAudioByUrl(this.data.audio_url_guide, () => {
this.boyNode.scaleX = -0.65;
this.log("playRun start")
this.boyNode.getComponent(Boy).playRun(-1);
cc.tween(this.boyNode).to(1, { x: 500 }).call(() => {
this.log("playRun end")
this.boyNode.scaleX = 0.65;
this.boyNode.getComponent(Boy).playNormal();
this.qustionCom.show();
this.doRound()
}).start();
})
}).start()
// this.boyNode.x = cc.winSize.width;
// this.boyNode.getComponent(Boy).playRun(-1);
// cc.tween(this.boyNode).to(3, { x: 0 }).call(() => {
// this.boyNode.getComponent(Boy).playtalk(-1);
// this.playAudioByUrl(this.data.audio_url_guide, () => {
// this.boyNode.scaleX = -0.65;
// this.log("playRun start")
// this.boyNode.getComponent(Boy).playRun(-1);
// cc.tween(this.boyNode).to(1, { x: 500 }).call(() => {
// this.log("playRun end")
// this.boyNode.scaleX = 0.65;
// this.boyNode.getComponent(Boy).playNormal();
// this.qustionCom.show();
// this.doRound()
// }).start();
// })
// }).start()
}
doRound() {
......@@ -185,7 +188,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.boyNode.scaleX = 0.65;
this.boyNode.getComponent(Boy).playNormal();
this.playVideo();
}).start();
})
}).start()
}
}
async playVideo() {
this.videoCtrl.active = true;
this.node.getChildByName("bg").active = false;
......@@ -196,16 +207,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.vplayer.play();
await asyncDelay(0.1);
this.boyNode.active = false;
}).start();
})
}).start()
}
}
initWorongLogic() {
this._totalIndex = this.WrongList.length;
......
import { defaultData } from "../script/defaultData_DG16";
import { defaultData } from "../../script/defaultData_dg29_museum";
export class MyCocosSceneComponent extends cc.Component {
......
......@@ -430,7 +430,7 @@
"__id__": 9
},
"_name": "boy",
"_active": true,
"_active": false,
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
......@@ -545,7 +545,7 @@
"__id__": 12
},
"_name": "qustionLayer",
"_active": true,
"_active": false,
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
......@@ -4351,7 +4351,7 @@
"__id__": 118
}
],
"_active": true,
"_active": false,
"_components": [],
"_prefab": {
"__id__": 145
......@@ -5502,7 +5502,7 @@
"__id__": 7
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 151
......@@ -8738,6 +8738,9 @@
"touchlayer": {
"__id__": 217
},
"root_game": {
"__id__": 147
},
"_id": "eaTVUpqahPfZeO9+sUI7RP"
}
]
\ No newline at end of file
......@@ -69,6 +69,8 @@ export default class dg29_museum_game extends cc.Component {
pg.view.touchOn(this.btn_restart, this.onTouchRestart, this);
pg.view.touchOn(this.btn_vioce, this.onTouchRecord, this);
pg.view.touchOn(this.btn_vioce_ing, this.onTouchRecordEnd, this);
pg.event.on('play_video_end', () => { this.playVideoEnd() })
}
// 初始化游戏
initGame() {
......@@ -360,6 +362,8 @@ export default class dg29_museum_game extends cc.Component {
private timeCtrl: TimeCtrl;
showVideo() {
return new Promise(async (reslove) => {
this.hideUI();
pg.event.emit("play_video")
if (1) return;
this.showVideoPlayer();
this.timeCtrl = pg.time.delayCtrl()
......@@ -520,7 +524,9 @@ export default class dg29_museum_game extends cc.Component {
});
}
playVideoEnd() {
this.hideVideo();
}
onVideoPlayerEvent(sender, event) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment