Exemple #1
0
        public void OnClickNextButton()
        {
            if (this.mUpdateAnim)
            {
                return;
            }
            VsTowerMatchEndParam towerMatchEndParam = MonoSingleton <GameManager> .Instance.GetVsTowerMatchEndParam();

            bool bNext = towerMatchEndParam != null && towerMatchEndParam.arravied == 1;

            switch (this.mState)
            {
            case VersusTowerKey.KEY_RESULT_STATE.GET_KEY:
                MonoSingleton <MySound> .Instance.PlaySEOneShot(SoundSettings.Current.Tap, 0.0f);

                if (this.mUpdateFloor)
                {
                    this.SetButtonText(bNext);
                    FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "UPDATE_FLOOR");
                    break;
                }
                FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "FINISH_KEY_RESULT");
                break;

            case VersusTowerKey.KEY_RESULT_STATE.UPDATE_FLOOR:
                MonoSingleton <MySound> .Instance.PlaySEOneShot(SoundSettings.Current.Tap, 0.0f);

                if (this.mBattleRes == VersusTowerKey.RESULT.WIN && bNext)
                {
                    FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "GET_REWARD");
                    break;
                }
                this.SetButtonText(false);
                FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "FINISH_KEY_RESULT");
                break;

            case VersusTowerKey.KEY_RESULT_STATE.GET_REWARD:
                MonoSingleton <MySound> .Instance.PlaySEOneShot(SoundSettings.Current.Tap, 0.0f);

                FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "FINISH_KEY_RESULT");
                break;
            }
        }
Exemple #2
0
        private void SetupRewardItem()
        {
            GameManager          instance           = MonoSingleton <GameManager> .Instance;
            VsTowerMatchEndParam towerMatchEndParam = instance.GetVsTowerMatchEndParam();
            VersusTowerParam     versusTowerParam   = instance.GetCurrentVersusTowerParam(towerMatchEndParam.floor);

            if (versusTowerParam == null || string.IsNullOrEmpty((string)versusTowerParam.ArrivalIteminame) || UnityEngine.Object.op_Equality((UnityEngine.Object) this.rewardObj, (UnityEngine.Object)null))
            {
                return;
            }
            DataSource.Bind <VersusTowerParam>(this.rewardObj, versusTowerParam);
            VersusTowerRewardItem component = (VersusTowerRewardItem)this.rewardObj.GetComponent <VersusTowerRewardItem>();

            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
            {
                return;
            }
            component.Refresh(VersusTowerRewardItem.REWARD_TYPE.Arrival, 0);
        }
