local UICountryNoticePanel = UIViewClass() local MAXCOUNT = 3 function UICountryNoticePanel:OnOpened(context) local sendCount = MDL.Country.GetMyCountryInfo().notificationSendTimes if MAXCOUNT - sendCount == 0 then self.noCount = true self.txt_NoticeNum.text = string.FormatByIdsId(Const_IDS.IDS_Guild_DailyNum, UTL.Color.FormatRedColor(0)) else self.txt_NoticeNum.text = string.FormatByIdsId(Const_IDS.IDS_Guild_DailyNum, UTL.Color.FormatGreenColor(MAXCOUNT - sendCount)) end UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_Country_Mail) UIUtils.SetActive(self.group_TopBtn, false) UIUtils.SetActive(self.group_Mail, true) end function UICountryNoticePanel:OnValueChanged(comp, value) if comp == self.obj_InputTitle then local length = DataSheetManager.ConstData:GetDataByID("CountryMailTitleCharLimit").IntValue self.obj_InputTitle.text = UTL.String.CutStrByLength(self.obj_InputTitle.text, length) elseif comp == self.obj_InputField then local length = DataSheetManager.ConstData:GetDataByID("CountryMailCharLimit").IntValue self.obj_InputField.text = UTL.String.CutStrByLength(self.obj_InputField.text, length) end end function UICountryNoticePanel:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UICountryNoticePanel:OnButtonClicked(comp) if comp == self.btn_1 then if self.noCount then CTL.Tips.AddTipsMsgAndPlaySound(Const_IDS.IDS_ERRORCODE_1340_InfoCode_Guild_FunctionDailyLimit) return elseif string.isNilOrEmpty(self.obj_InputTitle.text) or string.isNilOrEmpty(self.obj_InputField.text) then CTL.Tips.AddTipsMsgAndPlaySound(Const_IDS.IDS_GuildMail_EmptyText) return end MDL.Country.CountryNotificationReq(self.obj_InputTitle.text, self.obj_InputField.text) self:CloseView() elseif comp == self.UICommonPopUp.btn_Close then self:CloseView() end end return UICountryNoticePanel