local UIMessageBoxView = require("View/MessageBox/UIMessageBoxView") local UIMessageBoxSettingView = UIViewClass(UIMessageBoxView) local midlePosX = 0 local rightPosX = 260 function UIMessageBoxSettingView:OnOpened(context) UTL.String.SetLabelContent(self.UICommonPopView.refer_Bg.txt_Title,context.title) UTL.String.SetLabelContent(self.Text_Local,context.content) self.UICommonPopView.btn_1:SetText(context.okBtnText) self.UICommonPopView.btn_2:SetText(context.cancelBtnText) UIUtils.SetActive(self.UICommonPopView.refer_Bg.img_Info, false) self.okCB = context.okCB self.cancelCB = context.cancelCB self.toggleCB = context.toggleCB self.UICommonPopView.refer_Bg.btn_Close.gameObject:SetActive(true) local contentPosX, contentPosY = self.UICommonPopView.btn_1.transform:GetAnchoredPosition() if context.type == UTL.MessageBox.BoxType.OnlyOk then self.UICommonPopView.btn_2.gameObject:SetActive(false) UIUtils.SetRectPosition(self.UICommonPopView.btn_1.gameObject,midlePosX,contentPosY) elseif context.type == UTL.MessageBox.BoxType.OnlyOkNoClose then self.UICommonPopView.btn_2.gameObject:SetActive(false) UIUtils.SetRectPosition(self.UICommonPopView.btn_1.gameObject,midlePosX,contentPosY) self.UICommonPopView.refer_Bg.btn_Close.gameObject:SetActive(false) elseif context.type == UTL.MessageBox.BoxType.OKCancel then self.UICommonPopView.btn_2.gameObject:SetActive(true) UIUtils.SetRectPosition(self.UICommonPopView.btn_1.gameObject,rightPosX,contentPosY) elseif context.type == UTL.MessageBox.BoxType.OKCancelNoClose then UIUtils.SetActive(self.UICommonPopView.btn_2, true) UIUtils.SetActive(self.UICommonPopView.refer_Bg.btn_Close, false) UIUtils.SetRectPosition(self.UICommonPopView.btn_1.gameObject,rightPosX,contentPosY) end self.displayType = context.displayType; self:SetPushStyle(LuaConst.PushStyleEnum.CLOSENOTRECOVER) if BattleDataGetter.IsStandaloneBattleLevel() then self.isLevelPause = BattleDataGetter.IsLevelPause() if not self.isLevelPause then NotSyncBattleSetter.PauseLevel(true) end end end function UIMessageBoxSettingView:OnClosed() UIUtils.SetActive(self.UICommonPopView.btn_1, true) UIUtils.SetActive(self.UICommonPopView.btn_2, true) UIUtils.SetActive(self.UICommonPopView.refer_Bg.btn_Close, true) UTL.MessageBox.OnCloseBoxView(self.displayType) if BattleDataGetter.IsStandaloneBattleLevel() then if not self.isLevelPause then NotSyncBattleSetter.PauseLevel(false) end end UTL.MessageBox.RecoverPostion(self.UICommonPopView) end return UIMessageBoxSettingView