Exemple #3
0
        private void RefreshData()
        {
            GameManager          instance1          = MonoSingleton <GameManager> .Instance;
            PlayerData           player             = instance1.Player;
            PartyData            partyOfType        = player.FindPartyOfType(PlayerPartyTypes.Versus);
            VsTowerMatchEndParam towerMatchEndParam = instance1.GetVsTowerMatchEndParam();

            if (towerMatchEndParam == null)
            {
                return;
            }
            if (partyOfType != null)
            {
                UnitData unitDataByUniqueId = player.FindUnitDataByUniqueID(partyOfType.GetUnitUniqueID(partyOfType.LeaderIndex));
                if (unitDataByUniqueId != null)
                {
                    DataSource.Bind <UnitData>(((Component)this).get_gameObject(), unitDataByUniqueId);
                }
            }
            int versusTowerFloor = player.VersusTowerFloor;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.floortxt, (UnityEngine.Object)null))
            {
                this.floortxt.set_text(versusTowerFloor.ToString());
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.floorEfftxt, (UnityEngine.Object)null))
            {
                this.floorEfftxt.set_text(versusTowerFloor.ToString());
            }
            int versusTowerKey = player.VersusTowerKey;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.key, (UnityEngine.Object)null))
            {
                VersusTowerParam versusTowerParam = instance1.GetCurrentVersusTowerParam(-1);
                if (versusTowerParam != null)
                {
                    int num1 = 0;
                    while (num1 < (int)versusTowerParam.RankupNum)
                    {
                        GameObject go = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.key);
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)go, (UnityEngine.Object)null))
                        {
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.parent, (UnityEngine.Object)null))
                            {
                                go.get_transform().SetParent(this.parent.get_transform(), false);
                            }
                            if (versusTowerKey > 0)
                            {
                                GameUtility.SetAnimatorTrigger(go, this.keyDefAnim);
                            }
                            this.mCreateKey.Add(go);
                        }
                        ++num1;
                        --versusTowerKey;
                    }
                    this.key.SetActive(false);
                    SceneBattle instance2 = SceneBattle.Instance;
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)instance2, (UnityEngine.Object)null))
                    {
                        BattleCore battle = instance2.Battle;
                        if (battle != null)
                        {
                            BattleCore.Record questRecord = battle.GetQuestRecord();
                            if (questRecord.result == BattleCore.QuestResult.Win)
                            {
                                int num2 = !towerMatchEndParam.rankup ? towerMatchEndParam.key : (int)versusTowerParam.RankupNum;
                                this.mAnimKeyIndex = player.VersusTowerKey;
                                this.mMaxKeyCount  = Mathf.Min(num2, (int)versusTowerParam.RankupNum);
                                this.mUpdateFloor  = towerMatchEndParam.rankup;
                                this.mBattleRes    = VersusTowerKey.RESULT.WIN;
                                if (this.mUpdateFloor)
                                {
                                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.arrivalNumText, (UnityEngine.Object)null))
                                    {
                                        this.arrivalNumText.set_text(towerMatchEndParam.floor.ToString() + LocalizedText.Get("sys.MULTI_VERSUS_FLOOR"));
                                    }
                                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.arrivalEffNumText, (UnityEngine.Object)null))
                                    {
                                        this.arrivalEffNumText.set_text(towerMatchEndParam.floor.ToString() + LocalizedText.Get("sys.MULTI_VERSUS_FLOOR"));
                                    }
                                }
                            }
                            else if (questRecord.result == BattleCore.QuestResult.Lose && (int)versusTowerParam.LoseNum > 0)
                            {
                                this.mAnimKeyIndex = player.VersusTowerKey - 1;
                                this.mMaxKeyCount  = Math.Max(towerMatchEndParam.key, 0);
                                this.mUpdateFloor  = this.mAnimKeyIndex < 0 && (int)versusTowerParam.DownFloor > 0;
                                this.mBattleRes    = VersusTowerKey.RESULT.LOSE;
                                if (this.mUpdateFloor && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.arrivalNumText, (UnityEngine.Object)null))
                                {
                                    this.arrivalNumText.set_text(Math.Max(towerMatchEndParam.floor, 1).ToString());
                                }
                            }
                            else
                            {
                                this.mBattleRes = VersusTowerKey.RESULT.DRAW;
                            }
                        }
                    }
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.infoText, (UnityEngine.Object)null))
                    {
                        this.infoText.SetActive(this.mBattleRes == VersusTowerKey.RESULT.WIN && (int)versusTowerParam.RankupNum > 0);
                    }
                }
            }
            if (!this.mUpdateFloor)
            {
                return;
            }
            this.SetButtonText(true);
        }
