private List <Unit> LoadVersusParty()
        {
            PlayerData  player   = MonoSingleton <GameManager> .Instance.Player;
            PartyData   party    = player.Partys[7];
            List <Unit> unitList = new List <Unit>();

            for (int index = 0; index < party.MAX_UNIT; ++index)
            {
                long unitUniqueId = party.GetUnitUniqueID(index);
                if (unitUniqueId != 0L)
                {
                    UnitData unitDataByUniqueId = player.FindUnitDataByUniqueID(unitUniqueId);
                    DownloadUtility.DownloadUnit(unitDataByUniqueId.UnitParam, (JobData[])null);
                    Unit unit            = new Unit();
                    int  versusPlacement = player.GetVersusPlacement(PlayerPrefsUtility.VERSUS_ID_KEY + (object)index);
                    unit.Setup(unitDataByUniqueId, this.CurrentMap.PartyUnitSettings[versusPlacement], (Unit.DropItem)null, (Unit.DropItem)null);
                    unitList.Add(unit);
                }
            }
            return(unitList);
        }
Beispiel #2
0
        private void RefreshAttackParty()
        {
            PlayerData player      = MonoSingleton <GameManager> .Instance.Player;
            PartyData  partyOfType = player.FindPartyOfType(PlayerPartyTypes.Arena);

            for (int index = 0; index < this.PartyUnitSlots.Length; ++index)
            {
                long     unitUniqueId = partyOfType.GetUnitUniqueID(index);
                UnitData unitData1    = player.FindUnitDataByUniqueID(unitUniqueId);
                if (unitData1 != null && unitData1.GetJobFor(PlayerPartyTypes.Arena) != unitData1.CurrentJob)
                {
                    UnitData unitData2 = new UnitData();
                    unitData2.TempFlags |= UnitData.TemporaryFlags.TemporaryUnitData;
                    unitData2.Setup(unitData1);
                    unitData2.SetJob(PlayerPartyTypes.Arena);
                    unitData1 = unitData2;
                }
                if (index == 0)
                {
                    DataSource.Bind <UnitData>(this.PartyUnitLeader, unitData1);
                    DataSource.Bind <UnitData>(this.PartyUnitLeaderVS, unitData1);
                    GameParameter.UpdateAll(this.PartyUnitLeader);
                    GameParameter.UpdateAll(this.PartyUnitLeaderVS);
                }
                DataSource.Bind <UnitData>(this.PartyUnitSlots[index], unitData1);
                GameParameter.UpdateAll(this.PartyUnitSlots[index]);
            }
            if (Object.op_Inequality((Object)this.PartyInfo, (Object)null))
            {
                DataSource.Bind <PartyData>(this.PartyInfo, partyOfType);
                GameParameter.UpdateAll(this.PartyInfo);
            }
            if (!Object.op_Inequality((Object)this.VsPartyInfo, (Object)null))
            {
                return;
            }
            DataSource.Bind <PartyData>(this.VsPartyInfo, partyOfType);
            GameParameter.UpdateAll(this.VsPartyInfo);
        }
Beispiel #3
0
        protected override void PostForwardPressed()
        {
            PlayerData player    = MonoSingleton <GameManager> .Instance.Player;
            PartyData  partyData = this.mCurrentParty.PartyData;
            List <int> intList   = new List <int>();

            for (int index = 0; index < partyData.MAX_UNIT; ++index)
            {
                if ((this.mCurrentParty.Units[index] == null ? 0L : this.mCurrentParty.Units[index].UniqueID) != 0L)
                {
                    string str = partyData.PartyType != PlayerPartyTypes.RankMatch ? PlayerPrefsUtility.VERSUS_ID_KEY : PlayerPrefsUtility.RANKMATCH_ID_KEY;
                    int    idx = player.GetVersusPlacement(str + (object)index);
                    if (intList.FindIndex((Predicate <int>)(d => d == idx)) != -1)
                    {
                        UIUtility.NegativeSystemMessage((string)null, LocalizedText.Get("sys.MULTI_VERSUS_SAME_POS"), (UIUtility.DialogResultEvent)(dialog => {}), (GameObject)null, false, -1);
                        return;
                    }
                    intList.Add(idx);
                }
            }
            base.PostForwardPressed();
        }
Beispiel #4
0
        private void ValidateTeam(QuestParam quest, List <PartyEditData> teams, int maxTeamCount)
        {
            bool flag = false;

            if (teams.Count > maxTeamCount)
            {
                teams = teams.Take <PartyEditData>(maxTeamCount).ToList <PartyEditData>();
                flag  = true;
            }
            else if (teams.Count < maxTeamCount)
            {
                for (int count = teams.Count; count < maxTeamCount; ++count)
                {
                    PartyData party = new PartyData(PlayerPartyTypes.Ordeal);
                    teams.Add(new PartyEditData(PartyUtility.CreateOrdealPartyNameFromIndex(count), party));
                }
                flag = true;
            }
            if (!(flag | !PartyUtility.ResetToDefaultTeamIfNeededForOrdealQuest(quest, teams)))
            {
                return;
            }
            PartyUtility.SaveTeamPresets(PartyWindow2.EditPartyTypes.Ordeal, 0, teams, false);
        }
