local UISubjectMonthRogueHeroList = UIViewClass() local Type = { Battle = 1, Development = 2, } local SkillImagePath = ConstAssetPathConfig.SkillImagePath local HeroNameImg = ConstAssetPathConfig.HeroNameImg local Common2DScenePrefab = ConstAssetPathConfig.Common2DScenePrefab local bgTexturePath = ConstAssetPathConfig.bgTexturePath function UISubjectMonthRogueHeroList:OnOpened(context) self:RegistSystemEvent(EventID.UI_SubjectMonth_Rogue_UpdateHeroInfo, self.RefreshSelectList) self.level = context.level self.levelId = context.levelId self.type = context.type self.modeId = CTL.SubjectMonth.GetSubActivityModeId(MDL.SubjectMonth.SubActivityType.Rogue) self.modelComponentDataHandle = UTL.UIRender.CreateModelComponentDatas(self.heroShow) UTL.UIRender.Create2DSceneTrans(self.modelComponentDataHandle, Common2DScenePrefab, 1600, 0, 1600, bgTexturePath, false) if self.type == Type.Battle then self.state_LeftHead:SetState(1) elseif self.type == Type.Development then self.state_LeftHead:SetState(0) end self:RefreshSelectList() end function UISubjectMonthRogueHeroList:RefreshSelectList() local index = 0 if self.loopScroll_Hero.Count > 0 then self.loopScroll_Hero:ClearCells() end local heroList = CTL.Rogue.GetSortHeroList() for i, v in ipairs(heroList) do if v.HeroID == self.heroId then index = i - 1 end self.loopScroll_Hero:AddData(v, 0) end self.isSelectIndex = true self.loopScroll_Hero:SelectIndex(index) self.isSelectIndex = false end function UISubjectMonthRogueHeroList:ShowHeroModel() local heroId = self.heroId UTL.UIRender.DisposePlayerModel(self.modelComponentDataHandle) UTL.UIRender.SetHeroParentPos(self.modelComponentDataHandle, 0.16,-1.2,0) -- 设置模型位移信息 UTL.UIRender.SetHeroParentRot(self.modelComponentDataHandle, 0, -10, 0) -- 设置模型位移信息 UTL.UIRender.SetHeroParentRot(self.modelComponentDataHandle, 0, -10, 0) -- 设置模型位移信息 local modelPath, equipTable, modelScale, lightPath, heroEffectPath, heroLightEffects = UTL.UIRender.LoadShowHero(heroId, true, nil, false) UTL.UIRender.CreatePlayerModel(self.modelComponentDataHandle, heroId, modelPath, lightPath, true) if not self.effectResult then self.effectResult = CTL.FairPlay.CreateFogEffectInScene(UTL.UIRender.GetModelRootTrans(self.modelComponentDataHandle)) end end function UISubjectMonthRogueHeroList:OnButtonClicked(comp) if comp == self.btn_Skill then UIManager.OpenView(Const_UI_Lua.UIEnum.UISubjectMonthSkillPop, {heroId = self.heroId}) elseif comp == self.btn_Go then if self.level and CTL.Rogue.IsDuringRankSettlement(self.level) then CTL.Tips.AddTipsMsg(Const_IDS.IDS_VersionsActivity_Roguelike_Hint6) return end if CTL.HotFix.HasLevelPackageDownload(nil, self.levelId) == false then return end MDL.LevelSelect.EnterRogueLikeFuben(self.heroId, self.levelId) elseif comp == self.btn_Info then UIUtils.SetActive(self.group_LevelLimitTips, true) UIUtils.SetLabel(self.txt_LevelLimitTips, CTL.Rogue.GetLevelLimitTips(self.heroId)) elseif comp == self.clickMask then UIUtils.SetActive(self.group_LevelLimitTips, false) end end function UISubjectMonthRogueHeroList:OnCellInit(scrollRect, index, cellTable, data) local heroId = data.HeroID UIUtils.SetActive(cellTable.img_Experience, CTL.FairPlayCard.IsUsedExperienceCard(heroId)) UIUtils.SetActive(cellTable.img_TestBg, false) UIUtils.SetActive(cellTable.img_FreeBg, false) local heroData = DataSheetManager.HeroNum:GetDataByID(heroId) UTL.Item.SetHeroIconByHeroId(cellTable.img_HeroHead, heroId) UIUtils.SetLabelText(cellTable.txt_HeroName, Const_IDS[heroData.NameIDS]) local level = MDL.Rogue.GetHeroLevel(heroId) UIUtils.SetLabel(cellTable.txt_HeroLevel, string.FormatByIdsId(Const_IDS.IDS_BreakThrough_Lv, level)) UIUtils.SetActive(cellTable.group_Lock, not MDL.Rogue.IsHeroUnlock(heroId)) if self.type == Type.Development then cellTable.cell:SetRedPoint(CTL.Rogue.CanAnySkillLevelUpByHeroId(heroId) or CTL.Rogue.CanReceiveAnyLevelRewardByHeroID(heroId)) else cellTable.cell:SetRedPoint(false) end UIUtils.SetActive(cellTable.group_New, CTL.Rogue.IsShowNewHeroTip(heroId)) end function UISubjectMonthRogueHeroList:OnCellClicked(scrollRect, index, cellTable, target, data) self.heroId = data.HeroID if not self.isSelectIndex and CTL.Rogue.IsShowNewHeroTip(data.HeroID) then UIUtils.SetActive(cellTable.group_New, false) CTL.Rogue.SaveNewHeroTipRecord(data.HeroID) end self:ShowHeroModel() self:RefreshHeroInfo() end function UISubjectMonthRogueHeroList:RefreshHeroInfo() local heroId = self.heroId local rogueHeroData = DataSheetManager.RogueHeroData:GetDataByHeroID(heroId) local heroData = DataSheetManager.HeroNum:GetDataByID(heroId) UIUtils.SetLocalizationImage(self.img_Name, string.format(HeroNameImg, heroData.HeadImage)) CTL.HeroSelect.SetHeroProfession(heroId, self.obj_Profession, false) UIUtils.SetLabel(self.txt_Lv, string.format(UIUtils.GetLocalizedTxt(Const_IDS["IDS_BreakThrough_Lv"]), MDL.Rogue.GetHeroLevel(heroId))) if CTL.Rogue.IsHeroMaxLevel(heroId) then self.slider_Score.value = 1 else self.slider_Score.value = MDL.Rogue.GetHeroExp(heroId) / CTL.Rogue.GetHeroLevelUpExp(heroId) end UIUtils.SetActive(self.group_LevelLimitTips, false) UIUtils.SetActive(self.btn_Info, CTL.Rogue.IsHeroReachLevelLimit(heroId)) --显示攻防血信息 local atk, def, hp = CTL.Rogue.GetAtkDefHp(heroId) UIUtils.SetLabel(self.txt_ATKPresent, tostring(atk)) UIUtils.SetLabel(self.txt_DEFPresent, tostring(def)) UIUtils.SetLabel(self.txt_HPPresent, tostring(hp)) local skillDataCfg = DataSheetManager.RogueSkillData:GetDataBySkillID(rogueHeroData.SkillID) UIUtils.SetImageByAssetBundle(self.icon_Skill, string.format(SkillImagePath, skillDataCfg.SkillIcon)) UIUtils.SetLabelText(self.txt_SkillDesc, Const_IDS[rogueHeroData.SkillIDS]) UIUtils.SetLabelText(self.txt_buffinfo, Const_IDS[rogueHeroData.BuffIDS]) local isUnlock = MDL.Rogue.IsHeroUnlock(heroId) if isUnlock then local type = self.context.type if type == Type.Battle then self.state_Btn:SetState(1) elseif type == Type.Development then self.state_Btn:SetState(2) end else self.state_Btn:SetState(0) if rogueHeroData.HeroUnlock ~= 0 then local triggerData = DataSheetManager.TriggerID:GetDataByID(rogueHeroData.HeroUnlock).Unlock_Table[1] local condition = string.FormatByIdsId(Const_IDS[triggerData.UnlockConditionDes], triggerData.UnlockConditionParamA, triggerData.UnlockConditionParamB) UIUtils.SetLabel(self.txt_unlocklinfo, condition) else self.state_Btn:SetState(3) end end if self.type == Type.Development then self.btn_Skill:SetRedPoint(CTL.Rogue.CanAnySkillLevelUpByHeroId(self.heroId) or CTL.Rogue.CanReceiveAnyLevelRewardByHeroID(self.heroId)) end end function UISubjectMonthRogueHeroList:OnClosed() UTL.UIRender.DisposeModelComponentData(self.modelComponentDataHandle) end return UISubjectMonthRogueHeroList