local UIGuildEditorChatNumber = UIViewClass() function UIGuildEditorChatNumber:OnOpened(context) if string.isNilOrEmpty(MDL.Guild.GetGuildMemberInfo().groupChatNum) then self.curSelectType = 0 else local chatValues = string.split(MDL.Guild.GetGuildMemberInfo().groupChatNum,":") self.obj_InputField.text = chatValues[2] self.curSelectType = tonumber(chatValues[1]) end self:InitGuildCommunityInfo() self.Loop_Type:SelectIndex(self.curSelectType) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title,Const_IDS.IDS_GuildGroup_Title) end function UIGuildEditorChatNumber:InitGuildCommunityInfo() for _, info in DataSheetManager.GuildCommunity:GetEnumerator() do if CTL.Guild.IsGuildCommunityOpen(info.ShowType) then self.Loop_Type:AddData(info, 0) end end end function UIGuildEditorChatNumber:OnCellInit(scrollRect, index, cellTable, data) local isSelected = self.curSelectType == index UIUtils.SetActive(cellTable.img_IconMask, not isSelected) UIUtils.SetActive(cellTable.img_Arrow, isSelected) UIUtils.SetLabelText(cellTable.txt_Name, Const_IDS[data.Name]) UIUtils.SetImageByAssetBundle(cellTable.img_Icon, data.ImageSource) UIUtils.SetImageByAssetBundle(cellTable.img_IconMask, data.ImageSource) if isSelected then cellTable.state_Txt:SetState(1) else cellTable.state_Txt:SetState(0) end end function UIGuildEditorChatNumber:OnCellClicked(scrollRect, index, cellTable, target, data) if self.curSelectType == index then return end self.curSelectType = index self.Loop_Type:RefreshCells() end function UIGuildEditorChatNumber:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIGuildEditorChatNumber:OnButtonClicked(comp) if comp == self.btn_1 then if string.isNilOrEmpty(self.obj_InputField.text) then MDL.Guild.GuildSetupReq(MDL.Guild.GuildUpdateType.GroupChatNum,"") else MDL.Guild.GuildSetupReq(MDL.Guild.GuildUpdateType.GroupChatNum,self.curSelectType..":"..self.obj_InputField.text) end self:CloseView() elseif comp == self.UICommonPopUp.btn_Close then self:CloseView() end end function UIGuildEditorChatNumber:OnValueChanged(comp, value) if comp == self.obj_InputField then local length = DataSheetManager.ConstData:GetDataByID("GuildGroupCharNumlimit").IntValue - 2 ---类型加:占用2长度 self.obj_InputField.text = UTL.String.CutStrByLength(self.obj_InputField.text, length) end end return UIGuildEditorChatNumber