public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (!(null != view))
         {
             yield break;
         }
         int count = companionDefId.Count;
         if (count > 0)
         {
             IEnumerator[] array = new IEnumerator[count];
             for (int i = 0; i < count; i++)
             {
                 array[i] = view.AddCompanion(companionDefId[i], levels[i], i);
             }
             yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(array));
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 59, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedInReserveEvent.cs");
     }
 }
Exemple #2
0
        protected IEnumerator Load(params AudioReferenceWithParameters[] audioReferences)
        {
            int num       = audioReferences.Length;
            int bankCount = 0;

            if (num == 0)
            {
                m_initializationState = InitializationState.Loaded;
                yield break;
            }
            string[] array = new string[num];
            for (int i = 0; i < num; i++)
            {
                AudioReferenceWithParameters val = audioReferences[i];
                if (!val.get_isValid() || !AudioManager.TryGetDefaultBankName(AudioReferenceWithParameters.op_Implicit(val), out string bankName))
                {
                    continue;
                }
                int num2 = 0;
                while (true)
                {
                    if (num2 < bankCount)
                    {
                        if (bankName.Equals(array[num2]))
                        {
                            break;
                        }
                        num2++;
                        continue;
                    }
                    array[bankCount] = bankName;
                    int num3 = bankCount + 1;
                    bankCount = num3;
                    break;
                }
            }
            if (bankCount == 0)
            {
                m_initializationState = InitializationState.Error;
                yield break;
            }
            AudioBankLoadRequest[] bankLoadRequests = new AudioBankLoadRequest[bankCount];
            for (int j = 0; j < bankCount; j++)
            {
                bankLoadRequests[j] = AudioManager.LoadBankAsync(array[j]);
            }
            m_bankLoadRequests    = bankLoadRequests;
            m_initializationState = InitializationState.Loading;
            yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution((IEnumerator[])bankLoadRequests));

            for (int k = 0; k < bankCount; k++)
            {
                if (AssetManagerError.op_Implicit(bankLoadRequests[k].error) == 0)
                {
                    m_initializationState = InitializationState.Loaded;
                    yield break;
                }
            }
            m_initializationState = InitializationState.Error;
        }
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             int           count = moves.Count;
             IEnumerator[] array = new IEnumerator[count];
             for (int i = 0; i < count; i++)
             {
                 SpellMovement spellMovement = moves[i];
                 if (spellMovement.From == Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Hand)
                 {
                     int spellInstanceId = spellMovement.Spell.SpellInstanceId;
                     array[i] = view.RemoveSpell(spellInstanceId, i);
                 }
                 else if (spellMovement.To == Ankama.Cube.Protocols.FightCommonProtocol.SpellMovementZone.Hand)
                 {
                     array[i] = view.AddSpell(spellMovement.Spell, i);
                 }
             }
             yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(array));
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 112, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\SpellsMovedEvent.cs");
     }
     FightLogicExecutor.FireUpdateView(fightStatus.fightId, EventCategory.SpellsMoved);
 }
        public static IEnumerator LoadTimelineResources(TimelineAsset timelineAsset)
        {
            if (!(null == timelineAsset))
            {
                int outputTrackCount = timelineAsset.get_outputTrackCount();
                if (outputTrackCount != 0)
                {
                    List <IEnumerator> loadRoutine = ListPool <IEnumerator> .Get(outputTrackCount);

                    foreach (TrackAsset outputTrack in timelineAsset.GetOutputTracks())
                    {
                        foreach (TimelineClip clip in outputTrack.GetClips())
                        {
                            ITimelineResourcesProvider timelineResourcesProvider = clip.get_asset() as ITimelineResourcesProvider;
                            if (timelineResourcesProvider != null)
                            {
                                loadRoutine.Add(timelineResourcesProvider.LoadResources());
                            }
                        }
                    }
                    yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(loadRoutine.ToArray()));

                    ListPool <IEnumerator> .Release(loadRoutine);
                }
            }
        }
        public static IEnumerator LoadAll <T>(ICollection <T> effects) where T : ScriptableEffect
        {
            int count = effects.Count;

            switch (count)
            {
            case 0:
                yield break;

            case 1:
                foreach (T effect in effects)
                {
                    yield return(effect.Load());
                }
                yield break;
            }
            IEnumerator[] array = new IEnumerator[count];
            int           num   = 0;

            foreach (T effect2 in effects)
            {
                array[num] = effect2.Load();
                num++;
            }
            yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(array));
        }