Beispiel #5
0
 public override void OnActivate(int pinID)
 {
     if (pinID != 0 || ((Behaviour)this).get_enabled())
     {
         return;
     }
     if (Network.Mode == Network.EConnectMode.Offline)
     {
         this.Success();
     }
     else
     {
         GameManager      instance         = MonoSingleton <GameManager> .Instance;
         VersusStatusData versusStatusData = new VersusStatusData();
         int       num   = 0;
         PartyData party = instance.Player.Partys[7];
         if (party != null)
         {
             for (int index = 0; index < party.MAX_UNIT; ++index)
             {
                 long unitUniqueId = party.GetUnitUniqueID(index);
                 if (party.GetUnitUniqueID(index) != 0L)
                 {
                     UnitData unitDataByUniqueId = instance.Player.FindUnitDataByUniqueID(unitUniqueId);
                     if (unitDataByUniqueId != null)
                     {
                         versusStatusData.Add(unitDataByUniqueId.Status.param, unitDataByUniqueId.GetCombination());
                         ++num;
                     }
                 }
             }
         }
         this.ExecRequest((WebAPI) new ReqVersusCpuList(versusStatusData, num, GlobalVars.SelectedQuestID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
         ((Behaviour)this).set_enabled(true);
     }
 }
Beispiel #6
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);
        }
        public override void OnActivate(int pinID)
        {
            GameManager instance = MonoSingleton <GameManager> .Instance;

            instance.AudienceMode = false;
            this.mReqID           = pinID;
            if (pinID == 0 || pinID == 100 || (pinID == 200 || pinID == 500))
            {
                PunMonoSingleton <MyPhoton> .Instance.IsMultiPlay   = pinID == 100 || pinID == 200 || pinID == 500;
                PunMonoSingleton <MyPhoton> .Instance.IsMultiVersus = pinID == 200;
                pinID = 0;
            }
            if (pinID == 10)
            {
                this.mResume = true;
                pinID        = 0;
            }
            if (pinID == 0)
            {
                if (((Behaviour)this).get_enabled())
                {
                    return;
                }
                ((Behaviour)this).set_enabled(true);
                CriticalSection.Enter(CriticalSections.SceneChange);
                if (this.mResume)
                {
                    long btlId = (long)GlobalVars.BtlID;
                    GlobalVars.BtlID.Set(0L);
                    this.ExecRequest((WebAPI) new ReqBtlComResume(btlId, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                }
                else
                {
                    this.mStartingQuest = instance.FindQuest(GlobalVars.SelectedQuestID);
                    PlayerPartyTypes partyIndex1 = this.QuestToPartyIndex(this.mStartingQuest.type);
                    if (!string.IsNullOrEmpty(this.QuestID))
                    {
                        GlobalVars.SelectedQuestID  = this.QuestID;
                        GlobalVars.SelectedFriendID = string.Empty;
                    }
                    if (!this.PlayOffline && Network.Mode == Network.EConnectMode.Online)
                    {
                        PartyData partyOfType = instance.Player.FindPartyOfType(partyIndex1);
                        int       partyIndex2 = instance.Player.Partys.IndexOf(partyOfType);
                        if (this.mStartingQuest.type == QuestTypes.Arena)
                        {
                            this.ActivateOutputLinks(5);
                            this.StartCoroutine(this.StartScene((BattleCore.Json_Battle)null));
                        }
                        else
                        {
                            // ISSUE: object of a compiler-generated type is created
                            // ISSUE: variable of a compiler-generated type
                            FlowNode_StartQuest.\u003COnActivate\u003Ec__AnonStorey2CC activateCAnonStorey2Cc = new FlowNode_StartQuest.\u003COnActivate\u003Ec__AnonStorey2CC();
                            // ISSUE: reference to a compiler-generated field
                            activateCAnonStorey2Cc.pt = PunMonoSingleton <MyPhoton> .Instance;
                            bool          multi      = false;
                            bool          isHost     = false;
                            int           seat       = -1;
                            int           plid       = -1;
                            string        uid        = string.Empty;
                            List <string> stringList = new List <string>();
                            // ISSUE: reference to a compiler-generated field
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)activateCAnonStorey2Cc.pt, (UnityEngine.Object)null))
                            {
                                // ISSUE: reference to a compiler-generated field
                                multi = activateCAnonStorey2Cc.pt.IsMultiPlay;
                                // ISSUE: reference to a compiler-generated field
                                isHost = activateCAnonStorey2Cc.pt.IsOldestPlayer();
                                // ISSUE: reference to a compiler-generated field
                                seat = activateCAnonStorey2Cc.pt.MyPlayerIndex;
                                // ISSUE: reference to a compiler-generated field
                                MyPhoton.MyPlayer myPlayer = activateCAnonStorey2Cc.pt.GetMyPlayer();
                                if (myPlayer != null)
                                {
                                    plid = myPlayer.playerID;
                                }
                                // ISSUE: reference to a compiler-generated field
                                if (activateCAnonStorey2Cc.pt.IsMultiVersus)
                                {
                                    // ISSUE: reference to a compiler-generated field
                                    List <JSON_MyPhotonPlayerParam> myPlayersStarted = activateCAnonStorey2Cc.pt.GetMyPlayersStarted();
                                    // ISSUE: reference to a compiler-generated field
                                    MyPhoton.MyRoom currentRoom = activateCAnonStorey2Cc.pt.GetCurrentRoom();
                                    int             num         = currentRoom == null ? 1 : currentRoom.playerCount;
                                    // ISSUE: reference to a compiler-generated method
                                    JSON_MyPhotonPlayerParam photonPlayerParam = myPlayersStarted.Find(new Predicate <JSON_MyPhotonPlayerParam>(activateCAnonStorey2Cc.\u003C\u003Em__2AB));
                                    if (photonPlayerParam != null)
                                    {
                                        uid = photonPlayerParam.UID;
                                    }
                                    if (string.IsNullOrEmpty(uid) || num == 1)
                                    {
                                        this.OnVersusNoPlayer();
                                        return;
                                    }
                                }
                                else
                                {
                                    // ISSUE: reference to a compiler-generated field
                                    List <JSON_MyPhotonPlayerParam> myPlayersStarted = activateCAnonStorey2Cc.pt.GetMyPlayersStarted();
                                    for (int index = 0; index < myPlayersStarted.Count; ++index)
                                    {
                                        // ISSUE: reference to a compiler-generated field
                                        if (myPlayersStarted[index].playerIndex != activateCAnonStorey2Cc.pt.MyPlayerIndex)
                                        {
                                            stringList.Add(myPlayersStarted[index].UID);
                                        }
                                    }
                                }
                            }
                            if (this.mReqID == 200)
                            {
                                this.ExecRequest((WebAPI) new ReqVersus(this.mStartingQuest.iname, plid, seat, uid, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), GlobalVars.SelectedMultiPlayVersusType));
                            }
                            else if (this.mReqID == 500)
                            {
                                this.ExecRequest((WebAPI) new ReqBtlMultiTwReq(this.mStartingQuest.iname, partyIndex2, plid, seat, stringList.ToArray(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                            }
                            else
                            {
                                this.ExecRequest((WebAPI) new ReqBtlComReq(this.mStartingQuest.iname, GlobalVars.SelectedFriendID, GlobalVars.SelectedSupport.Get(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), multi, partyIndex2, isHost, plid, seat, GlobalVars.Location, GlobalVars.SelectedRankingQuestParam));
                            }
                        }
                    }
                    else
                    {
                        this.StartCoroutine(this.StartScene((BattleCore.Json_Battle)null));
                    }
                }
            }
            else if (pinID == 20)
            {
                if (instance.AudienceRoom == null)
                {
                    return;
                }
                this.StartCoroutine(this.StartAudience());
            }
            else
            {
                if (pinID != 30)
                {
                    return;
                }
                if (Network.IsError)
                {
                    this.ActivateOutputLinks(300);
                    Network.ResetError();
                }
                else if (!Network.IsStreamConnecting)
                {
                    Network.ResetError();
                    this.ActivateOutputLinks(300);
                }
                else
                {
                    VersusAudienceManager audienceManager = instance.AudienceManager;
                    audienceManager.AddStartQuest();
                    if (audienceManager.GetStartedParam() != null)
                    {
                        if (audienceManager.GetStartedParam().btlinfo != null)
                        {
                            BattleCore.Json_Battle json = new BattleCore.Json_Battle();
                            json.btlinfo = audienceManager.GetStartedParam().btlinfo;
                            CriticalSection.Enter(CriticalSections.SceneChange);
                            instance.AudienceMode = true;
                            this.StartCoroutine(this.StartScene(json));
                        }
                        else
                        {
                            DebugUtility.LogError("Not Exist btlInfo");
                            if (audienceManager.IsRetryError)
                            {
                                Network.Abort();
                                this.ActivateOutputLinks(300);
                            }
                            else
                            {
                                this.ActivateOutputLinks(9);
                            }
                        }
                    }
                    else
                    {
                        DebugUtility.LogError("Not Exist StartParam");
                        if (audienceManager.IsRetryError)
                        {
                            Network.Abort();
                            this.ActivateOutputLinks(300);
                        }
                        else
                        {
                            this.ActivateOutputLinks(9);
                        }
                    }
                }
            }
        }
        public override void OnActivate(int pinID)
        {
            int num1 = pinID;

            if (pinID == 0 || pinID == 100 || pinID == 200)
            {
                PunMonoSingleton <MyPhoton> .Instance.IsMultiPlay   = pinID == 100 || pinID == 200;
                PunMonoSingleton <MyPhoton> .Instance.IsMultiVersus = pinID == 200;
                pinID = 0;
            }
            if (pinID == 10)
            {
                this.mResume = true;
                pinID        = 0;
            }
            if (pinID != 0 || ((Behaviour)this).get_enabled())
            {
                return;
            }
            ((Behaviour)this).set_enabled(true);
            CriticalSection.Enter(CriticalSections.SceneChange);
            if (this.mResume)
            {
                long btlId = (long)GlobalVars.BtlID;
                GlobalVars.BtlID.Set(0L);
                this.ExecRequest((WebAPI) new ReqBtlComResume(btlId, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
            }
            else
            {
                GameManager instance = MonoSingleton <GameManager> .Instance;
                this.mStartingQuest = instance.FindQuest(GlobalVars.SelectedQuestID);
                PlayerPartyTypes partyIndex1 = this.QuestToPartyIndex(this.mStartingQuest.type);
                if (!string.IsNullOrEmpty(this.QuestID))
                {
                    GlobalVars.SelectedQuestID  = this.QuestID;
                    GlobalVars.SelectedFriendID = string.Empty;
                }
                if (!this.PlayOffline && Network.Mode == Network.EConnectMode.Online)
                {
                    PartyData partyOfType = instance.Player.FindPartyOfType(partyIndex1);
                    int       partyIndex2 = instance.Player.Partys.IndexOf(partyOfType);
                    if (this.mStartingQuest.type == QuestTypes.Arena)
                    {
                        ArenaPlayer selectedArenaPlayer = (ArenaPlayer)GlobalVars.SelectedArenaPlayer;
                        this.ExecRequest((WebAPI) new ReqBtlColoReq(this.mStartingQuest.iname, selectedArenaPlayer.FUID, selectedArenaPlayer, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), partyIndex2));
                    }
                    else
                    {
                        // ISSUE: object of a compiler-generated type is created
                        // ISSUE: variable of a compiler-generated type
                        FlowNode_StartQuest.\u003COnActivate\u003Ec__AnonStorey20E activateCAnonStorey20E = new FlowNode_StartQuest.\u003COnActivate\u003Ec__AnonStorey20E();
                        // ISSUE: reference to a compiler-generated field
                        activateCAnonStorey20E.pt = PunMonoSingleton <MyPhoton> .Instance;
                        bool   multi  = false;
                        bool   isHost = false;
                        int    seat   = -1;
                        int    plid   = -1;
                        string uid    = string.Empty;
                        // ISSUE: reference to a compiler-generated field
                        if (Object.op_Inequality((Object)activateCAnonStorey20E.pt, (Object)null))
                        {
                            // ISSUE: reference to a compiler-generated field
                            multi = activateCAnonStorey20E.pt.IsMultiPlay;
                            // ISSUE: reference to a compiler-generated field
                            isHost = activateCAnonStorey20E.pt.IsOldestPlayer();
                            // ISSUE: reference to a compiler-generated field
                            seat = activateCAnonStorey20E.pt.MyPlayerIndex;
                            // ISSUE: reference to a compiler-generated field
                            MyPhoton.MyPlayer myPlayer = activateCAnonStorey20E.pt.GetMyPlayer();
                            if (myPlayer != null)
                            {
                                plid = myPlayer.playerID;
                            }
                            // ISSUE: reference to a compiler-generated field
                            if (activateCAnonStorey20E.pt.IsMultiVersus)
                            {
                                // ISSUE: reference to a compiler-generated field
                                List <JSON_MyPhotonPlayerParam> myPlayersStarted = activateCAnonStorey20E.pt.GetMyPlayersStarted();
                                // ISSUE: reference to a compiler-generated field
                                MyPhoton.MyRoom currentRoom = activateCAnonStorey20E.pt.GetCurrentRoom();
                                int             num2        = currentRoom == null ? 1 : currentRoom.playerCount;
                                // ISSUE: reference to a compiler-generated method
                                JSON_MyPhotonPlayerParam photonPlayerParam = myPlayersStarted.Find(new Predicate <JSON_MyPhotonPlayerParam>(activateCAnonStorey20E.\u003C\u003Em__1F5));
                                if (photonPlayerParam != null)
                                {
                                    uid = photonPlayerParam.UID;
                                }
                                if (string.IsNullOrEmpty(uid) || num2 == 1)
                                {
                                    this.OnVersusNoPlayer();
                                    return;
                                }
                            }
                        }
                        if (num1 == 200)
                        {
                            this.ExecRequest((WebAPI) new ReqVersus(this.mStartingQuest.iname, plid, seat, uid, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), GlobalVars.SelectedMultiPlayVersusType));
                        }
                        else
                        {
                            this.ExecRequest((WebAPI) new ReqBtlComReq(this.mStartingQuest.iname, GlobalVars.SelectedFriendID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), multi, partyIndex2, isHost, plid, seat));
                        }
                    }
                }
                else
                {
                    this.StartCoroutine(this.StartScene((BattleCore.Json_Battle)null));
                }
            }
        }
