import UIManager from "../UIManager";

const { ccclass, property } = cc._decorator;
export enum PopupName {
    DAILYREWARD, LOSE, WIN, SETTING, SHOPCOIN, SHOPSKIN, REWARD
}

@ccclass
export default class PopupUI extends cc.Component {

    popupName: PopupName = PopupName.SETTING;

    uiManager: UIManager;

    initialize(manager: UIManager) {
        this.uiManager = manager;
    }

    show() {
        this.node.active = true;
        this.uiManager.activeTransparent();
        this.node.scale = 0;
        cc.tween(this.node)
            .to(1, { scale: 1 }, { easing: "elasticOut" })
            .start();
    }

    hide() {
        cc.tween(this.node)
            .to(1, { scale: 0 }, { easing: "elasticIn" })
            .call(() => {
                this.node.active = false;
                this.uiManager.deActiveTransparent();
            })
            .start();
    }
}
