Exemplo n.º 1
0
        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);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        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);
                    }
                }
            }
        }