local ZUIDialogConfirmPanel = {} local function CloseDialogUI() require("Base/UIHelper.lua"):CloseUI("UI/Public/ZUIPanelDialogConfirm.lua") end function ZUIDialogConfirmPanel.SetInfo(tips, confirmFunction, cancelFunction) local rootPanel = ZUIDialogConfirmPanel.rootPanel local textTips = rootPanel.transform:Find("Text_Tips").gameObject textTips:GetComponent("Text").text = tips local buttonConfirm = rootPanel.transform:Find("Button_OK").gameObject buttonConfirm:GetComponent("Button").onClick:AddListener(function() print("ZUIDialogConfirmPanel.OnClickConfirm") if confirmFunction ~= nil then confirmFunction() end CloseDialogUI() end) local buttonCancel = rootPanel.transform:Find("Button_Cancel").gameObject buttonCancel:GetComponent("Button").onClick:AddListener(function() print("ZUIDialogConfirmPanel.OnClickCancel") if cancelFunction ~= nil then cancelFunction() end CloseDialogUI() end) end local function MeetingClosedNotify() CloseDialogUI() end local function RegisterEvent() local eventManager = require("Base/ZEventDispatchCenter.lua") eventManager:RegisterEvent(eventManager.EventType.CLOSE_ALL_PAGE, MeetingClosedNotify) end local function UnregisterEvent() local eventManager = require("Base/ZEventDispatchCenter.lua") eventManager:UnregisterEvent(eventManager.EventType.CLOSE_ALL_PAGE, MeetingClosedNotify) end function ZUIDialogConfirmPanel.Awake(luaRoot) ZUIDialogConfirmPanel.luaRoot = luaRoot local canvas = CS.UnityEngine.GameObject.Find("Canvas") ZUIDialogConfirmPanel._rootCanvas = canvas local prefabPanel = LoadResource("Prefabs/UI/Public/ZUIDialogConfirmPanel.prefab") local rootPanel = CS.UnityEngine.GameObject.Instantiate(prefabPanel, ZUIDialogConfirmPanel._rootCanvas.transform) rootPanel.name = "ZUIDialogConfirmPanel" ZUIDialogConfirmPanel.rootPanel = rootPanel end function ZUIDialogConfirmPanel.Start() RegisterEvent() end function ZUIDialogConfirmPanel.OnDestroy() UnregisterEvent() CS.UnityEngine.GameObject.Destroy(ZUIDialogConfirmPanel.rootPanel) print("ZUIDialogConfirmPanel.OnDestroy ... ...") end return ZUIDialogConfirmPanel