Commit e9dd4b30 authored by Tt's avatar Tt

hy01卡死测试

parent bfd1bb43
......@@ -16,6 +16,9 @@ export default class LayerBack extends cc.Component {
this.initView();
this.initEvent();
}
protected onDestroy(): void {
this.unscheduleAllCallbacks();
}
private label_title: cc.Node;
......
......@@ -13,6 +13,9 @@ export default class ImgVoice extends cc.Component {
this.initView();
this.initEvent();
}
protected onDestroy(): void {
this.unscheduleAllCallbacks();
}
initView() {
this.img_npc_voice = this.node;
}
......@@ -32,6 +35,7 @@ export default class ImgVoice extends cc.Component {
}
playVoiceRunning() {
this.playVoiceCount++;
if (!this.img_npc_voice) return;
let p1 = this.img_npc_voice.getChildByName('p1')
let p2 = this.img_npc_voice.getChildByName('p2')
let p3 = this.img_npc_voice.getChildByName('p3')
......
......@@ -26,6 +26,9 @@ export default class LayerRecord extends cc.Component {
this.initEvent();
this.showVoiceWhite();
}
protected onDestroy(): void {
this.unscheduleAllCallbacks();
}
private letter: string;
private targetTime: number;
private recordAudio: string;
......@@ -121,6 +124,7 @@ export default class LayerRecord extends cc.Component {
playVoiceRunning() {
this.playVoiceCount++;
let btn_play = pg.view.find(this.layout_record, 'btn_play');
if (!btn_play) return;
let p0 = btn_play.getChildByName('p0')
let p1 = btn_play.getChildByName('p1')
let p2 = btn_play.getChildByName('p2')
......
......@@ -45,6 +45,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
pg.event.emit('npc_layer_back_init', this.data)
}
protected onDestroy(): void {
pg.event.clear();
}
_cantouch = null;
private list: Array<{ type, text, right, imgage, duration, content, audio }>;
......@@ -52,6 +55,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
private score: number;
private scoreList: Array<number>;
private tempCount: number;
private maxCurrent: number;
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
......@@ -61,6 +65,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.recordFlag = data.recordFlag;
this.list = data.questions[0].options;
this.scoreList = this.list.map(() => 3);
this.maxCurrent = 0;
this.layers = [];
}
......@@ -91,9 +96,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
console.log(move.toString());
if (move.x < -10) {
this.touchForbid = true;
console.log("lastPage")
this.lastPage();
} else if (move.x > 10) {
this.touchForbid = true;
console.log("nextPage")
this.nextPage();
}
}
......@@ -102,7 +109,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.preLayer();
}
nextPage() {
this.nextLayer();
if (this.recordFlag) {
if (this.count + 1 <= this.maxCurrent) {
this.nextLayer();
} else {
this.touchForbid = false;
}
} else {
this.nextLayer();
}
}
resetView() {
this.layer_game.removeAllChildren();
......@@ -172,6 +187,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.audio.playAudioByUrl(this.CurrentData.audio, () => {
this.currentAudioId = null;
com.playVoiceEnd();
this.touchForbid = false;
pg.event.emit('layer_record_open', {
letter: this.CurrentData.content,
targetTime: this.CurrentData.duration,
......@@ -195,9 +211,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.audio.playAudioByUrl(this.CurrentData.audio, () => {
this.currentAudioId = null;
com.playVoiceEnd();
this.touchForbid = true;
this.touchForbid = false;
this.nextLayer();
this.scheduleOnce(() => {
this.touchForbid = false;
this.nextLayer();
}, 3)// 动画过来播放之后等待三秒
// pg.event.once('layer_coin_show_coin_end', () => {
// this.touchForbid = false;
// this.nextLayer();
......@@ -249,7 +268,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.event.once('layer_coin_show_coin_end', () => {
this.nextLayer();
}) // 动画回调
pg.event.emit('layer_coin_show_coin', 1) //1 2 3硬币数量
pg.event.emit('layer_coin_show_coin', 2) //1 2 3硬币数量
})
pg.event.emit('layer_right_show_good')
} else {
......@@ -312,6 +331,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.scheduleOnce(() => {
this.touchForbid = false;
this.count++;
this.maxCurrent = Math.max(this.maxCurrent, this.count);
this.startPlay();
}, 1)
}
......
......@@ -391,6 +391,7 @@ let pg = {
let node = item.node ? item.node : item;
if (!node) return;
let component = node.getComponent(cc.Label);//组件功能 非node的功能
component.cacheMode = cc.Label.CacheMode.CHAR;
component.string = text;
return true;
},
......
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