Exemple #4
0
        public override void OnActivate(int pinID)
        {
            GameManager instance = MonoSingleton <GameManager> .Instance;

            switch (pinID)
            {
            case 100:
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Free;
                break;

            case 101:
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Tower;
                break;

            case 102:
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Friend;
                break;

            case 103:
                if (GlobalVars.SelectedMultiPlayVersusType == this.type)
                {
                    if (this.type == VERSUS_TYPE.Tower)
                    {
                        if (instance.VersusTowerMatchBegin)
                        {
                            this.ActivateOutputLinks(201);
                            return;
                        }
                    }
                    else
                    {
                        this.ActivateOutputLinks(201);
                        return;
                    }
                }
                this.ActivateOutputLinks(202);
                return;

            case 104:
                if (instance.VersusTowerMatchBegin)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 105:
                if (instance.VersusTowerMatchReceipt)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 106:
                if (instance.Player.VersusSeazonGiftReceipt)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 107:
                VsTowerMatchEndParam towerMatchEndParam = instance.GetVsTowerMatchEndParam();
                if (towerMatchEndParam != null)
                {
                    VersusTowerParam versusTowerParam = instance.GetCurrentVersusTowerParam(towerMatchEndParam.floor);
                    if (versusTowerParam != null && (int)versusTowerParam.RankupNum == 0 && !towerMatchEndParam.rankup)
                    {
                        this.ActivateOutputLinks(201);
                        return;
                    }
                }
                this.ActivateOutputLinks(202);
                return;

            case 108:
                if (instance.AudienceMode)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 109:
                if (instance.IsVSCpuBattle)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 110:
                instance.IsVSCpuBattle = true;
                break;

            case 111:
                long matchExpiredTime = instance.RankMatchExpiredTime;
                long num = TimeManager.FromDateTime(TimeManager.ServerTime);
                instance.RankMatchBegin = num < matchExpiredTime;
                if (instance.RankMatchBegin)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 112:
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.RankMatch;
                break;

            case 113:
                if (instance.VSDraftType == VersusDraftType.Draft)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;

            case 114:
                if (instance.VSDraftType == VersusDraftType.Draft || instance.VSDraftType == VersusDraftType.DraftFriend)
                {
                    this.ActivateOutputLinks(201);
                    return;
                }
                this.ActivateOutputLinks(202);
                return;
            }
            this.ActivateOutputLinks(200);
        }
        public override void OnActivate(int pinID)
        {
            GameManager instance = MonoSingleton <GameManager> .Instance;

            if (pinID == this.FREE)
            {
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Free;
            }
            else if (pinID == this.TOWER)
            {
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Tower;
            }
            else if (pinID == this.FRIEND)
            {
                GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Friend;
            }
            else
            {
                if (pinID == this.CHECK)
                {
                    if (GlobalVars.SelectedMultiPlayVersusType == this.type)
                    {
                        if (this.type == VERSUS_TYPE.Tower)
                        {
                            if (instance.VersusTowerMatchBegin)
                            {
                                this.ActivateOutputLinks(201);
                                return;
                            }
                        }
                        else
                        {
                            this.ActivateOutputLinks(201);
                            return;
                        }
                    }
                    this.ActivateOutputLinks(202);
                    return;
                }
                if (pinID == this.CHECK_TOWER)
                {
                    if (instance.VersusTowerMatchBegin)
                    {
                        this.ActivateOutputLinks(201);
                        return;
                    }
                    this.ActivateOutputLinks(202);
                    return;
                }
                if (pinID == this.CHECK_RECEIPT)
                {
                    if (instance.VersusTowerMatchReceipt)
                    {
                        this.ActivateOutputLinks(201);
                        return;
                    }
                    this.ActivateOutputLinks(202);
                    return;
                }
                if (pinID == this.CHECK_SEASONGIFT)
                {
                    if (instance.Player.VersusSeazonGiftReceipt)
                    {
                        this.ActivateOutputLinks(201);
                        return;
                    }
                    this.ActivateOutputLinks(202);
                    return;
                }
                if (pinID == this.CHECK_TOPFLOOR)
                {
                    VsTowerMatchEndParam towerMatchEndParam = instance.GetVsTowerMatchEndParam();
                    if (towerMatchEndParam != null)
                    {
                        VersusTowerParam versusTowerParam = instance.GetCurrentVersusTowerParam(towerMatchEndParam.floor);
                        if (versusTowerParam != null && (int)versusTowerParam.RankupNum == 0 && !towerMatchEndParam.rankup)
                        {
                            this.ActivateOutputLinks(201);
                            return;
                        }
                    }
                    this.ActivateOutputLinks(202);
                    return;
                }
                if (pinID == this.CHECK_AUDIENCE)
                {
                    if (instance.AudienceMode)
                    {
                        this.ActivateOutputLinks(201);
                        return;
                    }
                    this.ActivateOutputLinks(202);
                    return;
                }
            }
            this.ActivateOutputLinks(200);
        }