local UIGuildPublicNotice = UIViewClass() function UIGuildPublicNotice:OnOpened(context) self.obj_InputField.text = context.text if context.isNotice then self:SetNoticeInfo() else self:SetRecruitInfo() end end function UIGuildPublicNotice:OnValueChanged(comp, value) if comp == self.obj_InputField then local length = DataSheetManager.ConstData:GetDataByID("GuildNoticeCharNumlimit").IntValue self.obj_InputField.text = UTL.String.CutStrByLength(self.obj_InputField.text, length) end end function UIGuildPublicNotice:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGuildPublicNotice:OnButtonClicked(comp) if comp == self.btn_1 then if string.isNilOrEmpty(self.obj_InputField.text) then CTL.Sound.PlayGameSound("UI_invalid") self:ShowEmptyTips() else self:GuildSetupReq() self:CloseView() end elseif comp == self.UICommonPopUp.btn_Close then self:CloseView() end end function UIGuildPublicNotice:SetNoticeInfo() UIUtils.SetLabelText(self.lab_NoticePrompt, Const_IDS.IDS_GuildNotice_Label) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_GuildMainpage_Title1) if self.obj_InputField.text == "" then self.obj_InputField.text = UIUtils.GetLocalizedTxt(Const_IDS.IDS_Guild_InitialNotice) end end function UIGuildPublicNotice:SetRecruitInfo() UIUtils.SetLabelText(self.lab_NoticePrompt, Const_IDS.IDS_GuildAnnounce_Label) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title,Const_IDS.IDS_GuildAnnounce_Title) end function UIGuildPublicNotice:ShowEmptyTips() if self.context.isNotice then CTL.Tips.AddTipsMsg(Const_IDS.IDS_GuildNotice_EmptyText) else CTL.Tips.AddTipsMsg(Const_IDS.IDS_GuildAnnounce_EmptyText) end end function UIGuildPublicNotice:GuildSetupReq() if self.context.isNotice then MDL.Guild.GuildSetupReq(MDL.Guild.GuildUpdateType.Notice, self.obj_InputField.text) else MDL.Guild.GuildSetupReq(MDL.Guild.GuildUpdateType.RecruitTagline, self.obj_InputField.text) end end return UIGuildPublicNotice