public static IEnumerator Unload() { if (isReady) { isReady = false; if (s_spellEffectCache != null) { UnloadCache(s_spellEffectCache); s_spellEffectCache = null; } if (s_propertyEffectCache != null) { UnloadCache(s_propertyEffectCache); s_propertyEffectCache = null; } if (s_sightEffectCache != null) { UnloadCache(s_sightEffectCache); s_sightEffectCache = null; } if (s_floatingCounterEffectCache != null) { UnloadCache(s_floatingCounterEffectCache); s_floatingCounterEffectCache = null; } if (s_floatingCounterFeedbackPool != null) { s_floatingCounterFeedbackPool.Clear(); s_floatingCounterFeedbackPool = null; } if (s_loadedSpellDefinitions != null) { foreach (SpellDefinition s_loadedSpellDefinition in s_loadedSpellDefinitions) { if (null != s_loadedSpellDefinition) { s_loadedSpellDefinition.UnloadResources(); } } s_loadedSpellDefinitions.Clear(); s_loadedSpellDefinitions = null; } s_currentSpellEffectOverrideData = null; s_instance = null; AssetBundleUnloadRequest unloadRequest = AssetManager.UnloadAssetBundle("core/factories/fight_object_factory"); while (!unloadRequest.get_isDone()) { yield return(null); } } }
private IEnumerator ClearSpellEffectOverrides() { FightSpellEffectFactory.ClearSpellEffectOverrides(fightStatus.fightId); yield break; }
public static IEnumerator Load(int fightCount) { if (isReady) { Log.Error("Load called while the fight object factory is already ready.", 91, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightSpellEffectFactory.cs"); yield break; } AssetBundleLoadRequest bundleRequest = AssetManager.LoadAssetBundle("core/spells/effects"); while (!bundleRequest.get_isDone()) { yield return(null); } if (AssetManagerError.op_Implicit(bundleRequest.get_error()) != 0) { Log.Error(string.Format("Error while loading bundle '{0}': {1}", "core/spells/effects", bundleRequest.get_error()), 103, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightSpellEffectFactory.cs"); yield break; } AllAssetsLoadRequest <FightSpellEffectFactory> assetLoadRequest = AssetManager.LoadAllAssetsAsync <FightSpellEffectFactory>("core/spells/effects"); while (!assetLoadRequest.get_isDone()) { yield return(null); } if (AssetManagerError.op_Implicit(assetLoadRequest.get_error()) != 0) { Log.Error(string.Format("Error while loading asset {0}: {1}", "FightSpellEffectFactory", assetLoadRequest.get_error()), 115, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightSpellEffectFactory.cs"); yield break; } s_instance = assetLoadRequest.get_assets()[0]; SpellEffectReferenceDictionary genericSpellEffects = s_instance.m_genericSpellEffects; Dictionary <SpellEffectKey, SpellEffect> spellEffectCache = s_spellEffectCache = new Dictionary <SpellEffectKey, SpellEffect>(((Dictionary <SpellEffectKey, AssetReference>)genericSpellEffects).Count, SpellEffectKeyComparer.instance); yield return(PreloadEffectAssets(genericSpellEffects, spellEffectCache, "core/spells/effects")); yield return(LoadEffectsResources(spellEffectCache)); PropertyEffectReferenceDictionary propertyEffects = s_instance.m_propertyEffects; Dictionary <PropertyId, AttachableEffect> propertyEffectCache = s_propertyEffectCache = new Dictionary <PropertyId, AttachableEffect>(((Dictionary <PropertyId, AssetReference>)propertyEffects).Count, PropertyIdComparer.instance); yield return(PreloadEffectAssets(propertyEffects, propertyEffectCache, "core/spells/effects")); yield return(LoadEffectsResources(propertyEffectCache)); SightEffectReferenceDictionary sightEffects = s_instance.m_sightEffects; Dictionary <PropertyId, FloatingCounterEffect> sightEffectCache = s_sightEffectCache = new Dictionary <PropertyId, FloatingCounterEffect>(((Dictionary <PropertyId, AssetReference>)sightEffects).Count, PropertyIdComparer.instance); yield return(PreloadEffectAssets(sightEffects, sightEffectCache, "core/spells/effects")); yield return(LoadEffectsResources(sightEffectCache)); FloatingCounterEffectReferenceDictionary floatingCounterEffects = s_instance.m_floatingCounterEffects; Dictionary <CaracId, FloatingCounterEffect> floatingCounterEffectCache = s_floatingCounterEffectCache = new Dictionary <CaracId, FloatingCounterEffect>(((Dictionary <CaracId, AssetReference>)floatingCounterEffects).Count, CaracIdComparer.instance); yield return(PreloadEffectAssets(floatingCounterEffects, floatingCounterEffectCache, "core/spells/effects")); yield return(LoadEffectsResources(floatingCounterEffectCache)); s_floatingCounterFeedbackPool = new GameObjectPool(s_instance.m_floatingCounterFeedbackPrefab.get_gameObject()); s_loadedSpellDefinitions = new List <SpellDefinition>(24); s_currentSpellEffectOverrideData = new SpellEffectOverrideData[fightCount]; isReady = true; }