local UICountryForeshow = UIViewClass() local DefaultImage = ConstAssetPathConfig.DefaultImage function UICountryForeshow:OnOpened(context) UTL.Toggle.InitToggleGroupByIDS(self.toggle_LeftTab, "txt",{Const_IDS.IDS_Country_PhaseDetail, Const_IDS.IDS_Country_ActivityDetail, Const_IDS.IDS_Country_WarspoilDetail}) self.toggle_LeftTab:SelectIndex(0) UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_Country_Foreshow) self:RegistSystemEvent(EventID.UI_Country_ChangeBGImage, self.ChangeBGImage) end function UICountryForeshow:ChangeBGImage(path) UIUtils.SetTextureByAssetBundle(self.img_Bg, path) end function UICountryForeshow:OnValueChanged(comp, index) if comp == self.toggle_LeftTab then self.subView:CloseAll() if index == 2 then UIUtils.SetTextureByAssetBundle(self.img_Bg, DefaultImage) self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UICountryForeshowState2)) elseif index == 0 then self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UICountryForeshowState1)) elseif index == 1 then UIUtils.SetTextureByAssetBundle(self.img_Bg, DefaultImage) self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UICountryForeshowState3)) end self:SelectIndex(index + 1) end end function UICountryForeshow:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UICountryForeshow:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:CloseView() elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.UITemplateTitlePanel.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.Country }) elseif comp == self.btn_Warzone then UIManager.OpenView(Const_UI_Lua.UIEnum.UIWarzoneList) end end function UICountryForeshow:SelectIndex(index) for i = 1, self.toggle_LeftTab.Count do self.toggle_LeftTab:SetToggleCompActive(i, "Line2", i ~= index) self.toggle_LeftTab:SetToggleCompActive(i, "Line3", i ~= index) end end return UICountryForeshow