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

const { ccclass, property } = cc._decorator;

@ccclass
export default class Tips extends cc.Component {



    static Instance: Tips = null;
    onLoad() {
        Tips.Instance = this
    }


    show(str: string) {

        this.unscheduleAllCallbacks()
        let tips = this.node.getChildByName("tips")
        tips.active = true
        tips.getComponentInChildren(cc.Label).string = str

        this.scheduleOnce(() => {
            tips.active = false
        }, 1)
    }

    // update (dt) {}
}
