local UIHeroAppearanceBase = UIViewClass() function UIHeroAppearanceBase:OnOpened(context) self:RegistSystemEvent(EventID.UI_HeroShow_UpdateHeroShow, self.RefreshHeroAppearanceRedPoint) self:RegistSystemEvent(EventID.UI_RefreshHeroExp, self.RefreshHeroAppearanceRedPoint) self:RegistSystemEvent(EventID.BagItem_Update, self.RefreshHeroAppearanceRedPoint) self:RegistSystemEvent(EventID.UI_Appearance_Refresh, self.RefreshHeroAppearanceRedPoint) self:RegistSystemEvent(EventID.UI_LightEffect_Refresh, self.RefreshHeroAppearanceRedPoint) self.heroId = MDL.HeroSelect.curSelectHeroID self.context = context local toggleIDS= {} self.toggleTypeList = {} self.subViewList = {} if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.HeroAppearance) and MDL.Appearance.GetHasAppearanceByHeroID(MDL.HeroSelect.curSelectHeroID, MDL.Appearance.AppearanceType.Hero) then table.insert(toggleIDS, Const_IDS.IDS_LightEffect_ShiZhuang) table.insert(self.subViewList, Const_UI_Lua.UIEnum.UIHeroAppearanceFashion) table.insert(self.toggleTypeList, LuaConst.AppearanceType.Fashion) end if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.LightEffect) then table.insert(toggleIDS, Const_IDS.IDS_Appearance_UI_GuangXiao) table.insert(self.subViewList, Const_UI_Lua.UIEnum.UIHeroLightEffectPanel) table.insert(self.toggleTypeList, LuaConst.AppearanceType.LightEffect) end if #toggleIDS > 0 then UTL.Toggle.InitToggleGroupByIDS(self.toggle_TopGroup, "txt_Grow", toggleIDS) if context and context.appearanceType then for k,v in ipairs(self.toggleTypeList) do if context.appearanceType == v then self.toggle_TopGroup:SelectIndex(k - 1) end end else self.toggle_TopGroup:SelectIndex(0) end else logging.error(LTAG.ERROR, "[DTF] : 外观子标题表为空") end self:RefreshHeroAppearanceRedPoint() end function UIHeroAppearanceBase:OnValueChanged(comp, index) if comp == self.toggle_TopGroup then self.subView:CloseAll() self.subView:OpenView(GetViewClass(self.subViewList[index + 1]), self.context) end end function UIHeroAppearanceBase:RefreshHeroAppearanceRedPoint() self.toggle_TopGroup:SetAllRedPoint(false) -- 光效 if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.LightEffect) and CTL.LightEffect.IsShowLightEffectRedPoint(self.heroId) then self:RefreshAppearanceRedPoint(LuaConst.AppearanceType.LightEffect, CTL.LightEffect.IsShowLightEffectRedPoint(self.heroId)) else self:RefreshAppearanceRedPoint(LuaConst.AppearanceType.LightEffect, false) end -- 时装 if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.HeroAppearance) and MDL.Appearance.GetHasAppearanceByHeroID(self.heroId, MDL.Appearance.AppearanceType.Hero) then self:RefreshAppearanceRedPoint(LuaConst.AppearanceType.Fashion, CTL.Appearance.IsShowAppearanceRedPoint(self.heroId)) else self:RefreshAppearanceRedPoint(LuaConst.AppearanceType.Fashion, false) end end function UIHeroAppearanceBase:RefreshAppearanceRedPoint(type, value) local index = 0 for i, v in ipairs(self.toggleTypeList) do if v == type then index = i end end if index > 0 then if type == LuaConst.AppearanceType.Fashion and value then local activeRp = false activeRp = CTL.Appearance.CanActiveAppearance(self.heroId) if MDL.Player.HeroIsLineUp(self.heroId) or activeRp then self.toggle_TopGroup:SetRedPoint(index - 1, value) self.toggle_TopGroup:SetToggleCompActive(index, "img_YelPoint", false) else self.toggle_TopGroup:SetRedPoint(index - 1, false) self.toggle_TopGroup:SetToggleCompActive(index, "img_YelPoint", value) end else self.toggle_TopGroup:SetRedPoint(index - 1, value) end end end return UIHeroAppearanceBase