Beispiel #9
0
        private void RequestJobChange(bool immediate)
        {
            if (this.mRequestSent)
            {
                return;
            }
            PlayerPartyTypes dataOfClass = DataSource.FindDataOfClass <PlayerPartyTypes>(((Component)this).get_gameObject(), PlayerPartyTypes.Max);

            this.mRequestSent = true;
            if ((this.mTargetUnit.TempFlags & UnitData.TemporaryFlags.TemporaryUnitData) != (UnitData.TemporaryFlags) 0)
            {
                MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID(this.mTargetUnit.UniqueID).SetJobFor(dataOfClass, this.mTargetUnit.CurrentJob);
            }
            UnitJobDropdown.OnJobChange(this.mTargetUnit.UniqueID);
            ReqUnitJob reqUnitJob = (this.mTargetUnit.TempFlags & UnitData.TemporaryFlags.TemporaryUnitData) != (UnitData.TemporaryFlags) 0 ? new ReqUnitJob(this.mTargetUnit.UniqueID, this.mTargetUnit.CurrentJob.UniqueID, PartyData.GetStringFromPartyType(dataOfClass), new Network.ResponseCallback(this.JobChangeResult)) : new ReqUnitJob(this.mTargetUnit.UniqueID, this.mTargetUnit.CurrentJob.UniqueID, new Network.ResponseCallback(this.JobChangeResult));

            if (immediate)
            {
                int num = (int)Network.RequestAPIImmediate((WebAPI)reqUnitJob, true);
            }
            else
            {
                Network.RequestAPI((WebAPI)reqUnitJob, false);
            }
        }
