123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- 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(){
-
- }
-
- }
|