local LightEffect_Controller = {} local private = {} function LightEffect_Controller.IsShowLightEffectRedPoint(heroID) if not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.LightEffect) then return false end if not MDL.HeroSelect.IsHasHero(heroID) then return false end for k,v in DataSheetManager.LightEffect:GetEnumerator() do if LightEffect_Controller.IsLock(heroID, v.ID) and v.Activation ~=0 and MDL.Bag.GetItemCount(v.Activation) > 0 then if next(v.BelongTo) then for _,v2 in ipairs(v.BelongTo) do if v2 == heroID then return true end end else return true end end end return false end --检测是否激活, 激活条件不止激活道具,再增加特殊的皮肤激活方式 function LightEffect_Controller.CheckIsActive(lightEffectData) if lightEffectData then local isActive = false if lightEffectData.Activation > 0 then isActive = MDL.Bag.GetItemCount(lightEffectData.Activation) > 0 else isActive = CTL.Appearance.IsSpecialEffectActive(lightEffectData.ID) end return isActive end return false end function LightEffect_Controller.IsShowLightEffectRedPointByType(heroID, type) if not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.LightEffect) then return false end if not MDL.HeroSelect.IsHasHero(heroID) then return false end for k,v in DataSheetManager.LightEffect:GetEnumerator() do if v.Activation > 0 then local isSpecialEffectActive = #v.ActivationSkin > 0 and v.Activation == 0 local canActive = isSpecialEffectActive or MDL.Bag.GetItemCount(v.Activation) > 0 if v.Type == type and LightEffect_Controller.IsLock(heroID, v.ID) and canActive then if table.getDictCount(v.BelongTo) > 0 then for _,v2 in ipairs(v.BelongTo) do if v2 == heroID then return true end end else return true end end end end return false end function LightEffect_Controller.IsLock(heroID, lightEffectID) local activeEffectList = MDL.LightEffect.GetHeroActivateLightEffectInfo(heroID) if activeEffectList then for effectType, effectInfos in pairs(activeEffectList) do for _,effectID in ipairs(effectInfos) do if effectID == lightEffectID then return false end end end end return true end --判断是否有使用拉远镜头的光效 function LightEffect_Controller.CheckHeroUseEffectIsUseFXCamera(list) if list then for i, v in ipairs(list) do if DataSheetManager.LightEffect:GetDataByID(v).UseFaXiangCamera then return true end end end return false end function LightEffect_Controller.ShowLightEffectSuitActiveView(id) local _, effectSuitInfo = DataSheetManager.LightEffectSuit:TryGetDataByID(id) if effectSuitInfo then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonRelationActivePopUp, { TitleStr = UIUtils.GetLocalizedTxt(Const_IDS.IDS_LightEffectPictorial_Active4), itemId1 = effectSuitInfo.LightEffectList[1], itemId2 = effectSuitInfo.LightEffectList[2], attrTable = effectSuitInfo.Attr_Table, }) end end --计算两个武将交换光效消耗 function LightEffect_Controller.CalculateChangeConsumeNum(curSelectHeroID, targetHeroId) local consumeNum = 0 local differLightDic = {} local curSelectHeroLight = MDL.LightEffect.GetHeroActivateLightEffectInfo(curSelectHeroID) if curSelectHeroLight then for _,effectType in pairs(curSelectHeroLight) do for _,id in ipairs(effectType) do local data = DataSheetManager.LightEffect:GetDataByID(id) if data.Time == -1 and not (next(data.BelongTo) and table.containValue(data.BelongTo,curSelectHeroID)) then differLightDic[id] = data end end end end local targetHeroLight = MDL.LightEffect.GetHeroActivateLightEffectInfo(targetHeroId) if targetHeroLight then for _,effectType in pairs(targetHeroLight) do for _,id in ipairs(effectType) do local data = DataSheetManager.LightEffect:GetDataByID(id) if data.Time == -1 and not (next(data.BelongTo) and table.containValue(data.BelongTo,targetHeroId)) then if differLightDic[id] then differLightDic[id] = nil else differLightDic[id] = data end end end end end for _, data in pairs(differLightDic) do if data then consumeNum = consumeNum + data.Reset[2] end end return consumeNum end function LightEffect_Controller.LightEffectUnlockTrigger(params, des) local isUnlock, unlockText local effectId = tonumber(params) if string.isNilOrEmpty(des) == false then local effectCfg = DataSheetManager.LightEffect:GetDataByID(effectId) unlockText = string.FormatByIdsId(Const_IDS[des], UIUtils.GetLocalizedTxt(Const_IDS[effectCfg.LightEffectName])) end isUnlock = MDL.LightEffect.GetIsLightEffectIDActive(effectId) return isUnlock, unlockText end return LightEffect_Controller