Beispiel #10
0
        public override void OnActivate(int pinID)
        {
            MonoSingleton <GameManager> .Instance.AudienceMode = false;
            GameManager instance1 = MonoSingleton <GameManager> .Instance;
            MyPhoton    instance2 = PunMonoSingleton <MyPhoton> .Instance;

            instance2.IsMultiPlay   = false;
            instance2.IsMultiVersus = false;
            instance1.IsVSCpuBattle = false;
            if (pinID == 0 || pinID == 100 || (pinID == 200 || pinID == 500) || (pinID == 700 || pinID == 1000))
            {
                instance2.IsMultiPlay   = pinID == 100 || pinID == 200 || pinID == 500;
                instance2.IsMultiVersus = pinID == 200;
                instance1.IsVSCpuBattle = pinID == 700;
            }
            if (pinID == 10)
            {
                this.mResume = true;
                pinID        = 0;
            }
            if (pinID != 0 || ((Behaviour)this).get_enabled())
            {
                return;
            }
            ((Behaviour)this).set_enabled(true);
            CriticalSection.Enter(CriticalSections.SceneChange);
            PlayerPartyTypes type = PlayerPartyTypes.Tower;

            GlobalVars.SelectedPartyIndex.Set((int)type);
            MonoSingleton <GameManager> .Instance.Player.SetPartyCurrentIndex((int)type);

            PunMonoSingleton <MyPhoton> .Instance.IsMultiPlay   = false;
            PunMonoSingleton <MyPhoton> .Instance.IsMultiVersus = false;
            PunMonoSingleton <MyPhoton> .Instance.IsRankMatch   = false;
            if (this.mResume)
            {
                this.btlID = (long)GlobalVars.BtlID;
                GlobalVars.BtlID.Set(0L);
                this.ExecRequest((WebAPI) new ReqTowerBtlComResume(this.btlID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
            }
            else
            {
                if (!string.IsNullOrEmpty(this.QuestID))
                {
                    GlobalVars.SelectedQuestID  = this.QuestID;
                    GlobalVars.SelectedFriendID = string.Empty;
                }
                this.mStartingQuest = instance1.FindQuest(GlobalVars.SelectedQuestID);
                if (this.PlayOffline || Network.Mode != Network.EConnectMode.Online)
                {
                    return;
                }
                PartyData partyOfType = instance1.Player.FindPartyOfType(type);
                if (this.mStartingQuest.type != QuestTypes.Tower)
                {
                    return;
                }
                TowerFloorParam towerFloor = MonoSingleton <GameManager> .Instance.FindTowerFloor(this.mStartingQuest.iname);

                this.ExecRequest((WebAPI) new ReqBtlTowerComReq(towerFloor.tower_id, towerFloor.iname, partyOfType, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
            }
        }
        public override void OnActivate(int pinID)
        {
            GameManager instance = MonoSingleton <GameManager> .Instance;
            MyPhoton    pt       = PunMonoSingleton <MyPhoton> .Instance;

            instance.AudienceMode  = false;
            this.mReqID            = pinID;
            pt.IsMultiPlay         = false;
            pt.IsMultiVersus       = false;
            instance.IsVSCpuBattle = false;
            pt.IsRankMatch         = false;
            if (pinID == 0 || pinID == 100 || (pinID == 200 || pinID == 250) || (pinID == 500 || pinID == 700 || pinID == 1000))
            {
                pt.IsMultiPlay         = pinID == 100 || pinID == 200 || pinID == 250 || pinID == 500;
                pt.IsMultiVersus       = pinID == 200 || pinID == 250;
                instance.IsVSCpuBattle = pinID == 700;
                pt.IsRankMatch         = pinID == 250;
                pinID = 0;
            }
            if (pinID == 10)
            {
                this.mResume = true;
                pinID        = 0;
            }
            if (pinID == 0)
            {
                if (((Behaviour)this).get_enabled())
                {
                    return;
                }
                ((Behaviour)this).set_enabled(true);
                CriticalSection.Enter(CriticalSections.SceneChange);
                if (this.mResume)
                {
                    long btlId = (long)GlobalVars.BtlID;
                    GlobalVars.BtlID.Set(0L);
                    this.ExecRequest((WebAPI) new ReqBtlComResume(btlId, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                }
                else
                {
                    this.mStartingQuest = instance.FindQuest(GlobalVars.SelectedQuestID);
                    PlayerPartyTypes partyIndex1 = this.QuestToPartyIndex(this.mStartingQuest.type);
                    if (!string.IsNullOrEmpty(this.QuestID))
                    {
                        GlobalVars.SelectedQuestID  = this.QuestID;
                        GlobalVars.SelectedFriendID = string.Empty;
                    }
                    if (!this.PlayOffline && Network.Mode == Network.EConnectMode.Online)
                    {
                        if (this.mStartingQuest.type == QuestTypes.Arena)
                        {
                            this.ActivateOutputLinks(5);
                            this.StartCoroutine(this.StartScene((BattleCore.Json_Battle)null));
                        }
                        else if (this.mStartingQuest.type == QuestTypes.Ordeal)
                        {
                            this.ExecRequest((WebAPI) new ReqBtlOrdealReq(this.mStartingQuest.iname, GlobalVars.OrdealSupports, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                        }
                        else
                        {
                            PartyData        partyOfType      = instance.Player.FindPartyOfType(partyIndex1);
                            int              partyIndex2      = instance.Player.Partys.IndexOf(partyOfType);
                            bool             multi            = false;
                            bool             isHost           = false;
                            int              seat             = -1;
                            int              plid             = -1;
                            string           uid              = string.Empty;
                            List <string>    stringList       = new List <string>();
                            VersusStatusData versusStatusData = (VersusStatusData)null;
                            int              num1             = 0;
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)pt, (UnityEngine.Object)null))
                            {
                                multi  = pt.IsMultiPlay;
                                isHost = pt.IsOldestPlayer();
                                seat   = pt.MyPlayerIndex;
                                MyPhoton.MyPlayer myPlayer = pt.GetMyPlayer();
                                if (myPlayer != null)
                                {
                                    plid = myPlayer.playerID;
                                }
                                if (pt.IsMultiVersus)
                                {
                                    List <JSON_MyPhotonPlayerParam> myPlayersStarted = pt.GetMyPlayersStarted();
                                    MyPhoton.MyRoom          currentRoom             = pt.GetCurrentRoom();
                                    int                      num2 = currentRoom == null ? 1 : currentRoom.playerCount;
                                    JSON_MyPhotonPlayerParam photonPlayerParam = myPlayersStarted.Find((Predicate <JSON_MyPhotonPlayerParam>)(p => p.playerIndex != pt.MyPlayerIndex));
                                    if (photonPlayerParam != null)
                                    {
                                        uid = photonPlayerParam.UID;
                                    }
                                    if (!GlobalVars.IsVersusDraftMode)
                                    {
                                        if (string.IsNullOrEmpty(uid) || num2 == 1)
                                        {
                                            this.OnVersusNoPlayer();
                                            return;
                                        }
                                        PlayerPartyTypes playerPartyTypes = PlayerPartyTypes.Versus;
                                        if (pt.IsRankMatch)
                                        {
                                            playerPartyTypes = PlayerPartyTypes.RankMatch;
                                        }
                                        PartyData party = instance.Player.Partys[(int)playerPartyTypes];
                                        if (party != null)
                                        {
                                            versusStatusData = new VersusStatusData();
                                            for (int index = 0; index < party.MAX_UNIT; ++index)
                                            {
                                                long unitUniqueId = party.GetUnitUniqueID(index);
                                                if (party.GetUnitUniqueID(index) != 0L)
                                                {
                                                    UnitData unitDataByUniqueId = instance.Player.FindUnitDataByUniqueID(unitUniqueId);
                                                    if (unitDataByUniqueId != null)
                                                    {
                                                        versusStatusData.Add(unitDataByUniqueId.Status.param, unitDataByUniqueId.GetCombination());
                                                        ++num1;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        versusStatusData = new VersusStatusData();
                                        for (int index = 0; index < VersusDraftList.VersusDraftPartyUnits.Count; ++index)
                                        {
                                            UnitData versusDraftPartyUnit = VersusDraftList.VersusDraftPartyUnits[index];
                                            if (versusDraftPartyUnit != null)
                                            {
                                                versusStatusData.Add(versusDraftPartyUnit.Status.param, versusDraftPartyUnit.GetCombination());
                                                ++num1;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    List <JSON_MyPhotonPlayerParam> myPlayersStarted = pt.GetMyPlayersStarted();
                                    for (int index = 0; index < myPlayersStarted.Count; ++index)
                                    {
                                        if (myPlayersStarted[index].playerIndex != pt.MyPlayerIndex)
                                        {
                                            stringList.Add(myPlayersStarted[index].UID);
                                        }
                                    }
                                }
                            }
                            if (this.mReqID == 200)
                            {
                                if (GlobalVars.IsVersusDraftMode)
                                {
                                    int enemy_draft_id       = 0;
                                    MyPhoton.MyPlayer player = PunMonoSingleton <MyPhoton> .Instance.GetMyPlayer();

                                    JSON_MyPhotonPlayerParam photonPlayerParam = pt.GetMyPlayersStarted().Find((Predicate <JSON_MyPhotonPlayerParam>)(p => p.playerID != player.playerID));
                                    if (photonPlayerParam != null)
                                    {
                                        enemy_draft_id = photonPlayerParam.draft_id;
                                    }
                                    this.ExecRequest((WebAPI) new ReqVersus(this.mStartingQuest.iname, plid, seat, uid, versusStatusData, num1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), GlobalVars.SelectedMultiPlayVersusType, VersusDraftList.DraftID, enemy_draft_id));
                                }
                                else
                                {
                                    this.ExecRequest((WebAPI) new ReqVersus(this.mStartingQuest.iname, plid, seat, uid, versusStatusData, num1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), GlobalVars.SelectedMultiPlayVersusType, 0, 0));
                                }
                            }
                            else if (this.mReqID == 250)
                            {
                                this.ExecRequest((WebAPI) new ReqRankMatch(this.mStartingQuest.iname, plid, seat, uid, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                            }
                            else if (this.mReqID == 500)
                            {
                                this.ExecRequest((WebAPI) new ReqBtlMultiTwReq(this.mStartingQuest.iname, partyIndex2, plid, seat, stringList.ToArray(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                            }
                            else if (this.mReqID == 700)
                            {
                                this.ExecRequest((WebAPI) new ReqVersusCpu(this.mStartingQuest.iname, GlobalVars.VersusCpu == null ? 1 : GlobalVars.VersusCpu.Get().Deck, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                            }
                            else
                            {
                                this.ExecRequest((WebAPI) new ReqBtlComReq(this.mStartingQuest.iname, GlobalVars.SelectedFriendID, GlobalVars.SelectedSupport.Get(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), multi, partyIndex2, isHost, plid, seat, GlobalVars.Location, GlobalVars.SelectedRankingQuestParam));
                            }
                        }
                    }
                    else
                    {
                        this.StartCoroutine(this.StartScene((BattleCore.Json_Battle)null));
                    }
                }
            }
            else if (pinID == 20)
            {
                if (instance.AudienceRoom == null)
                {
                    return;
                }
                this.StartCoroutine(this.StartAudience());
            }
            else
            {
                if (pinID != 30)
                {
                    return;
                }
                if (Network.IsError)
                {
                    this.ActivateOutputLinks(300);
                    Network.ResetError();
                }
                else if (!Network.IsStreamConnecting)
                {
                    Network.ResetError();
                    this.ActivateOutputLinks(300);
                }
                else
                {
                    VersusAudienceManager audienceManager = instance.AudienceManager;
                    audienceManager.AddStartQuest();
                    if (audienceManager.GetStartedParam() != null)
                    {
                        if (audienceManager.GetStartedParam().btlinfo != null)
                        {
                            BattleCore.Json_Battle json = new BattleCore.Json_Battle();
                            json.btlinfo = audienceManager.GetStartedParam().btlinfo;
                            CriticalSection.Enter(CriticalSections.SceneChange);
                            instance.AudienceMode = true;
                            this.StartCoroutine(this.StartScene(json));
                        }
                        else if (audienceManager.IsRetryError)
                        {
                            DebugUtility.LogError("Not Exist btlInfo");
                            Network.Abort();
                            this.ActivateOutputLinks(300);
                        }
                        else
                        {
                            this.ActivateOutputLinks(9);
                        }
                    }
                    else if (audienceManager.IsRetryError)
                    {
                        DebugUtility.LogError("Not Exist StartParam");
                        Network.Abort();
                        this.ActivateOutputLinks(300);
                    }
                    else
                    {
                        this.ActivateOutputLinks(9);
                    }
                }
            }
        }
Beispiel #12
0
        private void LoadParty()
        {
            this.mCurrentQuest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID);

            this.mIsHeloOnly = PartyUtility.IsSoloStoryParty(this.mCurrentQuest);
            if (this.StoryNormalObjects != null)
            {
                for (int index = 0; index < this.StoryNormalObjects.Length; ++index)
                {
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.StoryNormalObjects[index], (UnityEngine.Object)null))
                    {
                        this.StoryNormalObjects[index].SetActive(!this.mIsHeloOnly);
                    }
                }
            }
            if (this.HeloOnlyObjects != null)
            {
                for (int index = 0; index < this.HeloOnlyObjects.Length; ++index)
                {
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HeloOnlyObjects[index], (UnityEngine.Object)null))
                    {
                        this.HeloOnlyObjects[index].SetActive(this.mIsHeloOnly);
                    }
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.GuestUnitSlot, (UnityEngine.Object)null))
            {
                if (this.mIsHeloOnly)
                {
                    ((Component)this.GuestUnitSlot).get_transform().SetSiblingIndex(0);
                }
                else
                {
                    ((Component)this.GuestUnitSlot).get_transform().SetSiblingIndex(4);
                }
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            PartyWindow2.EditPartyTypes type = PartyUtility.GetEditPartyTypes(this.mCurrentQuest);
            if (type == PartyWindow2.EditPartyTypes.Auto)
            {
                type = PartyWindow2.EditPartyTypes.Normal;
            }
            PartyData partyOfType = MonoSingleton <GameManager> .Instance.Player.FindPartyOfType(type.ToPlayerPartyType());

            this.mCurrentParty = new UnitData[partyOfType.MAX_UNIT];
            UnitData data  = (UnitData)null;
            string   iname = this.mCurrentQuest.units.Get(0);

            if (this.mIsUserOwnUnits)
            {
                data = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUnitID(iname);

                for (int index = 0; index < partyOfType.MAX_UNIT; ++index)
                {
                    long unitUniqueId = partyOfType.GetUnitUniqueID(index);
                    if (unitUniqueId > 0L)
                    {
                        this.mCurrentParty[index] = player.FindUnitDataByUniqueID(unitUniqueId);
                    }
                }
            }
            else
            {
                for (int index = 0; index < partyOfType.MAX_UNIT && index < this.mUserSelectionParty.Length; ++index)
                {
                    if (this.mUserSelectionParty[index] == null)
                    {
                        this.mCurrentParty[index] = (UnitData)null;
                    }
                    if (this.mUserSelectionParty[index] != null && this.mUserSelectionParty[index].UnitParam.iname == iname)
                    {
                        data = this.mUserSelectionParty[index];
                    }
                    else
                    {
                        this.mCurrentParty[index] = this.mUserSelectionParty[index];
                    }
                }
            }
            int count = this.mCurrentParty.Length - 2;

            UnitData[] array1 = ((IEnumerable <UnitData>) this.mCurrentParty).Skip <UnitData>(count).Take <UnitData>(2).ToArray <UnitData>();
            UnitData[] array2 = ((IEnumerable <UnitData>) this.mCurrentParty).Take <UnitData>(count).ToArray <UnitData>();
            for (int index = 0; index < this.SubUnitSlots.Length && index < array1.Length; ++index)
            {
                this.SubUnitSlots[index].SetSlotData <QuestParam>(this.mCurrentQuest);
                this.SubUnitSlots[index].SetSlotData <UnitData>(array1[index]);
            }
            for (int index = 0; index < this.UnitSlots.Length && index < array2.Length; ++index)
            {
                this.UnitSlots[index].SetSlotData <QuestParam>(this.mCurrentQuest);
                this.UnitSlots[index].SetSlotData <UnitData>(array2[index]);
            }
            if (data != null)
            {
                this.mGuestUnit = data;
                this.GuestUnitSlot.SetSlotData <QuestParam>(this.mCurrentQuest);
                this.GuestUnitSlot.SetSlotData <UnitData>(data);
                ((Component)this.GuestUnitSlot).get_gameObject().SetActive(true);
            }
            else
            {
                ((Component)this.GuestUnitSlot).get_gameObject().SetActive(false);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.FriendSlot, (UnityEngine.Object)null))
            {
                if (this.mCurrentQuest.type == QuestTypes.Tower)
                {
                    ((Component)this.FriendSlot).get_gameObject().SetActive(false);
                }
                else
                {
                    ((Component)this.FriendSlot).get_gameObject().SetActive(true);
                    if (this.mIsUserOwnUnits)
                    {
                        this.mCurrentSupport = (SupportData)GlobalVars.SelectedSupport;
                        this.FriendSlot.SetSlotData <UnitData>(this.mCurrentSupport != null ? this.mCurrentSupport.Unit : (UnitData)null);
                    }
                    else if (this.mSupportData != null)
                    {
                        this.FriendSlot.SetSlotData <UnitData>(this.mSupportData.Unit);
                    }
                }
            }
            int num;

            switch (type)
            {
            case PartyWindow2.EditPartyTypes.Normal:
            case PartyWindow2.EditPartyTypes.Arena:
            case PartyWindow2.EditPartyTypes.ArenaDef:
            case PartyWindow2.EditPartyTypes.Character:
                num = 3;
                break;

            case PartyWindow2.EditPartyTypes.Tower:
                num = 5;
                break;

            default:
                if ((this.mCurrentQuest == null ? 0 : (this.mCurrentQuest.UseFixEditor ? 1 : 0)) == 0)
                {
                    num = 4;
                    break;
                }
                goto case PartyWindow2.EditPartyTypes.Normal;
            }
            for (int index = 0; index < this.UnitSlots.Length; ++index)
            {
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.UnitSlots[index], (UnityEngine.Object)null))
                {
                    ((Component)this.UnitSlots[index]).get_gameObject().SetActive(index < num);
                }
            }
        }
Beispiel #13
0
 private SkillParam GetLeaderSkill(PartyData party)
 {
     return(MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID(party.GetUnitUniqueID(party.LeaderIndex))?.LeaderSkill.SkillParam);
 }