Exemple #6
0
        public IEnumerator LoadTimelineResources()
        {
            m_referenceCounter++;
            switch (m_timelineResourcesLoadState)
            {
            case TimelineResourceLoadingState.Loaded:
            case TimelineResourceLoadingState.Failed:
                break;

            case TimelineResourceLoadingState.Loading:
                while (m_timelineResourcesLoadState == TimelineResourceLoadingState.Loading)
                {
                    yield return(null);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();

            case TimelineResourceLoadingState.None:
            {
                m_timelineResourcesLoadState = TimelineResourceLoadingState.Loading;
                List <IEnumerator> loadRoutines = ListPool <IEnumerator> .Get(4);

                try
                {
                    m_timelineAssetDictionary.GatherLoadRoutines(loadRoutines);
                    if (null != m_spawnEffect)
                    {
                        loadRoutines.Add(m_spawnEffect.Load());
                    }
                    if (null != m_deathEffect)
                    {
                        loadRoutines.Add(m_deathEffect.Load());
                    }
                    GatherAdditionalResourcesLoadingRoutines(loadRoutines);
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                    m_timelineResourcesLoadState = TimelineResourceLoadingState.Failed;
                }
                yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(loadRoutines.ToArray()));

                ListPool <IEnumerator> .Release(loadRoutines);

                m_timelineResourcesLoadState = TimelineResourceLoadingState.Loaded;
                break;
            }
            }
        }
Exemple #7
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            int      positionCount = positions.Count;
            FightMap current       = FightMap.current;

            if (null != current)
            {
                IEnumerator[] array = new IEnumerator[positionCount];
                if (addWarning)
                {
                    for (int i = 0; i < positionCount; i++)
                    {
                        CellCoord cellCoord = positions[i];
                        Direction direction = (Direction)directions[i];
                        array[i] = current.AddMonsterSpawnCell(cellCoord.X, cellCoord.Y, direction);
                    }
                }
                else
                {
                    for (int j = 0; j < positionCount; j++)
                    {
                        CellCoord cellCoord2 = positions[j];
                        array[j] = current.RemoveMonsterSpawnCell(cellCoord2.X, cellCoord2.Y);
                    }
                }
                yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(array));
            }
            for (int k = 0; k < positionCount; k++)
            {
                Vector2Int       position = (Vector2Int)positions[k];
                ICharacterObject characterObject;
                if (fightStatus.TryGetEntityAt(position, out ICharacterEntity character) && (characterObject = (character.view as ICharacterObject)) != null)
                {
                    characterObject.CheckParentCellIndicator();
                }
            }
        }
