-- 阵容详情界面(隔离玩家自身信息) ---[[ --- 使用服务器发来装备、坐骑、武将信息的阵容详情界面基类 --- self.slotCustomDetail 服务器发来的独立读取数据源 --- 子类重写 --- OnClickSave方法进行按键逻辑重写 --- UpdateViewBySubView界面显示 --- 子类: --- UIStormFreeLineupCustomDetailPanel 暴风阵容详情 ---]] local UIFreeLineupDetailPanel = require("View/FreeLineUp/UIFreeLineupDetailPanel") local UIFreeLineupCustomDetailPanel = UIViewClass(UIFreeLineupDetailPanel) --region Hero -- OVERRIDE function UIFreeLineupCustomDetailPanel:InitHeroInfo(formationGroupCollection, slotIndex) local realSlotIndex = self:GetMappingData(1, slotIndex, 0) local heroInfo = self.slotCustomDetail[realSlotIndex].heroInfos --进阶 local advancedData = DataSheetManager.HeroAdvance:GetDataByAdvanceID(heroInfo.advanceLv) local groupStar = formationGroupCollection.group_Star CTL.Advanced.InstantiateStarCell( self, groupStar[1].gameObject, groupStar, advancedData.SumStar, advancedData.LightStar, advancedData.StarColorIcon, advancedData.StarLockIcon ) --X阶X级 local title = string.FormatByIdsId(Const_IDS[advancedData.AdvanceDesc], advancedData.Stage, advancedData.LightStar) UIUtils.SetLabel(formationGroupCollection.txt_Advance, title) --等级显示 local heroLevelUpData = DataSheetManager.HeroLevelUp:GetDataByHeroLevel(heroInfo.heroLv) if heroLevelUpData then local levelStr = UTL.Item.GetNobilityByTeamLevel(heroLevelUpData.HeroLevel, 2) -- 爵位转换 local teamLevelName = string.FormatByIdsId(Const_IDS[heroLevelUpData.TeamLevelName], levelStr) UIUtils.SetLabel(formationGroupCollection.txt_Level, teamLevelName) end end --endregion --region Equipment -- OVERRIDE function UIFreeLineupCustomDetailPanel:InitEquipment(formationGroupCollection, slotIndex) local groupFormation = formationGroupCollection local equipList = { [1] = groupFormation.group_EquipItem1, [2] = groupFormation.group_EquipItem2, [3] = groupFormation.group_EquipItem3, [4] = groupFormation.group_EquipItem4, } for slotSubIndex = 1, #equipList do local realSlotIndex = self:GetMappingData(2, slotIndex, slotSubIndex) local equipInfos = self.slotCustomDetail[realSlotIndex].equipInfos if equipInfos then equipList[slotSubIndex].btn_Click:SetRedPoint(false) UIUtils.SetActive(equipList[slotSubIndex].img_Upgrade, false) local isUnlock, content = CTL.Equipment.CheckIfEquipTypeUnlock(slotSubIndex) if isUnlock == false then equipList[slotSubIndex].txt_Locked.text = content else local isEquipped = false for j = 1, #equipInfos do local eqInfo = equipInfos[slotSubIndex] if eqInfo.equipCfgId > 0 then isEquipped = true equipList[slotSubIndex].obj_state:SetState(0) local itemData = DataSheetManager.ItemData:GetDataByID(eqInfo.equipCfgId) self:SetEquipItem(equipList[slotSubIndex], itemData, eqInfo.equipLv) -- 装备等级 local equipData = DataSheetManager.EquipData:GetDataByID(eqInfo.equipCfgId) UIUtils.SetLabel(equipList[slotSubIndex].txt_StageLv, string.FormatByIdsId(Const_IDS.IDS_EquipData_StageShow, UIUtils.GetLocalizedTxt(Const_IDS["IDS_Number_Written_"..equipData.EquipStage]))) break end end if isEquipped == false then equipList[slotSubIndex].obj_state:SetState(1) UTL.Item.SetAtlasSprite(equipList[slotSubIndex].img_quality, "UI_Formation", "zr_icon_pz02") end end else local isUnlock, content = CTL.Equipment.CheckIfEquipTypeUnlock(slotSubIndex) if isUnlock == false then equipList[slotSubIndex].txt_Locked.text = content else equipList[slotSubIndex].obj_state:SetState(1) equipList[slotSubIndex].btn_Click:SetRedPoint(false) UIUtils.SetActive(equipList[slotSubIndex].img_Upgrade, false) UTL.Item.SetAtlasSprite(equipList[slotSubIndex].img_quality, "UI_Formation", "zr_icon_pz02") end end self:SetEquipGemInfo(realSlotIndex, equipList, slotSubIndex) end end -- OVERRIDE function UIFreeLineupCustomDetailPanel:SetEquipGemInfo(dataIndex, equipList, slotSubIndex) local gemIconRoot = equipList[slotSubIndex].group_Gem local gemIconBg = equipList[slotSubIndex].bg_Gem local gemIcons = equipList[slotSubIndex].cell_Gem local inlayGemInfos = self.slotCustomDetail[dataIndex].equipInfos[slotSubIndex].jewId if inlayGemInfos ~= nil and #inlayGemInfos > 0 then UIUtils.SetActive(gemIconRoot.gameObject, true) UIUtils.SetActive(gemIconBg, true) for i = 1, #inlayGemInfos do local gemIcon = gemIconRoot[i] if gemIcon == nil then gemIcon = self:InstantiateCollection(gemIconRoot, gemIcons.gameObject) end UIUtils.SetActive(gemIcon.gameObject, true) local icon = gemIcon.icon_Gem if inlayGemInfos[i] > 0 then local itemData = DataSheetManager.ItemData:GetDataByID(inlayGemInfos[i]) local jadeIcon = DataSheetManager.JadeLittleIcon:GetDataByLevel(itemData.ThirdType) UTL.Item.ItemIconByName(icon, jadeIcon.JadeIcon) UIUtils.SetActive(icon, true) else UIUtils.SetActive(icon, false) end end else if self:HasEquipmentJews(inlayGemInfos) == false then UIUtils.SetActive(gemIconRoot.gameObject, false) UIUtils.SetActive(gemIconBg, false) else UIUtils.SetActive(gemIconRoot.gameObject, true) UIUtils.SetActive(gemIconBg, true) for i = 1, 4 do local GemTypeCfgData = DataSheetManager.JadeType:GetDataByID_ChildID(slotSubIndex, i) local isUnlock = MDL.Unlock.IsComplete(GemTypeCfgData.UnlockCondition, GemTypeCfgData.UnlockConditionParam) if isUnlock then local gemIcon = gemIconRoot[i] if gemIcon == nil then gemIcon = self:InstantiateCollection(gemIconRoot, gemIcons.gameObject) end UIUtils.SetActive(gemIcon.gameObject, true) local icon = gemIcon.icon_Gem UIUtils.SetActive(icon, false) else local gemIcon = gemIconRoot[i] if gemIcon ~= nil then UIUtils.SetActive(gemIcon.gameObject, false) end end end end end end function UIFreeLineupCustomDetailPanel:HasEquipmentJews(jewsList) local hasJew = false for i, v in ipairs(jewsList) do if v > 0 then hasJew = true end end return hasJew end --endregion --region Horse -- OVERRIDE -- OVERRIDE function UIFreeLineupCustomDetailPanel:InitHorse(formationGroupCollection, slotIndex) local realSlotIndex = self:GetMappingData(3, slotIndex, 0) local serverHorseInfo = self.slotCustomDetail[realSlotIndex].horseInfo if serverHorseInfo.horseId > 0 then --没有坐骑时服务器返的id为0 local config = DataSheetManager.HorseData:GetDataByHorseID(serverHorseInfo.horseId) local framePath = DataSheetManager.QualityColor:GetDataByID(config.HorseQuality).LineupSelectionFrame UIUtils.SetImageByAssetBundle(formationGroupCollection.img_Bg, framePath) UIUtils.SetImageByAssetBundle(formationGroupCollection.img_TreasureIcon, config.HorsePicture) formationGroupCollection.img_TreasureIcon:SetNativeSize() formationGroupCollection.effect_TreasureQuality:StopUIEffect() local starLevel = serverHorseInfo.horseLv if starLevel > 0 then formationGroupCollection.lab_StarLevel.text = "+" .. starLevel UIUtils.SetActive(formationGroupCollection.bg_Level, true) else formationGroupCollection.lab_StarLevel.text = "" UIUtils.SetActive(formationGroupCollection.bg_Level, false) end formationGroupCollection.lab_TreasureName.text = UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[config.HorseName]), config.HorseQuality) --品质特效 UTL.Color.PlayQualityEffect(formationGroupCollection.effect_TreasureQuality, config.HorseColorEffectID, UTL.Color.EffectType.Main) else UIUtils.SetActive(formationGroupCollection.group_TreasureHorse, false) UIUtils.SetActive(formationGroupCollection.group_Empty, true) end end --endregion --region Treasure -- OVERRIDE function UIFreeLineupCustomDetailPanel:InitTreasure(formationGroupCollection, slotIndex) local realSlotIndex = self:GetMappingData(4, slotIndex, 0) local serverTreasureInfo = self.slotCustomDetail[realSlotIndex].treasureInfo if serverTreasureInfo.treasureId > 0 then local isSuccess, data = DataSheetManager.TreasureData:TryGetDataByTreasureID(serverTreasureInfo.treasureId) if isSuccess then UTL.Color.SetQualityImageByType(formationGroupCollection.img_QualityBg, data.TreasureQuality, UTL.Color.QualityType.TreasureBase) local framePath = DataSheetManager.QualityColor:GetDataByID(data.TreasureQuality).LineupSelectionFrame UIUtils.SetImageByAssetBundle(formationGroupCollection.img_Bg, framePath) UIUtils.SetImageByAssetBundle(formationGroupCollection.img_TreasureIcon, data.TreasurePicture) formationGroupCollection.img_TreasureIcon:SetNativeSize() UIUtils.SetLabelText(formationGroupCollection.lab_TreasureName, Const_IDS[data.TreasureName]) formationGroupCollection.effect_TreasureQuality:StopUIEffect() local starLevel = serverTreasureInfo.treasureLv if starLevel > 0 then formationGroupCollection.lab_StarLevel.text = "+" .. starLevel UIUtils.SetActive(formationGroupCollection.bg_Level, true) else formationGroupCollection.lab_StarLevel.text = "" UIUtils.SetActive(formationGroupCollection.bg_Level, false) end formationGroupCollection.lab_TreasureName.text = UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[data.TreasureName]), data.TreasureQuality) UTL.Color.PlayQualityEffect(formationGroupCollection.effect_TreasureQuality, data.TreasureQualityEffect, UTL.Color.EffectType.Main) else UIUtils.SetActive(formationGroupCollection.group_TreasureHorse, false) UIUtils.SetActive(formationGroupCollection.group_Empty, true) end else UIUtils.SetActive(formationGroupCollection.group_TreasureHorse, false) UIUtils.SetActive(formationGroupCollection.group_Empty, true) end end --endregion return UIFreeLineupCustomDetailPanel