import { GameMng } from "../GameMng"; import { UIButton } from "../gcommon/UIButton"; import GBaseUI from "../gcommon/GBaseUI"; import { UIManager } from "../gcommon/UIManager"; import { _decorator,Node, Label } from "cc"; const {ccclass, property} = _decorator; @ccclass export default class UIDialog extends GBaseUI { @property(Label) lab_des: Node = null; @property(Node) btn_queding: Node = null; @property(Node) btn_quxiao: Node = null; static dialog_des:string = null; static isShowCancel:boolean = true; static Show(sureCb:any,cancelCb:any,str:any,parent?:Node,isShowCancel?:boolean){ UIDialog.dialog_des = str; UIDialog.isShowCancel = isShowCancel; UIDialog.DialogCancelCall = cancelCb UIDialog.DialogSureCall = sureCb UIManager.AddPrefab(GameMng.Instance.uiDialog,parent); } start () { this.btn_quxiao.active = UIDialog.isShowCancel; UIButton.BindClick(this.btn_queding,()=>{ this.closeUI(); UIDialog.DialogSureCall() },this); UIButton.BindClick(this.btn_quxiao,()=>{ this.closeUI(); UIDialog.DialogCancelCall() },this); } update(dt){ if(UIDialog.dialog_des!=null){ this.lab_des.getComponent(Label).string = UIDialog.dialog_des.toString() UIDialog.dialog_des = null; } } static DialogSureCall(){ } static DialogCancelCall(){ } }