Esempio n. 1
0
    public override void OnClose()
    {
        if (null != this.m_EffectDirection)
        {
            UnityEngine.Object.Destroy(this.m_EffectDirection);
        }
        if (this.m_direction_type == DirectionDLG.eDIRECTIONTYPE.eDIRECTION_BABEL)
        {
            if (!NrTSingleton <FormsManager> .Instance.IsShow(G_ID.BABELTOWERMAIN_DLG))
            {
                BabelTowerMainDlg babelTowerMainDlg = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.BABELTOWERMAIN_DLG) as BabelTowerMainDlg;

                if (babelTowerMainDlg != null)
                {
                    babelTowerMainDlg.FloorType = this.m_nBabel_FloorType;
                    babelTowerMainDlg.ShowList();
                }
            }
        }
        else if (this.m_direction_type == DirectionDLG.eDIRECTIONTYPE.eDIRECTION_MINETUTORIAL)
        {
            MineTutorialStepDlg mineTutorialStepDlg = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.MINE_TUTORIAL_STEP_DLG) as MineTutorialStepDlg;

            if (mineTutorialStepDlg != null)
            {
                mineTutorialStepDlg.SetStep(1L);
            }
            UIDataManager.MuteSound(false);
        }
        else if (this.m_direction_type == DirectionDLG.eDIRECTIONTYPE.eDIRECTION_EXPLORATION)
        {
            NrTSingleton <FormsManager> .Instance.ShowForm(G_ID.EXPLORATION_DLG);
        }
        else if (this.m_direction_type == DirectionDLG.eDIRECTIONTYPE.eDIRECTION_MYTHRAID)
        {
            NrTSingleton <FormsManager> .Instance.ShowForm(G_ID.MYTHRAID_MODESELECT_DLG);
        }
        else
        {
            UIDataManager.MuteSound(false);
        }
        NrTSingleton <FormsManager> .Instance.CloseForm(G_ID.CHALLENGE_DLG);
    }
    public void Update()
    {
        if (this.m_bStop)
        {
            return;
        }
        if (Time.realtimeSinceStartup - this.m_fUpdateTime < 0.4f)
        {
            return;
        }
        this.m_fUpdateTime = Time.realtimeSinceStartup;
        switch (this.m_eStatus)
        {
        case eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_INIT:
            this.Init();
            this.m_eStatus = eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_CHECK_BATTLEPOS;
            break;

        case eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_CHECK_BATTLEPOS:
            if (!this.CheckBattlePos())
            {
                this.SetStatus(eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_NONE, 0f);
                return;
            }
            this.m_eStatus = eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_CHECK_INJURY;
            break;

        case eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_CHECK_INJURY:
            if (!this.InjuryCureComplete())
            {
                this.SetStatus(eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_NONE, 0f);
                return;
            }
            this.m_eStatus = eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_WAIT_CURE;
            break;

        case eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_WAIT_CURE:
            if (!this.WaitCure())
            {
                return;
            }
            this.m_eStatus = eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_BATTLE_START;
            break;

        case eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_BATTLE_START:
            if (!this.StartBabelMacroBattle())
            {
                this.SetStatus(eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_NONE, 0f);
                return;
            }
            this.m_eStatus = eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_BATTLE_ING;
            break;

        case eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_BATTLE_SELECT_SPECIAL_RESULT:
            if (Time.realtimeSinceStartup - this.m_fSelectTime > 0.3f && this.m_fSelectTime != 0f)
            {
                Battle_ResultDlg_Content battle_ResultDlg_Content = (Battle_ResultDlg_Content)NrTSingleton <FormsManager> .Instance.GetForm(G_ID.BATTLE_RESULT_CONTENT_DLG);

                if (battle_ResultDlg_Content != null)
                {
                    int iSelectIndex = UnityEngine.Random.Range(0, 4);
                    battle_ResultDlg_Content.ClickRewardCardButton(iSelectIndex);
                    this.m_fSelectTime = 0f;
                }
            }
            break;

        case eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_BATTLE_SELECT_SPECIAL_COMPLETE:
            if (Time.realtimeSinceStartup - this.m_fSelectTime > 1f && this.m_fSelectTime != 0f)
            {
                Battle_ResultDlg_Content battle_ResultDlg_Content2 = (Battle_ResultDlg_Content)NrTSingleton <FormsManager> .Instance.GetForm(G_ID.BATTLE_RESULT_CONTENT_DLG);

                if (battle_ResultDlg_Content2 != null)
                {
                    battle_ResultDlg_Content2.ClickRewardOKButton(null);
                    this.m_fSelectTime = 0f;
                }
            }
            break;

        case eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_BATTLE_END:
        {
            COMMON_CONSTANT_Manager instance = COMMON_CONSTANT_Manager.GetInstance();
            int num = 0;
            if (instance != null)
            {
                if (NrTSingleton <ContentsLimitManager> .Instance.IsVipExp())
                {
                    num = instance.GetValue(eCOMMON_CONSTANT.eCOMMON_CONSTANT_BATTLE_REPEAT);
                }
                else
                {
                    int vipLevelAddBattleRepeat = (int)NrTSingleton <NrTableVipManager> .Instance.GetVipLevelAddBattleRepeat();

                    num = instance.GetValue(eCOMMON_CONSTANT.eCOMMON_CONSTANT_BATTLE_REPEAT) + vipLevelAddBattleRepeat;
                }
            }
            if (this.m_bAutoBattle)
            {
                this.m_bAutoBattle = false;
            }
            else
            {
                this.m_nMacroCount++;
            }
            if (this.m_bBattleSpeedCheck)
            {
                NrMyCharInfo kMyCharInfo = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo;
                if (kMyCharInfo != null)
                {
                    long charSubData = kMyCharInfo.GetCharSubData(eCHAR_SUBDATA.CHAR_SUBDATA_BATTLESPEED_COUNT);
                    if (charSubData > 0L)
                    {
                        int @int = PlayerPrefs.GetInt(NrPrefsKey.AUTOSELLGRADE, 0);
                        int int2 = PlayerPrefs.GetInt(NrPrefsKey.AUTOSELLRANK, 0);
                        TsLog.LogWarning("!!!!!!!!!!!!!!!!!! Macro Grade : {0}", new object[]
                            {
                                @int
                            });
                        TsLog.LogWarning("!!!!!!!!!!!!!!!!!! Macro Rank : {0}", new object[]
                            {
                                int2
                            });
                        if (@int > 0 || int2 > 0)
                        {
                            GS_ITEM_SELL_AUTO_BABEL_REQ gS_ITEM_SELL_AUTO_BABEL_REQ = new GS_ITEM_SELL_AUTO_BABEL_REQ();
                            gS_ITEM_SELL_AUTO_BABEL_REQ.i16BabelAutoSellGrade = (short)@int;
                            gS_ITEM_SELL_AUTO_BABEL_REQ.i16BabelAutoSellRank  = (short)int2;
                            SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_ITEM_SELL_AUTO_BABEL_REQ, gS_ITEM_SELL_AUTO_BABEL_REQ);
                        }
                    }
                }
            }
            if (this.m_nMacroCount < num)
            {
                this.m_eStatus = eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_CHECK_BATTLEPOS;
            }
            else
            {
                this.SetStatus(eBABEL_MACRO_STATUS.eBABEL_MACRO_STATUS_NONE, 0f);
                BabelTowerMainDlg babelTowerMainDlg = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.BABELTOWERMAIN_DLG) as BabelTowerMainDlg;

                if (babelTowerMainDlg != null)
                {
                    babelTowerMainDlg.FloorType = this.m_nFloorType;
                    babelTowerMainDlg.ShowList();
                }
                if (PlayerPrefs.GetInt(NrPrefsKey.OPTION_VIBE_ON_OFF) == 1)
                {
                    Handheld.Vibrate();
                }
                this.ShowMacroResult();
            }
            break;
        }
        }
    }