// 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

import AppPlatform from "../../FrameWork/Util/AppPlatform";
import Common5 from "../../Platform/th/Common5";
import UiBase from "../GameBase/UiBase";

const { ccclass, property } = cc._decorator;

@ccclass
export default class ShouYiTip extends UiBase {
    @property(cc.Sprite)
    sp: cc.Sprite = null;
    @property(cc.RichText)
    richtext: cc.RichText = null;
    @property(cc.Label)
    lab1: cc.Label = null;
    @property(cc.Label)
    lab2: cc.Label = null;

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {}
    sureCallFunc = null
    adCallFunc = null
    closeFunc = null
    start() {

    }

    setViewData(beishu, sureCallFunc?, adCallFunc?) {
        Common5.getSpriteFrameFromBundle("BoxTip", "texture/ShouYiTip/" + beishu + "倍 收益", this.sp)
        this.richtext.string = `<color=#ffffff>恭喜抽中</c><color=#c9904d>${beishu}倍收益</color>`
        this.lab1.string = "早餐摊收入:x" + beishu
        this.lab2.string = "出售早餐收益:x" + beishu
        this.sureCallFunc = sureCallFunc
        this.adCallFunc = adCallFunc
    }

    onTouchClose(){
        this.sureCallFunc && this.sureCallFunc()
        this.closeUi()
    }

    // update (dt) {}
}