UIBattleResultPreAni.ts 1.37 KB
// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import { SaveDataManager } from "../../component/SaveDataManager";
import { SoundManager } from "../../component/SoundManager";
import { SoundName, WindowName } from "../../Global";
import { UIBase } from "../UIBase";
import { UIManager } from "../UIManager";

const { ccclass, property } = cc._decorator;

@ccclass
export default class UIBattleResultPreAni extends UIBase {

    private _sp: sp.Skeleton;

    protected onLoad(): void {
        this._usePopUpEffect = false;
        this._useCloseEffect = false;

        this._sp = this.node.getChildByName('sp').getComponent(sp.Skeleton);
    }

    protected onEnable(): void {



        this._sp.setCompleteListener(() => {

            this.scheduleOnce(() => {
                UIManager.ins.closeWindow(WindowName.BATTLE_RESULT_PRE_ANI);
                UIManager.ins.openWindow(WindowName.BATTLE_RESULT, this.enableParam);
            }, 1)

        });
        this._sp.setAnimation(0, SaveDataManager.ins.runtimeData.gender == 0 ? 'animation' : 'animation2', false);

        SoundManager.ins.playEffect(SoundName.WIN_ICON);
    }
}