Commit 05d776d4 authored by Tt's avatar Tt

测试安卓兼容

parent 9dad377b
...@@ -81,7 +81,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -81,7 +81,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.vplayer.resourceType = cc.VideoPlayer.ResourceType.REMOTE; this.vplayer.resourceType = cc.VideoPlayer.ResourceType.REMOTE;
this.vplayer.node.scale = 0.01 this.vplayer.node.scale = 0.01
pg.event.on('play_video', () => { this.playVideo() }) pg.event.on('play_video', (state) => { this.playVideo(state) })
} }
tryPlayVideo() { tryPlayVideo() {
...@@ -115,16 +115,26 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -115,16 +115,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
playVideo() { playVideo(state) {
this.videoCtrl.active = true; this.videoCtrl.active = true;
this.node.getChildByName("bg").active = false; this.node.getChildByName("bg").active = false;
this.vplayer.node.active = true; this.vplayer.node.active = true;
this.videoCtrl.getComponent(videoCtrl).setVideCom(this.vplayer); if (state == 1) {
this.vplayer.volume = 1; this.videoCtrl.getComponent(videoCtrl).setVideCom(this.vplayer);
this.vplayer.node.scale = 1; this.vplayer.volume = 1;
this.vplayer.currentTime = 0; this.vplayer.node.scale = 1;
this.vplayer.play(); this.vplayer.currentTime = 0;
this.vplayer.play();
} else {
this.vplayer.volume = 1;
this.vplayer.node.scale = 1;
this.vplayer.currentTime = 0;
this.vplayer.pause();
this.scheduleOnce(() => {
this.vplayer.play();
}, 0.1)
}
} }
playLocalAudio(audioName) { playLocalAudio(audioName) {
......
...@@ -252,7 +252,7 @@ export default class dg29_museum_game extends cc.Component { ...@@ -252,7 +252,7 @@ export default class dg29_museum_game extends cc.Component {
} }
onTouchRestart() { onTouchRestart() {
// 处理展示视频内容 // 处理展示视频内容
this.showVideo().then(() => { this.showVideo(2).then(() => {
// 底部显示为重新查看 // 底部显示为重新查看
this.btn_restart.active = true; this.btn_restart.active = true;
// 播放小迪结束的动作与gameOver相关内容 // 播放小迪结束的动作与gameOver相关内容
...@@ -273,7 +273,7 @@ export default class dg29_museum_game extends cc.Component { ...@@ -273,7 +273,7 @@ export default class dg29_museum_game extends cc.Component {
this.label_tip_ing.active = false; this.label_tip_ing.active = false;
// 处理展示视频内容 // 处理展示视频内容
this.showVideo().then(() => { this.showVideo(1).then(() => {
// 底部显示为重新查看 // 底部显示为重新查看
this.btn_restart.active = true; this.btn_restart.active = true;
// 播放小迪结束的动作与gameOver相关内容 // 播放小迪结束的动作与gameOver相关内容
...@@ -301,10 +301,10 @@ export default class dg29_museum_game extends cc.Component { ...@@ -301,10 +301,10 @@ export default class dg29_museum_game extends cc.Component {
} }
private timeCtrl: TimeCtrl; private timeCtrl: TimeCtrl;
showVideo() { showVideo(state) {
return new Promise(async (reslove) => { return new Promise(async (reslove) => {
this.hideUI(); this.hideUI();
pg.event.emit("play_video") pg.event.emit("play_video",state)
this.timeCtrl = pg.time.delayCtrl() this.timeCtrl = pg.time.delayCtrl()
this.timeCtrl.fillTime(99999); this.timeCtrl.fillTime(99999);
await this.timeCtrl.wait(); await this.timeCtrl.wait();
......
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