Beispiel #1
0
        protected override IEnumerator Unload()
        {
            while (FightLogicExecutor.isValid)
            {
                yield return(null);
            }
            FightMap current = FightMap.current;

            if (null != current)
            {
                current.Release();
                FightMap.current = null;
            }
            if (FightSpellEffectFactory.isReady)
            {
                yield return(FightSpellEffectFactory.Unload());
            }
            if (FightObjectFactory.isReady)
            {
                yield return(FightObjectFactory.Unload());
            }
            if (FightUIFactory.isReady)
            {
                yield return(FightUIFactory.Unload());
            }
            VisualEffectFactory.Dispose();
            yield return(RuntimeData.UnloadTextCollectionAsync("Fight"));

            yield return(_003C_003En__0());

            DragNDropListener.instance.CancelSnapDrag();
            instance = null;
        }
Beispiel #2
0
        protected override IEnumerator Load()
        {
            if (m_concurrentFightsCount == 1)
            {
                RuntimeData.currentKeywordContext = KeywordContext.FightSolo;
            }
            else
            {
                RuntimeData.currentKeywordContext = KeywordContext.FightMulti;
            }
            instance = this;
            int fightCount = m_concurrentFightsCount;

            if (!RuntimeData.fightDefinitions.TryGetValue(m_fightDefId, out m_fightDefinition))
            {
                Log.Error(string.Format("Could not find {0} with id {1}.", "FightDefinition", m_fightDefId), 78, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\States\\FightState.cs");
                yield break;
            }
            yield return(RuntimeData.LoadTextCollectionAsync("Fight"));

            yield return(LoadSceneAndBundleRequest("FightMapWrapper", "core/scenes/maps/fight_maps"));

            Scene sceneByName = SceneManager.GetSceneByName("FightMapWrapper");

            if (!sceneByName.get_isLoaded())
            {
                Log.Error("Could not load scene named 'FightMapWrapper' from bundle 'core/scenes/maps/fight_maps'.", 93, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\States\\FightState.cs");
                yield break;
            }
            yield return(LoadFightMap());

            FightMap current = FightMap.current;

            if (null == current)
            {
                Log.Error("Failed to load fight map.", 104, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\States\\FightState.cs");
                yield break;
            }
            FightLogicExecutor.Initialize(fightCount);
            FightMapDefinition definition = current.definition;

            FightStatus[] array = new FightStatus[fightCount];
            for (int i = 0; i < fightCount; i++)
            {
                FightMapStatus mapStatus   = definition.CreateFightMapStatus(i);
                FightStatus    fightStatus = new FightStatus(i, mapStatus);
                if (fightStatus.fightId == m_ownFightId)
                {
                    FightStatus.local = fightStatus;
                }
                FightLogicExecutor.AddFightStatus(fightStatus);
                array[i] = fightStatus;
            }
            GameStatus.Initialize((FightType)m_fightInfo.FightType, m_fightDefinition, array);
            yield return(current.Initialize());

            VisualEffectFactory.Initialize();
            yield return(FightObjectFactory.Load());

            if (!FightObjectFactory.isReady)
            {
                yield break;
            }
            yield return(FightSpellEffectFactory.Load(fightCount));

            if (!FightSpellEffectFactory.isReady)
            {
                yield break;
            }
            yield return(FightUIFactory.Load());

            if (!FightUIFactory.isReady)
            {
                yield break;
            }
            UILoader <FightUIRework> loaderRework = new UILoader <FightUIRework>(this, "FightUIRework", "core/scenes/ui/fight");

            yield return(loaderRework.Load());

            m_uiRework = loaderRework.ui;
            m_uiRework.Init(GameStatus.fightType, m_fightDefinition);
            frame = new FightFrame
            {
                onOtherPlayerLeftFight = OnOtherPlayerLeftFight
            };
            if (m_hardResumed)
            {
                FightSnapshot snapshot = null;
                frame.onFightSnapshot = delegate(FightSnapshot fightSnapshot)
                {
                    snapshot = fightSnapshot;
                };
                frame.SendFightSnapshotRequest();
                while (snapshot == null)
                {
                    yield return(null);
                }
                frame.onFightSnapshot = null;
                yield return(ApplyFightSnapshot(snapshot));
            }
            frame.SendPlayerReady();
            while (!FightLogicExecutor.fightInitialized)
            {
                yield return(null);
            }
            yield return(uiRework.Load());
        }