Esempio n. 1
0
 protected void OnQuery_CoopServerInvalidConfirm_YES()
 {
     GameSection.StayEvent();
     CoopApp.EnterQuestOffline(delegate(bool is_m, bool is_c, bool is_r, bool is_s)
     {
         GameSection.ResumeEvent(is_s, null);
     });
 }
    private IEnumerator DoInitialize()
    {
        yield return((object)null);

        if (MonoBehaviourSingleton <InputManager> .IsValid())
        {
            MonoBehaviourSingleton <InputManager> .I.SetDisable(INPUT_DISABLE_FACTOR.INGAME_GRAB, false);

            MonoBehaviourSingleton <InputManager> .I.SetDisable(INPUT_DISABLE_FACTOR.INGAME_COMMAND, false);
        }
        MonoBehaviourSingleton <InGameManager> .I.ResumeQuestTransferInfo();

        bool keep_record          = false;
        bool is_back_transition   = false;
        bool is_back_online_field = false;

        if (MonoBehaviourSingleton <InGameManager> .I.isTransitionQuestToField)
        {
            MonoBehaviourSingleton <InGameManager> .I.isTransitionQuestToField = false;
            if (MonoBehaviourSingleton <QuestManager> .IsValid())
            {
                MonoBehaviourSingleton <QuestManager> .I.ClearPlayData();
            }
            if (MonoBehaviourSingleton <InGameManager> .I.isQuestGate && MonoBehaviourSingleton <InGameRecorder> .I.isVictory)
            {
                MonoBehaviourSingleton <FieldManager> .I.SetCurrentFieldMapPortalID(MonoBehaviourSingleton <InGameManager> .I.beforePortalID);

                MonoBehaviourSingleton <InGameManager> .I.isGateQuestClear = true;
            }
            else if (MonoBehaviourSingleton <InGameManager> .I.backTransitionInfo != null)
            {
                FieldManager.FieldTransitionInfo trans_info = MonoBehaviourSingleton <InGameManager> .I.backTransitionInfo;
                MonoBehaviourSingleton <FieldManager> .I.SetCurrentFieldMapPortalID(trans_info.portalID, trans_info.mapX, trans_info.mapZ, trans_info.mapDir);

                is_back_transition = true;
                if (MonoBehaviourSingleton <InGameManager> .I.isQuestHappen)
                {
                    is_back_online_field = true;
                }
            }
            MonoBehaviourSingleton <InGameManager> .I.backTransitionInfo = null;
            MonoBehaviourSingleton <InGameManager> .I.isQuestHappen      = false;
            MonoBehaviourSingleton <InGameManager> .I.isQuestPortal      = false;
            MonoBehaviourSingleton <InGameManager> .I.isQuestGate        = false;
            MonoBehaviourSingleton <InGameManager> .I.isStoryPortal      = false;
        }
        bool          matching_flag       = false;
        Action <bool> matching_end_action = delegate(bool is_connect)
        {
            if (!is_connect)
            {
                ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_01ba: stateMachine*/)._003C_003Ef__this.coopServerInvalidFlag = true;
            }
            else
            {
                ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_01ba: stateMachine*/)._003Cmatching_flag_003E__4 = true;
            }
        };

        if (MonoBehaviourSingleton <InGameManager> .I.isTransitionFieldToQuest)
        {
            MonoBehaviourSingleton <InGameManager> .I.isTransitionFieldToQuest = false;
            if (MonoBehaviourSingleton <InGameManager> .I.isQuestGate)
            {
                if (MonoBehaviourSingleton <FieldManager> .IsValid())
                {
                    MonoBehaviourSingleton <FieldManager> .I.ClearCurrentFieldData();
                }
                if (MonoBehaviourSingleton <QuestManager> .IsValid() && MonoBehaviourSingleton <QuestManager> .I.GetVorgonQuestType() != 0)
                {
                    CoopApp.EnterQuestOffline(delegate(bool is_m, bool is_c, bool is_r, bool is_s)
                    {
                        ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_0221: stateMachine*/)._003Cmatching_end_action_003E__5(is_c);
                    });
                }
                else if (MonoBehaviourSingleton <QuestManager> .I.IsForceDefeatQuest())
                {
                    CoopApp.EnterQuest(delegate(bool is_m, bool is_c, bool is_r, bool is_s)
                    {
                        ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_0246: stateMachine*/)._003Cmatching_end_action_003E__5(is_c);
                    });
                }
                else
                {
                    CoopApp.EnterQuestRandomMatching(delegate(bool is_m, bool is_c, bool is_r, bool is_s)
                    {
                        ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_025c: stateMachine*/)._003Cmatching_end_action_003E__5(is_s);
                    });
                }
            }
            else if (MonoBehaviourSingleton <InGameManager> .I.isQuestHappen)
            {
                int now_stage_id4 = MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId;
                MonoBehaviourSingleton <CoopNetworkManager> .I.RoomStageChange((int)MonoBehaviourSingleton <QuestManager> .I.currentQuestID, 0);

                while (CoopWebSocketSingleton <KtbWebSocket> .IsValidConnected() && now_stage_id4 == MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId)
                {
                    yield return((object)null);
                }
                CoopApp.EnterQuestOnly(delegate
                {
                    ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_02e7: stateMachine*/)._003Cmatching_end_action_003E__5(CoopWebSocketSingleton <KtbWebSocket> .IsValidConnected());
                });
                if (MonoBehaviourSingleton <CoopManager> .IsValid())
                {
                    MonoBehaviourSingleton <CoopManager> .I.OnStageChangeInterval();
                }
            }
            else
            {
                if (MonoBehaviourSingleton <FieldManager> .IsValid())
                {
                    MonoBehaviourSingleton <FieldManager> .I.ClearCurrentFieldData();
                }
                CoopApp.EnterQuest(delegate(bool is_m, bool is_c, bool is_r, bool is_s)
                {
                    ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_0325: stateMachine*/)._003Cmatching_end_action_003E__5(is_c);
                });
            }
            if (MonoBehaviourSingleton <InGameManager> .I.isQuestGate)
            {
                isEncounterBoss = true;
            }
        }
        else if (MonoBehaviourSingleton <InGameManager> .I.isTransitionQuestToQuest)
        {
            MonoBehaviourSingleton <InGameManager> .I.isTransitionQuestToQuest = false;
            if (MonoBehaviourSingleton <FieldManager> .IsValid())
            {
                MonoBehaviourSingleton <FieldManager> .I.ClearCurrentFieldData();
            }
            CoopApp.EnterPartyQuest(delegate(bool is_m, bool is_c, bool is_r, bool is_s)
            {
                ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_0384: stateMachine*/)._003Cmatching_end_action_003E__5(is_c);
            });
        }
        else if (QuestManager.IsValidInGame())
        {
            if (MonoBehaviourSingleton <QuestManager> .I.IsExplore() || MonoBehaviourSingleton <InGameManager> .I.IsRush())
            {
                if (MonoBehaviourSingleton <QuestManager> .I.IsExplore())
                {
                    isTransitionFieldMap = true;
                }
                bool is_stage_change = true;
                if (MonoBehaviourSingleton <InGameManager> .I.isTransitionFieldReentry)
                {
                    MonoBehaviourSingleton <InGameManager> .I.isTransitionFieldReentry = false;
                    isTransitionFieldMap = false;
                    is_stage_change      = false;
                    bool  wait             = true;
                    uint  currentMapID     = MonoBehaviourSingleton <FieldManager> .I.currentMapID;
                    float currentStartMapX = MonoBehaviourSingleton <FieldManager> .I.currentStartMapX;
                    float currentStartMapZ = MonoBehaviourSingleton <FieldManager> .I.currentStartMapZ;
                    CoopApp.EnterPartyField(delegate(bool is_m, bool is_c, bool is_r)
                    {
                        ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_0448: stateMachine*/)._003Cwait_003E__8 = false;
                        if (is_r)
                        {
                            ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_0448: stateMachine*/)._003Cis_stage_change_003E__7 = true;
                        }
                        if (((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_0448: stateMachine*/)._003Cbefore_map_id_003E__9 != MonoBehaviourSingleton <FieldManager> .I.currentMapID)
                        {
                            MonoBehaviourSingleton <FieldManager> .I.SetCurrentFieldMapID(((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_0448: stateMachine*/)._003Cbefore_map_id_003E__9, ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_0448: stateMachine*/)._003Cbefore_map_x_003E__10, ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_0448: stateMachine*/)._003Cbefore_map_z_003E__11, 0f);
                        }
                    }, true);
                    while (wait)
                    {
                        yield return((object)null);
                    }
                }
                else
                {
                    MonoBehaviourSingleton <CoopManager> .I.coopRoom.SnedMoveField((int)MonoBehaviourSingleton <QuestManager> .I.GetLastPortalId());
                }
                int  mapIndex = 0;
                int  questId  = 0;
                uint dstMapId = MonoBehaviourSingleton <FieldManager> .I.currentMapID;
                if (MonoBehaviourSingleton <QuestManager> .I.IsExplore())
                {
                    questId  = (int)MonoBehaviourSingleton <QuestManager> .I.currentQuestID;
                    mapIndex = MonoBehaviourSingleton <QuestManager> .I.ExploreMapIdToIndex(dstMapId);
                }
                else if (MonoBehaviourSingleton <InGameManager> .I.IsRush())
                {
                    questId = (int)MonoBehaviourSingleton <PartyManager> .I.GetQuestId();

                    mapIndex = MonoBehaviourSingleton <InGameManager> .I.GetRushIndex();
                }
                if (is_stage_change && MonoBehaviourSingleton <CoopManager> .I.coopStage.stageIndex != mapIndex)
                {
                    int now_stage_id2 = MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId;
                    MonoBehaviourSingleton <CoopNetworkManager> .I.RoomStageChange(questId, mapIndex);

                    while (CoopWebSocketSingleton <KtbWebSocket> .IsValidConnected() && now_stage_id2 == MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId)
                    {
                        yield return((object)null);
                    }
                }
                matching_end_action(true);
                keep_record = true;
                if (MonoBehaviourSingleton <InGameManager> .I.IsRush())
                {
                    uint map_id = MonoBehaviourSingleton <QuestManager> .I.GetCurrentMapId();

                    if (MonoBehaviourSingleton <FieldManager> .I.currentMapID != map_id)
                    {
                        MonoBehaviourSingleton <FieldManager> .I.SetCurrentFieldMapID(map_id, 0f, 0f, 0f);
                    }
                }
                if (MonoBehaviourSingleton <CoopManager> .IsValid())
                {
                    MonoBehaviourSingleton <CoopManager> .I.OnStageChangeInterval();
                }
                if (dstMapId == MonoBehaviourSingleton <QuestManager> .I.GetExploreBossBatlleMapId() && isTransitionFieldMap)
                {
                    isEncounterBoss = true;
                }
                if (MonoBehaviourSingleton <InGameManager> .I.isTransitionQuestToFieldExplore)
                {
                    fromBossExplore = true;
                    MonoBehaviourSingleton <InGameManager> .I.isTransitionQuestToFieldExplore = false;
                }
            }
            else
            {
                int now_stage_id3 = MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId;
                MonoBehaviourSingleton <CoopNetworkManager> .I.RoomStageChange((int)MonoBehaviourSingleton <QuestManager> .I.currentQuestID, (int)MonoBehaviourSingleton <QuestManager> .I.currentQuestSeriesIndex);

                while (CoopWebSocketSingleton <KtbWebSocket> .IsValidConnected() && now_stage_id3 == MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId)
                {
                    yield return((object)null);
                }
                matching_end_action(true);
                uint map_id2 = MonoBehaviourSingleton <QuestManager> .I.GetCurrentMapId();

                if (MonoBehaviourSingleton <FieldManager> .I.currentMapID != map_id2)
                {
                    MonoBehaviourSingleton <FieldManager> .I.SetCurrentFieldMapID(map_id2, 0f, 0f, 0f);
                }
                keep_record = true;
                if (MonoBehaviourSingleton <CoopManager> .IsValid())
                {
                    MonoBehaviourSingleton <CoopManager> .I.OnQuestSeriesInterval();
                }
            }
        }
        else if (FieldManager.IsValidInGame())
        {
            isNewField = !MonoBehaviourSingleton <FieldManager> .I.CanJumpToMap(MonoBehaviourSingleton <FieldManager> .I.currentMapID);

            portalID = MonoBehaviourSingleton <FieldManager> .I.currentPortalID;
            if (!is_back_transition && !MonoBehaviourSingleton <InGameManager> .I.isTransitionFieldReentry)
            {
                isTransitionFieldMap = true;
            }
            MonoBehaviourSingleton <InGameManager> .I.isTransitionFieldReentry = false;
            if (is_back_online_field && CoopWebSocketSingleton <KtbWebSocket> .IsValidConnected())
            {
                int now_stage_id = MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId;
                MonoBehaviourSingleton <CoopNetworkManager> .I.RoomStageChange(0, 0);

                while (CoopWebSocketSingleton <KtbWebSocket> .IsValidConnected() && now_stage_id == MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId)
                {
                    yield return((object)null);
                }
                matching_end_action(CoopWebSocketSingleton <KtbWebSocket> .IsValidConnected());
                if (MonoBehaviourSingleton <CoopManager> .IsValid())
                {
                    MonoBehaviourSingleton <CoopManager> .I.OnStageChangeInterval();
                }
            }
            else
            {
                uint portal_id = MonoBehaviourSingleton <FieldManager> .I.currentPortalID;
                CoopApp.EnterField(portal_id, 0u, delegate(bool is_m, bool is_c, bool is_r)
                {
                    ((_003CDoInitialize_003Ec__IteratorAE) /*Error near IL_0889: stateMachine*/)._003Cmatching_end_action_003E__5(is_c);
                });
            }
        }
        while (!matching_flag && !coopServerInvalidFlag)
        {
            yield return((object)null);
        }
        if (coopServerInvalidFlag)
        {
            base.Initialize();
        }
        else
        {
            if (MonoBehaviourSingleton <UIManager> .IsValid() && MonoBehaviourSingleton <UIManager> .I.mainChat != null)
            {
                MonoBehaviourSingleton <UIManager> .I.mainChat.Open(UITransition.TYPE.OPEN);
            }
            if (!keep_record && MonoBehaviourSingleton <InGameRecorder> .IsValid())
            {
                Object.DestroyImmediate(MonoBehaviourSingleton <InGameRecorder> .I);
            }
            MonoBehaviourSingleton <StageManager> .I.UnloadStage();

            yield return((object)MonoBehaviourSingleton <AppMain> .I.UnloadUnusedAssets(true));

            if (MonoBehaviourSingleton <InGameManager> .IsValid())
            {
                MonoBehaviourSingleton <InGameManager> .I.ClearAllDrop();
            }
            MonoBehaviourSingleton <AppMain> .I.mainCamera.get_gameObject().SetActive(true);

            base.Initialize();
        }
    }