local UICountryBase = UIViewClass() local SubView = { Main = 0, FenFeng = 1, Member = 2, Activity = 4, Players = 3, } function UICountryBase:OnOpened(context) self:RegistSystemEvent(EventID.UI_CloseAndRecoverView, self.OnCloseAndRecoverView) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Country_SalaryReward, self.UpdateSalaryBtnRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Country_SyncCityWar, self.UpdateActivityBtnRp) self.group_Toggles = self.UITemplateLeftBtnPanel.toggles_Group UTL.Toggle.InitToggleGroupByIDS(self.group_Toggles, "txt", { Const_IDS.IDS_GuildMainpage_PageTitle, Const_IDS.IDS_Country_GuildAppointTab, Const_IDS.IDS_Country_OfficerTab, Const_IDS.IDS_Country_MemberTab, Const_IDS.IDS_Activity}) UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_Country_FunctionName) if context then self.group_Toggles:SelectIndex(context.index) else self.group_Toggles:SelectIndex(0) end self:UpdateSalaryBtnRp() self:UpdateActivityBtnRp() end function UICountryBase:UpdateSalaryBtnRp() self.group_Toggles:SetRedPoint(1, CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Country_SalaryReward)) end function UICountryBase:UpdateActivityBtnRp() self.group_Toggles:SetRedPoint(4, CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Country_SyncCityWar)) end function UICountryBase:OnValueChanged(comp, index) if comp == self.group_Toggles then self:OpenSubView(index) end end function UICountryBase:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:CloseView(true) elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.UITemplateTitlePanel.btn_Info then CTL.Country.OpenCountryMainNoteView() elseif comp == self.btn_Warzone then UIManager.OpenView(Const_UI_Lua.UIEnum.UIWarzoneList) end end function UICountryBase:OpenSubView(index) self.subView:CloseAll() if index == SubView.Main then UIUtils.SetActive(self.bg_Bottom, false) self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UICountryMain)) elseif index == SubView.FenFeng then UIUtils.SetActive(self.bg_Bottom, true) self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UICountryEnfeoff)) elseif index == SubView.Member then UIUtils.SetActive(self.bg_Bottom, false) self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UICountryOfficial)) elseif index == SubView.Activity then UIUtils.SetActive(self.bg_Bottom, true) self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UICountryForeshowState3)) elseif index == SubView.Players then UIUtils.SetActive(self.bg_Bottom, true) self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UICountryPopupMemberList)) end self.context = {index = index} end function UICountryBase:OnClosePanel() end return UICountryBase