觉醒时刻
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
juexingshike/assets/Scripts/JuQingChat/ChatSoundPlay.ts

35 lines
830 B

const {ccclass, property} = cc._decorator;
@ccclass
export default class ChatSoundPlay extends cc.Component {
@property([cc.SpriteFrame])
private pics:Array<cc.SpriteFrame> = []
onLoad () {}
private tick = 0;
private index = 0;
public isPlay = false;
protected update(dt: number): void {
if(this.isPlay){
console.log('正在播放');
this.tick += dt;
if(this.tick >= 0.3){
this.tick = 0;
if(this.index >= 3){
this.index = 0;
}
this.node.getComponent(cc.Sprite).spriteFrame = this.pics[this.index];
this.index += 1;
}
}
else{
this.node.getComponent(cc.Sprite).spriteFrame = this.pics[3];
}
}
}