Exemplo n.º 1
0
            private void SendFightEventGroupToExecution(FightStatus activeFightStatus)
            {
                int count = s_eventGroupBuffer.Count;

                if (count == 1)
                {
                    FightEvent fightEvent = s_eventGroupBuffer[0];
                    try
                    {
                        if (fightEvent.SynchronizeExecution())
                        {
                            Execute(SetupSynchronizationBarrier());
                            IEnumerator enumerator = fightEvent.UpdateView(activeFightStatus);
                            if (enumerator != null)
                            {
                                Execute(enumerator);
                            }
                            Execute(ReleaseSynchronizationBarrier());
                        }
                        else
                        {
                            IEnumerator enumerator2 = fightEvent.UpdateView(activeFightStatus);
                            if (enumerator2 != null)
                            {
                                Execute(enumerator2);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error($"Exception occured while event {fightEvent.eventType} #{fightEvent.eventId} updated fight view.", 255, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightLogicExecutor.Instance.cs");
                        Debug.LogException(ex);
                    }
                }
                else
                {
                    IEnumerator[] array = new IEnumerator[count];
                    for (int i = 0; i < count; i++)
                    {
                        FightEvent fightEvent2 = s_eventGroupBuffer[i];
                        try
                        {
                            array[i] = fightEvent2.UpdateView(activeFightStatus);
                        }
                        catch (Exception ex2)
                        {
                            Log.Error($"Exception occured while event {fightEvent2.eventType} #{fightEvent2.eventId} updated fight view.", 273, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightLogicExecutor.Instance.cs");
                            Debug.LogException(ex2);
                        }
                    }
                    IEnumerator action = EnumeratorUtility.ParallelRecursiveImmediateExecution(array);
                    Execute(action);
                }
                s_eventGroupBuffer.Clear();
            }
        private static IEnumerator PreloadEffectAssets <K, V>(SerializableDictionaryLogic <K, AssetReference> effects, Dictionary <K, V> effectCache, string bundleName) where V : ScriptableEffect
        {
            int count = ((Dictionary <K, AssetReference>)effects).Count;

            if (count != 0)
            {
                AssetLoadRequest <V>[] loadRequests = new AssetLoadRequest <V> [count];
                int num = 0;
                foreach (AssetReference value in ((Dictionary <K, AssetReference>)effects).Values)
                {
                    AssetReference current = value;
                    if (current.get_hasValue())
                    {
                        loadRequests[num] = current.LoadFromAssetBundleAsync <V>(bundleName);
                    }
                    num++;
                }
                yield return(EnumeratorUtility.ParallelRecursiveImmediateExecution((IEnumerator[])loadRequests));

                num = 0;
                foreach (K key in ((Dictionary <K, AssetReference>)effects).Keys)
                {
                    AssetLoadRequest <V> val = loadRequests[num];
                    num++;
                    if (val != null)
                    {
                        if (AssetManagerError.op_Implicit(val.get_error()) != 0)
                        {
                            Log.Error($"Failed to load effect for '{key}': {val.get_error()}", 608, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\FightSpellEffectFactory.cs");
                        }
                        else
                        {
                            effectCache.Add(key, val.get_asset());
                        }
                    }
                }
            }
        }