Exemple #8
0
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out FloorMechanismStatus entityStatus))
     {
         if (fightStatus.TryGetEntity(activator, out IEntityWithTeam entityStatus2))
         {
             if (entityStatus2.teamId == entityStatus.teamId)
             {
                 IObjectWithActivation objectWithActivation;
                 if ((objectWithActivation = (entityStatus.view as IObjectWithActivation)) != null)
                 {
                     yield return(objectWithActivation.ActivatedByAlly());
                 }
                 else
                 {
                     Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithActivation>(entityStatus), 26, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloorMechanismActivationEvent.cs");
                 }
                 yield break;
             }
             IReadOnlyList <int> entitiesInAssemblage = this.entitiesInAssemblage;
             int count = entitiesInAssemblage.Count;
             if (count == 1)
             {
                 IObjectWithActivation objectWithActivation2;
                 if ((objectWithActivation2 = (entityStatus.view as IObjectWithActivation)) != null)
                 {
                     yield return(objectWithActivation2.ActivatedByOpponent());
                 }
                 else
                 {
                     Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithActivation>(entityStatus), 41, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloorMechanismActivationEvent.cs");
                 }
                 yield break;
             }
             IEnumerator[] array = new IEnumerator[count];
             for (int i = 0; i < count; i++)
             {
                 if (fightStatus.TryGetEntity(entitiesInAssemblage[i], out FloorMechanismStatus entityStatus3))
                 {
                     IObjectWithActivation objectWithActivation3;
                     if ((objectWithActivation3 = (entityStatus3.view as IObjectWithActivation)) != null)
                     {
                         array[i] = objectWithActivation3.ActivatedByOpponent();
                     }
                     else
                     {
                         Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithActivation>(entityStatus3), 57, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloorMechanismActivationEvent.cs");
                     }
                 }
                 else
                 {
                     Log.Error(FightEventErrors.EntityNotFound <FloorMechanismStatus>(entitiesInAssemblage[i]), 62, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloorMechanismActivationEvent.cs");
                 }
             }
             yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(array));
         }
         else
         {
             Log.Error(FightEventErrors.EntityNotFound <IEntityWithTeam>(activator), 72, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloorMechanismActivationEvent.cs");
         }
     }
     else
     {
         Log.Error($"Could not find entity with id {concernedEntity}.", 77, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloorMechanismActivationEvent.cs");
     }
 }
Exemple #9
0
        public IEnumerator LoadResources()
        {
            switch (m_resourceLoadingState)
            {
            case ResourceLoadingState.Loaded:
                break;

            case ResourceLoadingState.Loading:
                do
                {
                    yield return(null);
                }while (m_resourceLoadingState == ResourceLoadingState.Loading);
                break;

            default:
                throw new ArgumentOutOfRangeException();

            case ResourceLoadingState.None:
            {
                if (!FightSpellEffectFactory.isReady)
                {
                    break;
                }
                m_resourceLoadingState = ResourceLoadingState.Loading;
                int spellEffectReferenceCount = m_spellEffectData.Count;
                int count = ((Dictionary <SpellEffectKey, AssetReference>)m_spellEffectOverrideReferences).Count;
                int num   = spellEffectReferenceCount + count;
                AssetLoadRequest <SpellEffect>[] loadRequests = new AssetLoadRequest <SpellEffect> [num];
                IEnumerator[] spellEffectLoadRequests         = new IEnumerator[num];
                int           i;
                for (i = 0; i < spellEffectReferenceCount; i++)
                {
                    string spellEffect = m_spellEffectData[i].spellEffect;
                    if (spellEffect.Length > 0)
                    {
                        loadRequests[i] = AssetManager.LoadAssetAsync <SpellEffect>(spellEffect, "core/spells/effects");
                        continue;
                    }
                    Log.Warning($"Spell named '{this.get_displayName()}' has an unassigned spell effect at index {i}.", 118, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Data\\Spells\\SpellDefinition.cs");
                    loadRequests[i] = null;
                }
                foreach (AssetReference value in ((Dictionary <SpellEffectKey, AssetReference>)m_spellEffectOverrideReferences).Values)
                {
                    AssetReference current = value;
                    if (current.get_hasValue())
                    {
                        loadRequests[i] = current.LoadFromAssetBundleAsync <SpellEffect>("core/spells/effects");
                    }
                    else
                    {
                        loadRequests[i] = null;
                    }
                    i++;
                }
                yield return(EnumeratorUtility.ParallelRecursiveSafeExecution((IEnumerator[])loadRequests));

                SpellEffect[] spellEffects = new SpellEffect[spellEffectReferenceCount];
                for (i = 0; i < spellEffectReferenceCount; i++)
                {
                    AssetLoadRequest <SpellEffect> val = loadRequests[i];
                    if (val == null)
                    {
                        spellEffects[i] = null;
                        continue;
                    }
                    if (AssetManagerError.op_Implicit(val.get_error()) == 0)
                    {
                        spellEffectLoadRequests[i] = (spellEffects[i] = val.get_asset()).Load();
                        continue;
                    }
                    spellEffects[i] = null;
                    Log.Error($"Could not load spell effect for spell {this.get_name()}: {val.get_error()}", 159, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Data\\Spells\\SpellDefinition.cs");
                }
                Dictionary <SpellEffectKey, SpellEffect> spellEffectOverrides = new Dictionary <SpellEffectKey, SpellEffect>(((Dictionary <SpellEffectKey, AssetReference>)m_spellEffectOverrideReferences).Count, SpellEffectKeyComparer.instance);
                foreach (SpellEffectKey key in ((Dictionary <SpellEffectKey, AssetReference>)m_spellEffectOverrideReferences).Keys)
                {
                    AssetLoadRequest <SpellEffect> val2 = loadRequests[i];
                    if (val2 == null)
                    {
                        spellEffectOverrides.Add(key, null);
                    }
                    else if (AssetManagerError.op_Implicit(val2.get_error()) == 0)
                    {
                        SpellEffect asset = val2.get_asset();
                        spellEffectOverrides.Add(key, asset);
                        spellEffectLoadRequests[i] = asset.Load();
                    }
                    else
                    {
                        spellEffectOverrides.Add(key, null);
                        Log.Error($"Could not load spell effect override for key {key} for spell {this.get_name()}: {val2.get_error()}", 183, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Data\\Spells\\SpellDefinition.cs");
                    }
                    i++;
                }
                yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(spellEffectLoadRequests));

                m_spellEffects         = spellEffects;
                m_spellEffectOverrides = spellEffectOverrides;
                m_resourceLoadingState = ResourceLoadingState.Loaded;
                FightSpellEffectFactory.NotifySpellDefinitionLoaded(this);
                break;
            }
            }
        }
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus playerStatus))
            {
                if (playerStatus.TryGetSpell(spellInstanceId, out SpellStatus spellStatus))
                {
                    SpellDefinition definition = spellStatus.definition;
                    if (!(null != definition))
                    {
                        yield break;
                    }
                    yield return(definition.LoadResources());

                    ICastTargetDefinition castTarget        = definition.castTarget;
                    CastTargetContext     castTargetContext = castTarget.CreateCastTargetContext(fightStatus, concernedEntity, DynamicValueHolderType.Spell, spellDefId, spellLevel, 0);
                    int count = targets.Count;
                    for (int j = 0; j < count; j++)
                    {
                        castTargetContext.SelectTarget(targets[j].ToTarget(fightStatus));
                    }
                    if (count > 0 && !playerStatus.isLocalPlayer)
                    {
                        CellObject targetedCell = GetTargetedCell(fightStatus, targets[0]);
                        yield return(FightUIRework.ShowPlayingSpell(spellStatus, targetedCell));
                    }
                    List <SpellEffectInstantiationData> spellEffectData = (List <SpellEffectInstantiationData>)definition.spellEffectData;
                    int spellEffectCount = spellEffectData.Count;
                    if (spellEffectCount > 0)
                    {
                        List <IEnumerator> routineList = ListPool <IEnumerator> .Get();

                        int num;
                        for (int i = 0; i < spellEffectCount; i = num)
                        {
                            SpellEffect spellEffect = definition.GetSpellEffect(i);
                            if (!(null == spellEffect))
                            {
                                SpellEffectInstantiationData spellEffectInstantiationData = spellEffectData[i];
                                spellEffectInstantiationData.PreComputeDelayOverDistance(castTargetContext);
                                foreach (Vector2Int item3 in spellEffectInstantiationData.EnumerateInstantiationPositions(castTargetContext))
                                {
                                    IEnumerator item = FightSpellEffectFactory.PlaySpellEffect(spellEffect, item3, spellEffectInstantiationData, castTargetContext);
                                    routineList.Add(item);
                                }
                                foreach (IsoObject item4 in spellEffectInstantiationData.EnumerateInstantiationObjectTargets(castTargetContext))
                                {
                                    IEnumerator item2 = FightSpellEffectFactory.PlaySpellEffect(spellEffect, item4, spellEffectInstantiationData, castTargetContext);
                                    routineList.Add(item2);
                                }
                                yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(routineList.ToArray()));

                                routineList.Clear();
                            }
                            num = i + 1;
                        }
                        ListPool <IEnumerator> .Release(routineList);
                    }
                    FightSpellEffectFactory.SetupSpellEffectOverrides(definition, fightStatus.fightId, eventId);
                }
                else
                {
                    Log.Error($"Could not find spell with instance id {spellInstanceId} for player with id {concernedEntity}.", 128, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 133, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
            }
        }