Commit ca481740 authored by Tt's avatar Tt

卡死修复

parent 06634746
...@@ -17,7 +17,9 @@ export default class LayerBack extends cc.Component { ...@@ -17,7 +17,9 @@ export default class LayerBack extends cc.Component {
this.initEvent(); this.initEvent();
} }
private label_title: cc.Node; private label_title: cc.Node;
protected onDestroy(): void {
this.unscheduleAllCallbacks();
}
initView() { initView() {
this.bg_forbid = pg.view.find(this, 'bg_forbid') this.bg_forbid = pg.view.find(this, 'bg_forbid')
...@@ -65,6 +67,7 @@ export default class LayerBack extends cc.Component { ...@@ -65,6 +67,7 @@ export default class LayerBack extends cc.Component {
}); });
} }
playVoiceRunning() { playVoiceRunning() {
if (!this.img_npc_voice) return;
this.playVoiceCount++; this.playVoiceCount++;
let p1 = this.img_npc_voice.getChildByName('p1') let p1 = this.img_npc_voice.getChildByName('p1')
let p2 = this.img_npc_voice.getChildByName('p2') let p2 = this.img_npc_voice.getChildByName('p2')
......
...@@ -13,6 +13,9 @@ export default class ImgVoice extends cc.Component { ...@@ -13,6 +13,9 @@ export default class ImgVoice extends cc.Component {
this.initView(); this.initView();
this.initEvent(); this.initEvent();
} }
protected onDestroy(): void {
this.unscheduleAllCallbacks();
}
initView() { initView() {
this.img_npc_voice = this.node; this.img_npc_voice = this.node;
} }
...@@ -31,6 +34,7 @@ export default class ImgVoice extends cc.Component { ...@@ -31,6 +34,7 @@ export default class ImgVoice extends cc.Component {
this.schedule(this.playVoiceRunning, 0.3) this.schedule(this.playVoiceRunning, 0.3)
} }
playVoiceRunning() { playVoiceRunning() {
if (!this.img_npc_voice) return;
this.playVoiceCount++; this.playVoiceCount++;
let p1 = this.img_npc_voice.getChildByName('p1') let p1 = this.img_npc_voice.getChildByName('p1')
let p2 = this.img_npc_voice.getChildByName('p2') let p2 = this.img_npc_voice.getChildByName('p2')
......
...@@ -25,6 +25,9 @@ export default class LayerRecord extends cc.Component { ...@@ -25,6 +25,9 @@ export default class LayerRecord extends cc.Component {
this.initEvent(); this.initEvent();
this.showVoiceWhite(); this.showVoiceWhite();
} }
protected onDestroy(): void {
this.unscheduleAllCallbacks();
}
private letter: string; private letter: string;
private targetTime: number; private targetTime: number;
private recordAudio: string; private recordAudio: string;
...@@ -115,6 +118,7 @@ export default class LayerRecord extends cc.Component { ...@@ -115,6 +118,7 @@ export default class LayerRecord extends cc.Component {
playVoiceRunning() { playVoiceRunning() {
this.playVoiceCount++; this.playVoiceCount++;
let btn_play = pg.view.find(this.layout_record, 'btn_play'); let btn_play = pg.view.find(this.layout_record, 'btn_play');
if (!btn_play) return;
let p0 = btn_play.getChildByName('p0') let p0 = btn_play.getChildByName('p0')
let p1 = btn_play.getChildByName('p1') let p1 = btn_play.getChildByName('p1')
let p2 = btn_play.getChildByName('p2') let p2 = btn_play.getChildByName('p2')
......
...@@ -44,6 +44,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -44,6 +44,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.event.emit('npc_layer_back_init', this.data) pg.event.emit('npc_layer_back_init', this.data)
} }
protected onDestroy(): void {
pg.event.clear();
}
// 一轮单词数量 // 一轮单词数量
private word_area: cc.Node; private word_area: cc.Node;
private upper_shadow: cc.Node; private upper_shadow: cc.Node;
......
...@@ -351,6 +351,7 @@ let pg = { ...@@ -351,6 +351,7 @@ let pg = {
if (!node) return; if (!node) return;
let component = node.getComponent(cc.Label);//组件功能 非node的功能 let component = node.getComponent(cc.Label);//组件功能 非node的功能
component.string = text; component.string = text;
component.cacheMode = cc.Label.CacheMode.CHAR;
return true; 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