local Appearance_Controller = {} local private = {} function Appearance_Controller.OnStartup() Appearance_Controller.IsActive = false Appearance_Controller.CurAppearanceIndex = 0 end function Appearance_Controller.IsShowAppearanceRedPoint(heroId) if not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.HeroAppearance) then return false end if not MDL.HeroSelect.IsHasHero(heroId) then return false end local appearanceList = MDL.Appearance.GetAppearanceDataByHeroID(heroId, MDL.Appearance.AppearanceType.Hero) if appearanceList then for k,v in ipairs(appearanceList) do if not v.isOriginal then if v.isActive then local isMax = DataSheetManager.HeroAppearanceLevelUp:GetDataLengthByHeroAppearanceID_Level(v.appearanceID) == v.appearanceLevel if not isMax then local nextAppearanceLevelUpCfg = DataSheetManager.HeroAppearanceLevelUp:GetDataByHeroAppearanceID_Level(v.appearanceID, v.appearanceLevel + 1) -- 升级消耗道具数量 local curItemCount = UTL.Item.GetItemStockCount(nextAppearanceLevelUpCfg.DemandItem) if curItemCount >= nextAppearanceLevelUpCfg.DemandNum then return true end end if Appearance_Controller.IsCanActiveAppearanceSpecialEffect(heroId, v.appearanceID) then return true end else -- 激活道具数量 local curItemCount = UTL.Item.GetItemStockCount(v.appearanceConfig.Activation) if curItemCount >= 1 then return true end end end end end --染色红点 if CTL.DyeAppearance.CheckRed(heroId) then return true end return false end function Appearance_Controller.CanActiveAppearance(heroId) if not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.HeroAppearance) then return false end if not MDL.HeroSelect.IsHasHero(heroId) then return false end local appearanceList = MDL.Appearance.GetAppearanceDataByHeroID(heroId, MDL.Appearance.AppearanceType.Hero) if appearanceList then for k, v in ipairs(appearanceList) do if not v.isOriginal then if not v.isActive then local curItemCount = UTL.Item.GetItemStockCount(v.appearanceConfig.Activation) if curItemCount >= 1 then return true end end end end end return false end function Appearance_Controller.IsShowWeaponRedPoint(weaponId) if not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.WeaponAppearance) then return false end if not MDL.HeroSelect.IsHasHero(weaponId) then return false end local heroInfo = MDL.HeroSelect.GetHeroInfo(weaponId) if heroInfo and heroInfo.isMagicWeaponActive then local appearanceList = MDL.Appearance.GetAppearanceDataByHeroID(weaponId, MDL.Appearance.AppearanceType.Weapon) if appearanceList then for k, v in ipairs(appearanceList) do if not v.isOriginal then if v.isActive then local isMax = DataSheetManager.WeaponAppearanceLevelUp:GetDataLengthByID_Level(v.appearanceID) == v.appearanceLevel if not isMax then local nextAppearanceLevelUpCfg = DataSheetManager.WeaponAppearanceLevelUp:GetDataByID_Level(v.appearanceID, v.appearanceLevel + 1) -- 升级消耗道具数量 local curItemCount = UTL.Item.GetItemStockCount(nextAppearanceLevelUpCfg.DemandItem) if curItemCount >= nextAppearanceLevelUpCfg.DemandNum then return true end end else -- 激活道具数量 local curItemCount = UTL.Item.GetItemStockCount(v.appearanceConfig.Activation) if curItemCount >= 1 then return true end end end end end end return false end function Appearance_Controller.CanActiveWeaponAppearance(weaponId) if not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.WeaponAppearance) then return false end if not MDL.HeroSelect.IsHasHero(weaponId) then return false end local heroInfo = MDL.HeroSelect.GetHeroInfo(weaponId) if heroInfo and heroInfo.isMagicWeaponActive then local appearanceList = MDL.Appearance.GetAppearanceDataByHeroID(weaponId, MDL.Appearance.AppearanceType.Weapon) if appearanceList then for k, v in ipairs(appearanceList) do if not v.isOriginal then if not v.isActive then -- 激活道具数量 local curItemCount = UTL.Item.GetItemStockCount(v.appearanceConfig.Activation) if curItemCount >= 1 then return true end end end end end end return false end --第一个特殊效果是光效,单独处理 function Appearance_Controller.IsHasActiveSpecialEffect(heroID, appearanceCfgId, specialEffectCfgId) local specialEffectCfg = DataSheetManager.SkinSpecialData:GetDataByID(specialEffectCfgId) if specialEffectCfg.ActivityType == 1 then -- 策划需求,吕布新旧紫皮效果一样,状态保持同步 -- 新紫皮逆世狂欢皮肤id(89),即使用旧紫皮魔神诸天的皮肤id(13), 去判断紫焰幽影是否解锁 if appearanceCfgId == 89 then appearanceCfgId = 13 end return Appearance_Controller.IsSpecialEffectActiveOfSkin(appearanceCfgId) else return MDL.Appearance.IsHasActiveSpecialEffect(heroID, appearanceCfgId, specialEffectCfgId) end end --region 皮肤特殊效果相关 --获取当前已经激活的皮肤ID数组 function private.GetHasActivedSkinIdArray() local hasActiveSkins = {} local appearanceDataList = MDL.Appearance.GetAppearanceListByType(MDL.Appearance.AppearanceType.Hero) for _, appearanceData in pairs(appearanceDataList) do for _, v in ipairs(appearanceData) do if v.isActive then table.insert(hasActiveSkins,v.appearanceID) end end end return hasActiveSkins end --皮肤ID function Appearance_Controller.IsSpecialEffectActiveOfSkin(skinId) local lightEffectId for i, v in DataSheetManager.LightEffect:GetEnumerator() do if v.Activation == 0 and #v.ActivationSkin > 0 and table.containValue(v.ActivationSkin,skinId) then lightEffectId = v.ID end end if lightEffectId then return Appearance_Controller.IsSpecialEffectActive(lightEffectId) else return false end end --特殊效果是否激活 lightEffectID 光效ID function Appearance_Controller.IsSpecialEffectActive(lightEffectID) local hasSkins = private.GetHasActivedSkinIdArray() local lightEffectData = DataSheetManager.LightEffect:GetDataByID(lightEffectID) if lightEffectData then local hasFind = 0 for i,v in ipairs(hasSkins) do if table.containValue(lightEffectData.ActivationSkin,v) then hasFind = hasFind + 1 end end if hasFind == #lightEffectData.ActivationSkin then return true end else logging.error(LTAG.ERROR,"LightEffect not find",lightEffectID) end return false end --获取特殊buff描述 function Appearance_Controller.GetSpecialBuffDes(developEffectID) if developEffectID > 0 then local devEftData = DataSheetManager.DevelopEffectData:GetDataByID(developEffectID) local buffData = DataSheetManager.BuffData:GetDataByBuffID(devEftData.BuffIDs[1]) local title = UIUtils.GetLocalizedTxt(Const_IDS[buffData.BuffName]) local idsCombineCfg = DataSheetManager.IDSCombine:GetDataByID(buffData.BuffDescribe) return title, UIUtils.GetLocalizedTxt(Const_IDS[idsCombineCfg.MainIDS]) end return nil end function Appearance_Controller.IsCanActiveAppearanceSpecialEffect(heroCfgId, appearanceCfgId) --首先判断皮肤是否激活 local appearanceData = MDL.Appearance.GetAppearanceDataByHeroID_AppearanceID(heroCfgId, appearanceCfgId, MDL.Appearance.AppearanceType.Hero) if not appearanceData.isActive then return false end local specialEffects = MDL.Appearance.GetAppearanceSpecialEffects(appearanceCfgId) if not specialEffects then return false end for __, specialEffectCfgId in ipairs(specialEffects) do if Appearance_Controller.IsCanActiveAppearanceSpecialEffectBySpecailEffectCfgId(heroCfgId, appearanceCfgId, specialEffectCfgId) then return true end end return false end function Appearance_Controller.IsCanActiveAppearanceSpecialEffectBySpecailEffectCfgId(heroCfgId, appearanceCfgId, specialEffectCfgId) local appearanceData = MDL.Appearance.GetAppearanceDataByHeroID_AppearanceID(heroCfgId, appearanceCfgId, MDL.Appearance.AppearanceType.Hero) if not appearanceData.isActive then return false end local specialEffectCfg = DataSheetManager.SkinSpecialData:GetDataByID(specialEffectCfgId) if specialEffectCfg.ActivityType == 2 then if not MDL.Appearance.IsHasActiveSpecialEffect(heroCfgId, appearanceCfgId, specialEffectCfgId) then if CTL.Bag.GetHasCountByItemCfgID(specialEffectCfg.ItemID)>=specialEffectCfg.ItemNum then return true end end end return false end function Appearance_Controller.UseRetinueItem(retinueItemCfg) MDL.HeroSelect.curSelectHeroID = retinueItemCfg.SecondType Appearance_Controller.curSelectSpecialEffectId = retinueItemCfg.ThirdType UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIHeroShowPanel, { subViewName = MDL.HeroSelect.ToggleViewNameList.Appearance }) end --endregion function Appearance_Controller.AppearanceUnlockTrigger(params, des, type) local appearanceId = tonumber(params) local appearanceCfg if type == MDL.Appearance.AppearanceType.Hero then appearanceCfg = DataSheetManager.HeroAppearance:GetDataByID(appearanceId) else appearanceCfg = DataSheetManager.WeaponAppearance:GetDataByID(appearanceId) end local isUnlock, unlockText if string.isNilOrEmpty(des) == false then local heroName = DataSheetManager.HeroNum:GetDataByID(appearanceCfg.HeroID).NameIDS unlockText = string.FormatByIdsId(Const_IDS[des], UIUtils.GetLocalizedTxt(Const_IDS[heroName]), UIUtils.GetLocalizedTxt(Const_IDS[appearanceCfg.AppearanceName])) end local info = MDL.Appearance.GetAppearanceDataByHeroID_AppearanceID(appearanceCfg.HeroID, appearanceId, type) isUnlock = info and info.isActive or false return isUnlock, unlockText end return Appearance_Controller