Commit c255575c authored by limingzhe's avatar limingzhe

fix: 闪屏处理

parents 0071c42e dc5babd8
{
"ver": "1.1.2",
"uuid": "810c015d-857f-44be-aa35-fcda8b54edb3",
"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":"810c015d-857f-44be-aa35-fcda8b54edb3","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
\ No newline at end of file
......@@ -356,19 +356,19 @@ cc.Class({
}
// window.dispatchEvent(new CustomEvent('resize'), true)
// window.dispatchEvent(new cc.Event.EventCustom('resize', true))
});
cc.director.on('GAME_VIEW_DISPLAYED', () => {
}, this);
cc.director.on('GAME_VIEW_DISPLAYED', function() {
// this.karaoke.prepare();
});
}, this);
window.gg =this
this.btnGroup.children.forEach(button => {
button.actionStatus = this.BUTTON_STATUS.IDLE;
button.on(cc.Node.EventType.TOUCH_START, (event) => {
button.on(cc.Node.EventType.TOUCH_START, function(event) {
const btn = event.currentTarget;
window.bb = btn;
this.buttonGroupChange(btn)
// cc.log("This is a callback after the trigger event", event);
})
}, this)
});
;
},
......
......@@ -14,6 +14,26 @@ var DISPLAY_MODE = cc.Enum({
const LINE_BEAKER = '<br/>'; // '\n'
const SPACE = ' ';
class MyAudioSource {
play(){
this.audId = cc.audioEngine.play(this.clip, false, 1);
}
stop(){
cc.audioEngine.stop(this.audId);
}
pause(){
cc.audioEngine.pause(this.audId);
}
resume(){
cc.audioEngine.resume(this.audId);
}
getCurrentTime () {
cc.audioEngine.getCurrentTime(this.audId);
}
setCurrentTime (sec) {
cc.audioEngine.setCurrentTime(this.audId, sec);
}
}
/**
* 1.添加空节点,设置节点大小,拖入该脚本
......@@ -148,7 +168,7 @@ cc.Class({
window['kk'] = this;
cc.director.on('STOP_ALL_AUDIO_sb_karaoke_cocos', () => {
this.pause();
});
}, this);
},
setPlayInteractivateMode(mode) {
......@@ -498,7 +518,7 @@ cc.Class({
// this._lrcNextLineTime = this._lrcData[this._lrcLineIndex] ? this._lrcData[this._lrcLineIndex].time : 0;
// return this._remainContent.shift();
// }
if (!time) {
if (!time || time < 0) {
time = 0;
}
let idx = 0;
......@@ -592,12 +612,12 @@ cc.Class({
let endIndex = nextLineObj.index;
while(line = this._lrcData[endIndex]) {
if (line.newLine || index === 0 ) {
return line.time
return line.time > 0 ? line.time : 0
}
endIndex -= 1;
}
return {
time: line.time,
time: line.time > 0 ? line.time : 0,
index: lineObj.index
};
},
......@@ -646,11 +666,11 @@ cc.Class({
// })
// console.log(n._id,ss,breakIndex,tm, idx, n.x,n.y);
n.off(cc.Node.EventType.TOUCH_START)
n.on(cc.Node.EventType.TOUCH_START, () => {
n.on(cc.Node.EventType.TOUCH_START, function() {
console.log(n._id,ss,breakIndex,tm, idx, n.x,n.y,this.richText.node.children.indexOf(n) );
this.calcSentenceRichText.string = this.sentenceContent[tm];
this.playByTime(tm);
});
}, this);
const s = n.getComponent(cc.Label).string;
this.findSentenceIndexByWords(s, sentenceIndexObj);
}
......@@ -845,6 +865,9 @@ cc.Class({
if (overrideTime) {
startTime = overrideTime;
}
if (startTime < 0) {
startTime = 0;
}
this.playByTimePhaseStartTime = startTime;
this.playByTimePhaseEndTime = endTime;
this.playByTimePhaseStep = step;
......@@ -967,6 +990,9 @@ cc.Class({
this.resetLRC();
},
seek(time) {
if (time < 0) {
time = 0
}
const adSrc = this.getCurrentPlayingSource();
adSrc.setCurrentTime(time);
},
......@@ -994,18 +1020,39 @@ cc.Class({
},
onDestroy() {
console.log('onDestroy onDestroy');
// audioEngine.uncache(this.audioUrl);
if (this._currentAudioId) {
audioEngine.stop(this._currentAudioId);
}
if (this._audioSource) {
console.log('this._audioSource: ', this._audioSource);
if (this._audioSource && this._audioSource.audio) {
this._audioSource.audio.stop()
this._audioSource.stop();
// this._audioSource.audio.destroy();
this._audioSource.audio = null;
// this._audioSource._destruct();
}
if (this._audioACSource) {
console.log('this._audioACSource: ', this._audioACSource);
if (this._audioACSource && this._audioACSource.audio) {
this._audioACSource.audio.stop()
this._audioACSource.stop();
// this._audioACSource.audio.destroy();
this._audioACSource.audio = null;
// this._audioSource._destruct();
}
// if (this._audioSource && this._audioSource.isValid) {
// this._audioSource.destroy();
// // this._audioSource._destruct();
// }
// if (this._audioACSource && this._audioACSource.isValid) {
// this._audioACSource.destroy();
// // this._audioACSource._destruct();
// }
// this._audioSource = null;
// this._audioACSource = null;
// this._destruct();
}
});
......@@ -256,7 +256,7 @@
"__id__": 3
},
"_enabled": true,
"alignMode": 1,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_left": 0,
......@@ -504,7 +504,7 @@
"__id__": 9
},
"_enabled": true,
"alignMode": 1,
"alignMode": 2,
"_target": null,
"_alignFlags": 44,
"_left": 0,
......@@ -2263,7 +2263,7 @@
"__id__": 52
},
"_enabled": true,
"alignMode": 1,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_left": 0,
......@@ -5378,7 +5378,7 @@
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_left": 0,
......
......@@ -84,9 +84,21 @@ cc.Class({
this.preload();
},
getData(func) {
func(this.getDefaultData());
},
getData(func) {
if (window && window.courseware) {
window.courseware.getData(func, 'scene');
return;
}
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
middleLayerComponent.getData(func);
return;
}
func(this.getDefaultData());
},
getDefaultData() {
......@@ -470,7 +482,7 @@ cc.Class({
}
rectNode.addComponent(cc.Button);
rectNode.on('click', () => {
rectNode.on('click', function(){
if (rectNode.isClicked) {
// return;
}
......@@ -486,7 +498,7 @@ cc.Class({
if (animationNames.length > 0) {
dragonDisplay.playAnimation(animationNames[0], 1);
}
});
}, this);
}
});
......@@ -534,12 +546,12 @@ cc.Class({
});
picNode.addComponent(cc.Button);
picNode.on('click', () => {
picNode.on('click', function() {
if (picNode.audioClip) {
cc.audioEngine.stopAllEffects();
cc.audioEngine.playEffect(picNode.audioClip, false, 0.8);
}
});
}, this);
},
......
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