local UIWorldBossSetting = UIViewClass() function UIWorldBossSetting:OnOpened(context) self.type = context.Type self.bossType = LuaConst.WorldBossType.WorldBoss if self.type == LuaConst.ActivityType.CountryWorldBoss then self.bossType = LuaConst.WorldBossType.WarZoneWorldBoss end self:UpdateNoticeInfo(self.type) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_WorldBoss_Remind_Title) end function UIWorldBossSetting:UpdateNoticeInfo(type) if type == LuaConst.ActivityType.WorldBoss then for _,info in ipairs(MDL.WorldBoss.WorldBossInfoDic) do local bossState = CTL.WorldBoss.GetBossStateAndLev(info) if bossState ~= CTL.WorldBoss.BossState.UnOpen then self.LoopScroll_Setting:AddData(info, 0) end end elseif type == LuaConst.ActivityType.CountryWorldBoss then local CountryWorldBossList = {} for _,info in pairs(MDL.WorldBoss.CountryWorldBossInfoDic) do local bossState = CTL.WorldBoss.GetBossStateAndLev(info) if bossState ~= CTL.WorldBoss.BossState.UnOpen then CountryWorldBossList[info.ID % 1000] = info end end self.LoopScroll_Setting:ReloadAll(CountryWorldBossList) end UIUtils.SetActive(self.img_Check, MDL.WorldBoss.GetRemindPref(self.bossType)) end function UIWorldBossSetting:OnCellInit(scrollRect, index, cellTable, data) if self.type == LuaConst.ActivityType.WorldBoss or self.type == LuaConst.ActivityType.CountryWorldBoss then if index % 2 == 0 then cellTable.obj_state:SetState(0) else cellTable.obj_state:SetState(1) end local bossState,lev = CTL.WorldBoss.GetBossStateAndLev(data) local isOn = MDL.WorldBoss.GetNoticePref(data.ID) UIUtils.SetActive(cellTable.img_Check.gameObject, isOn) UIUtils.SetLabelText(cellTable.txt_Name,Const_IDS[data.BossConfig.WordBossName]) CTL.WorldBoss.SetBossLevel(cellTable.txt_level, lev) if bossState == CTL.WorldBoss.BossState.Opening then UIUtils.SetLabelText(cellTable.txt_Time,Const_IDS.IDS_WorldBoss_Remind_AlreadyOpen) else UIUtils.SetLabel(cellTable.txt_Time,os.date(UTL.Time.FormatDateEnum.HM,data.NextTime)) end end end function UIWorldBossSetting:OnCellClicked(scrollRect, index, cellTable, target, data) if self.type == LuaConst.ActivityType.WorldBoss or self.type == LuaConst.ActivityType.CountryWorldBoss then local isOn = MDL.WorldBoss.GetNoticePref(data.ID) CTL.WorldBoss.SetBossNoticeState(data.ID,not isOn,true) UIUtils.SetActive(cellTable.img_Check.gameObject,not isOn) end end function UIWorldBossSetting:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIWorldBossSetting:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif comp == self.toggle_Check then local isOn = MDL.WorldBoss.GetRemindPref(self.bossType) MDL.WorldBoss.SaveRemindPref(self.bossType, not isOn) UIUtils.SetActive(self.img_Check, not isOn) end end return UIWorldBossSetting