import Panel from "../views/Panel";
import PanelCtrl from "../ctrls/panelCtrl";
import { ModuleTypes } from "../types/sceneTypes";

export default class GuideSurePanel extends Panel{
    protected get skinKey(){    return'GuideSure'   }

    public shebeiImg:eui.Image;
    public title:eui.Label;
    public message:eui.Label;
    public coinnum:eui.Label;
    public dianum:eui.Label;
    public buyBtn:eui.Button;
    public closeBtn:eui.Button;
    public costnum:eui.Label;

    public func:any;

    constructor(data){
        super();
    }
    initUI(data){
        this.shebeiImg.source = "gb"+data.name+data.num+"_png";
        this.costnum.text = data.cost;
        //金币数据 钻石数据  名称文案缺
        if(data.name == "desk"){
            if(data.num == 1){
                this.title.text = "简易木质桌椅"
                this.message.text = "简单实用的首选"
                this.coinnum.text = ""
                this.dianum.text = "5"
            }else if(data.num == 2){
                this.title.text = "复古典雅桌椅"
                this.message.text = "怀旧人士的最爱"
                this.coinnum.text = ""
                this.dianum.text = "20"
            }else if(data.num == 3){
                this.title.text = "尊贵首席桌椅"
                this.message.text = "逼格提升专用桌椅"
                this.coinnum.text = ""
                this.dianum.text = "50"
            }
        }else if(data.name == "coffee"){
            if(data.num == 1){
                this.title.text = "简易迷你咖啡机"
                this.message.text = "滴漏式咖啡壶茶壶两用"
                this.coinnum.text = ""
                this.dianum.text = "30"
            }else if(data.num == 2){
                this.title.text = "半自动美式咖啡机"
                this.message.text = "新鲜研磨，还原醇香"
                this.coinnum.text = ""
                this.dianum.text = "100"
            }else if(data.num == 3){
                this.title.text = "全自动现磨一体机"
                this.message.text = "花式咖啡，一键制作"
                this.coinnum.text = ""
                this.dianum.text = "300"
            }
        }else if(data.name == "cash"){
            if(data.num == 1){
                this.title.text = "简约现代收银台"
                this.message.text = "招揽生意入门级法宝"
                this.coinnum.text = ""
                this.dianum.text = "50"
            }else if(data.num == 2){
                this.title.text = "宽敞别致收银台"
                this.message.text = "瞬间勾住门外顾客"
                this.coinnum.text = ""
                this.dianum.text = "200"
            }else if(data.num == 3){
                this.title.text = "招财进宝型收银台"
                this.message.text = "据说用这个收银台的都很赚"
                this.coinnum.text = ""
                this.dianum.text = "500"
            }
        }else if(data.name == "oven"){
            if(data.num == 1){
                this.title.text = "小型蛋糕烤箱"
                this.message.text = "自动烘焙多功能"
                this.coinnum.text = ""
                this.dianum.text = "10"
            }else if(data.num == 2){
                this.title.text = "全自动多功能烘焙"
                this.message.text = "极简呈现，焙出腔调"
                this.coinnum.text = ""
                this.dianum.text = "30"
            }else if(data.num == 3){
                this.title.text = "嵌入式蒸烤一体机"
                this.message.text = "花样72变，精致厨房生活"
                this.coinnum.text = ""
                this.dianum.text = "100"
            }
        }else if(data.name == "frige"){
            if(data.num == 1){
                this.title.text = "双门实用冰箱"
                this.message.text = "别看我小，但我实用"
                this.coinnum.text = ""
                this.dianum.text = "20"
            }else if(data.num == 2){
                this.title.text = "智能静音双开门"
                this.message.text = "超大容量，智能锁鲜"
                this.coinnum.text = ""
                this.dianum.text = "50"
            }else if(data.num == 3){
                this.title.text = "6门复式冰箱"
                this.message.text = "高贵优雅，智能温控"
                this.coinnum.text = ""
                this.dianum.text = "200"
            }
        }else if(data.name == "wait"){
            if(data.num == 1){
                this.title.text = "贱萌胖妹妹"
                this.message.text = "爱做鬼脸，不爱减肥"
                this.coinnum.text = ""
                this.dianum.text = "100"
            }else if(data.num == 2){
                this.title.text = "超嗲小猫咪"
                this.message.text = "别养猫了，养服务员吧"
                this.coinnum.text = ""
                this.dianum.text = "500"
            }else if(data.num == 3){
                this.title.text = "人气小兔纸"
                this.message.text = "可能会带来额外小费哦"
                this.coinnum.text = ""
                this.dianum.text = "1000"
            }
        }
        this.func = this.onTap_Buy.bind(this,data.cost);
    }
    initEvents(){
        super.initEvents();
        this.onTap(this.closeBtn,this.onTap_close);
        this.onTap(this.buyBtn,this.func);
    }
    onTap_close(){
        this.hidePanel();
        PanelCtrl.instance.show(ModuleTypes.GUIDEBUY_PANEL);
    }
    //购买
    onTap_Buy(){

    }
    removeEvents(){
        super.removeEvents();
        this.clearTap(this.closeBtn,this.onTap_close);
        this.clearTap(this.buyBtn,this.func);
    }
}