All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m19s
93 lines
3.2 KiB
TypeScript
93 lines
3.2 KiB
TypeScript
import { _decorator, Component, Label, Node, sp, Tween, tween, Vec3 } from 'cc';
|
|
import { UIManager } from '../../Main/Scripts/managers/UIManager';
|
|
import { gold2cash, gold2cash2 } from '../../Main/Scripts/main/comm';
|
|
import { AudioManager } from '../../Main/Scripts/managers/AudioManager';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('TotalWinSpine')
|
|
export class TotalWinSpine extends Component {
|
|
@property(Node)
|
|
mainNode: Node = null;
|
|
|
|
@property(Node)
|
|
fsTotalWinSpineNode: Node = null;
|
|
|
|
@property(Node)
|
|
totalWinCount: Node = null;
|
|
|
|
@property(Node)
|
|
collectBtn: Node = null;
|
|
|
|
totalWinCountValue: number = 0;
|
|
labelController: any = null;
|
|
hasClickBtn: boolean = false;
|
|
closeCallBack: () => void = null;
|
|
|
|
showTotalWinSpine(totalWinCount: number, cb) {
|
|
this.closeCallBack = cb;
|
|
this.totalWinCountValue = totalWinCount;
|
|
this.totalWinCount.getComponent(Label).string = '0.00';
|
|
this.collectBtn.active = false;
|
|
this.hasClickBtn = false;
|
|
this.node.getChildByName('grayBg').once(Node.EventType.TOUCH_START, this.onClickGrayBg, this);
|
|
AudioManager.instance.playBGM("Total_Win_Bgm", false);
|
|
tween(this.fsTotalWinSpineNode)
|
|
.set({ scale: new Vec3(1.1, 1.1, 1.1) })
|
|
.to(5, { scale: new Vec3(1, 1, 1) })
|
|
.call(() => {
|
|
this.collectBtn.active = true;
|
|
})
|
|
.start();
|
|
|
|
|
|
tween(this.mainNode)
|
|
.set({ scale: new Vec3(0, 0, 0) })
|
|
.to(0.5, { scale: new Vec3(1, 1, 1) }, { easing: 'bounceOut' })
|
|
.start();
|
|
|
|
this.labelController = UIManager.instance.tweenScorelinear(0, totalWinCount, 3.3)
|
|
.onUpdate((v: number) => {
|
|
this.totalWinCount.getComponent(Label).string = gold2cash(v);
|
|
})
|
|
.onComplete(() => {
|
|
this.collectBtn.active = true;
|
|
AudioManager.instance.stopBGM()
|
|
AudioManager.instance.playSFX('Total_Win_Jump');
|
|
this.totalWinCount.getComponent(Label).string = gold2cash(totalWinCount);
|
|
this.scheduleOnce(() => {
|
|
this.onClickCollectBtn();
|
|
}, 3);
|
|
})
|
|
.start();
|
|
}
|
|
|
|
onClickGrayBg() {
|
|
AudioManager.instance.stopBGM()
|
|
|
|
AudioManager.instance.playSFX('Total_Win_Jump');
|
|
this.node.getChildByName('grayBg').off(Node.EventType.TOUCH_START, this.onClickGrayBg, this);
|
|
Tween.stopAllByTarget(this.labelController.holder);
|
|
this.collectBtn.active = true;
|
|
this.totalWinCount.getComponent(Label).string = gold2cash(this.totalWinCountValue);
|
|
this.scheduleOnce(() => {
|
|
this.onClickCollectBtn();
|
|
}, 3);
|
|
}
|
|
|
|
onClickCollectBtn() {
|
|
if (this.hasClickBtn) return;
|
|
AudioManager.instance.playSFX('Click_TotalWin_Collect')
|
|
this.hasClickBtn = true;
|
|
tween(this.collectBtn)
|
|
.to(0.1, { scale: new Vec3(1.1, 1.1, 1.1) })
|
|
.to(0.1, { scale: new Vec3(1, 1, 1) })
|
|
.call(() => {
|
|
this.unscheduleAllCallbacks();
|
|
this.closeCallBack();
|
|
})
|
|
.start();
|
|
}
|
|
|
|
}
|
|
|