Commit aa8f9efe authored by Tt's avatar Tt

功能完成

parent da91fda0
......@@ -7,17 +7,12 @@ const { ccclass, property } = cc._decorator;
@ccclass
export default class ImgAuto extends cc.Component {
private img_npc_voice: cc.Node;
onLoad() {
this.initView();
this.initEvent();
}
protected onDestroy(): void {
this.unscheduleAllCallbacks();
}
initView() {
this.img_npc_voice = this.node;
}
initEvent() {
pg.event.on('img_voice_play_voice_start', () => {
this.playVoiceStart();
......@@ -34,10 +29,10 @@ export default class ImgAuto 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')
if (!this.node) return;
let p1 = this.node.getChildByName('p1')
let p2 = this.node.getChildByName('p2')
let p3 = this.node.getChildByName('p3')
p1.active = this.playVoiceCount % 3 == 0;
p2.active = this.playVoiceCount % 3 == 1;
p3.active = this.playVoiceCount % 3 == 2;
......@@ -45,9 +40,9 @@ export default class ImgAuto extends cc.Component {
playVoiceEnd() {
this.unschedule(this.playVoiceRunning)
this.playVoiceCount = 0;
let p1 = this.img_npc_voice.getChildByName('p1')
let p2 = this.img_npc_voice.getChildByName('p2')
let p3 = this.img_npc_voice.getChildByName('p3')
let p1 = this.node.getChildByName('p1')
let p2 = this.node.getChildByName('p2')
let p3 = this.node.getChildByName('p3')
p1.active = true;
p2.active = false;
p3.active = false;
......
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