const DWTool = require("../utils/DWTool");

cc.Class({
    extends: cc.Component,

    properties: {

        titleRichText: cc.RichText,

        headSprite: cc.Sprite,

        nickRichText: cc.RichText,

        levelLabel: cc.Label,

        jobTitleLabel: cc.Label,

        gainDetailLabel: cc.Label,

        gainCoinLabel: cc.Label,

        tipLabel: cc.Label,
        
        content: cc.Node
    },

    // LIFE-CYCLE CALLBACKS:
    onLoad () {

    },

    start() {
        
        this.content.y = -cc.view.getVisibleSize().height;

        this.scheduleOnce(() => {
            let s = cc.sequence(cc.moveTo(0.2, 0, -40).easing(cc.easeCubicActionOut()), cc.moveBy(0.05, 0, -20));
            this.content.runAction(s);
        }, 0.1);
    },

    dissmiss() {
        let finish = cc.callFunc(() => {
            this.node.destroy();
        }, this);
        let sequence = cc.sequence(cc.scaleTo(0.2, 0, 0).easing(cc.easeBackIn()), finish)
        this.content.runAction(sequence);
    },

    close() {
        this.dissmiss();
    },

    getTitleString(title) {
        return `<outline color=#e8e9e9 width=2><b><color=#584A47>${title}</c></b></outline>`;
    },

    getNickString(nick) {
        return `<color=#584a47>${nick}</c> <img src='dancer'/>`;
    },
});
