// 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 PoolMgr, { NODEPOOLPREFABTYPE } from "./PoolMgr";
import TipItemUI from "../view/uiItem/TipItemUI";
import TipSpriteItemUI from "../view/effect/TipSpriteItemUI";

const { ccclass, property } = cc._decorator;

@ccclass
export default class EffectMgr extends cc.Component {

    //单例模式---------------------------
    private static instance: EffectMgr = null;

    public static get Inst(): EffectMgr {
        if (!EffectMgr.instance) {
            EffectMgr.instance = new EffectMgr();
        }
        return EffectMgr.instance;
    }


    /**添加提示
     * @param tip 提示内容 str
     */
    addTip(tip: string) {
        let node_tipItem = PoolMgr.Inst.getPoolPrefab(NODEPOOLPREFABTYPE.TipItemUI);
        let tipItemUI = node_tipItem.getComponent(TipItemUI);
        tipItemUI.init(tip);
        // MainTest.Inst.node_tipUI.addChild(node_tipItem);
    }

    /**添加图片提示
     * @param tip 提示内容 str
     */
    addSpriteTip(tipSpriteItemType: TIP_SPRITEITEM_TYPE) {
        let node_tipSpriteItemUI = PoolMgr.Inst.getPoolPrefab(NODEPOOLPREFABTYPE.TipSpriteItemUI);
        let tipItemUI = node_tipSpriteItemUI.getComponent(TipSpriteItemUI);
        tipItemUI.init(tipSpriteItemType);
        // MainTest.Inst.node_tipUI.addChild(node_tipSpriteItemUI);
    }
}

/**图片提示类型 */
export enum TIP_SPRITEITEM_TYPE {
    NormalPass = "NormalPass",
    PerfectPass = "PerfectPass"
}
