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); } }
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); } } } }