Commit c13d8df6 authored by Tt's avatar Tt

桥接完成 待测试

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