Commit def498c0 authored by limingzhe's avatar limingzhe

fix: 视屏层级 导致异常黑屏

parent a22be096
No preview for this file type
{"ver":"1.1.2","uuid":"f6e31e97-ccb9-4c5f-a2fa-b4eed558e692","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "f6e31e97-ccb9-4c5f-a2fa-b4eed558e692",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
......@@ -841,7 +841,7 @@
"_mute": false,
"_isFullscreen": false,
"_N$isFullscreen": false,
"_stayOnBottom": true,
"_stayOnBottom": false,
"videoPlayerEvent": [],
"_N$keepAspectRatio": true,
"_id": "e7ihO31y5FqJ0/0nd7CE1N"
......
......@@ -5,6 +5,7 @@
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import GameLogic from "../script/GameLogic"
import { delayCall } from "../script/util";
// cc.game.onStart = function(){
// cc.director.runScene(new MyScene());
......@@ -81,14 +82,7 @@ cc.Class({
this.data = JSON.parse(JSON.stringify(this.data))
this.preloadItem()
// 添加游戏逻辑
this.gameLogic = new GameLogic(this.data, {
designSize: this._designSize,
frameSize: this._frameSize,
mapScaleMin: this._mapScaleMin,
mapScaleMax: this._mapScaleMax,
cocosScale: this._cocosScale,
});
})
},
......@@ -130,6 +124,16 @@ cc.Class({
addPreloadAudio() {
this._audioResList.push({ url: this.data.audio_url });
const dataArr = this.data.contentObj?.dataArray;
if (dataArr) {
dataArr.forEach(data => {
this._audioResList.push({ url: data.video_url || ''});
})
}
console.log('this.data: ',this.data);
},
addPreloadAnima() {
......@@ -162,6 +166,60 @@ cc.Class({
loadEnd() {
this.initData();
this.initGameLogic();
// this.testVideo();
},
initGameLogic() {
// 添加游戏逻辑
this.gameLogic = new GameLogic(this.data, {
designSize: this._designSize,
frameSize: this._frameSize,
mapScaleMin: this._mapScaleMin,
mapScaleMax: this._mapScaleMax,
cocosScale: this._cocosScale,
});
},
testVideo() {
const videoNode = cc.find("Canvas/temp");
this.videoNode = videoNode;
this.videoNode.baseX = videoNode.x;
videoNode.active = true;
const vPlayer = videoNode.getComponent(cc.VideoPlayer);
vPlayer.remoteURL = this.data.contentObj.dataArray[0].video_url;
this.videoPlayer = vPlayer;
vPlayer.node.on('ready-to-play', () => {
vPlayer.play();
checkIsPlaying();
})
const checkIsPlaying = () => {
delayCall(0.001, () => {
if (vPlayer.currentTime) {
// vPlayer.pause();
this.isVideoPlayerReady = true;
// this.checkCanShowRecordList();
console.log('aaavbbb');
} else {
checkIsPlaying();
}
})
}
},
_cantouch: null,
......
......@@ -131,4 +131,18 @@ export function btnClickAnima(btn, time=0.15, rate=1.05) {
.to(time / 2, {scale: btn.tmpScale})
.start()
})
}
export function delayCall(time, cb) {
return cc.tween({})
.delay(time)
.call(() => {
if (cb) {
cb();
}
})
.start();
}
\ No newline at end of file
......@@ -128,5 +128,8 @@
}
}
},
"defaultProject": "ng-template-generator"
}
"defaultProject": "ng-template-generator",
"cli": {
"analytics": false
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
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