Ejemplo n.º 1
0
        public static IEnumerator Load()
        {
            if (isReady)
            {
                Log.Error("Load called while the fight object factory is already ready.", 61, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightObjectFactory.cs");
                yield break;
            }
            AssetBundleLoadRequest bundleRequest = AssetManager.LoadAssetBundle("core/factories/fight_object_factory");

            while (!bundleRequest.get_isDone())
            {
                yield return(null);
            }
            if (AssetManagerError.op_Implicit(bundleRequest.get_error()) != 0)
            {
                Log.Error(string.Format("Error while loading bundle: {0} error={1}", "core/factories/fight_object_factory", bundleRequest.get_error()), 74, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightObjectFactory.cs");
                yield break;
            }
            AllAssetsLoadRequest <FightObjectFactory> assetLoadRequest = AssetManager.LoadAllAssetsAsync <FightObjectFactory>("core/factories/fight_object_factory");

            while (!assetLoadRequest.get_isDone())
            {
                yield return(null);
            }
            if (AssetManagerError.op_Implicit(assetLoadRequest.get_error()) != 0)
            {
                Log.Error(string.Format("Error while loading asset: {0} error={1}", "FightObjectFactory", assetLoadRequest.get_error()), 85, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightObjectFactory.cs");
                yield break;
            }
            s_instance = assetLoadRequest.get_assets()[0];
            s_companionCharacterPool       = new GameObjectPool(s_instance.m_companionCharacterPrefab, 2);
            s_summoningCharacterPool       = new GameObjectPool(s_instance.m_summoningCharacterPrefab, 2);
            s_objectMechanismCharacterPool = new GameObjectPool(s_instance.m_objectMechanismPrefab, 2);
            s_floorMechanismCharacterPool  = new GameObjectPool(s_instance.m_floorMechanismPrefab, 2);
            s_animatedObjectEffectPool     = new GameObjectPool(s_instance.m_animatedObjectEffectPrefab, 2);
            s_timelineAssetEffectPool      = new GameObjectPool(s_instance.m_timelineAssetEffectPrefab, 4);
            s_valueChangedFeedbackPool     = new GameObjectPool(s_instance.m_valueChangedFeedbackPrefab, 4);
            isReady = true;
        }
        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;
        }