private void SendPlacementInfo() { MyPhoton pt = PunMonoSingleton <MyPhoton> .Instance; MyPhoton.MyPlayer myPlayer = pt.GetMyPlayer(); if (myPlayer == null) { return; } JSON_MyPhotonPlayerParam param = JSON_MyPhotonPlayerParam.Parse(myPlayer.json); if (param.units != null) { for (int i = 0; i < param.units.Length; ++i) { TacticsUnitController tacticsUnitController = this.m_Units.Find((Predicate <TacticsUnitController>)(data => { if (data.Unit.OwnerPlayerIndex == pt.MyPlayerIndex) { return(data.UnitData.UnitParam.iname == param.units[i].unit.UnitParam.iname); } return(false); })); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)tacticsUnitController, (UnityEngine.Object)null)) { param.units[i].place = this.GetPlacementID(tacticsUnitController.Unit.x, tacticsUnitController.Unit.y); PlayerPrefsUtility.SetInt(PlayerPrefsUtility.MULTITW_ID_KEY + (object)i, param.units[i].place, false); } } } PlayerPrefsUtility.Save(); pt.SetMyPlayerParam(param.Serialize()); }
public override void Begin(VersusDraftReady self) { MyPhoton instance1 = PunMonoSingleton <MyPhoton> .Instance; MyPhoton.MyPlayer myPlayer = instance1.GetMyPlayer(); int num1 = myPlayer != null ? myPlayer.playerID : 0; int myPlayerIndex = instance1.MyPlayerIndex; GameManager instance2 = MonoSingleton <GameManager> .Instance; JSON_MyPhotonPlayerParam photonPlayerParam = new JSON_MyPhotonPlayerParam(); PlayerData player = instance2.Player; photonPlayerParam.playerID = num1; photonPlayerParam.playerIndex = myPlayerIndex; photonPlayerParam.playerName = player.Name; photonPlayerParam.playerLevel = player.Lv; photonPlayerParam.FUID = player.FUID; photonPlayerParam.UID = MonoSingleton <GameManager> .Instance.DeviceId; photonPlayerParam.award = player.SelectedAward; int num2 = 0; int num3 = 0; int num4 = 0; List <JSON_MyPhotonPlayerParam.UnitDataElem> unitDataElemList = new List <JSON_MyPhotonPlayerParam.UnitDataElem>(); for (int index = 0; index < VersusDraftList.VersusDraftPartyUnits.Count; ++index) { UnitData versusDraftPartyUnit = VersusDraftList.VersusDraftPartyUnits[index]; if (versusDraftPartyUnit != null) { unitDataElemList.Add(new JSON_MyPhotonPlayerParam.UnitDataElem() { slotID = num2, place = VersusDraftList.VersusDraftPartyPlaces.Count <= index ? index : VersusDraftList.VersusDraftPartyPlaces[index], unit = versusDraftPartyUnit }); num3 = num3 + (int)versusDraftPartyUnit.Status.param.atk + (int)versusDraftPartyUnit.Status.param.mag; num4 = num4 + (int)((double)(int)versusDraftPartyUnit.Status.param.hp * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.HP) + (int)((double)(int)versusDraftPartyUnit.Status.param.atk * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Attack) + (int)((double)(int)versusDraftPartyUnit.Status.param.def * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Defense) + (int)((double)(int)versusDraftPartyUnit.Status.param.mag * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.MagAttack) + (int)((double)(int)versusDraftPartyUnit.Status.param.mnd * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.MagDefense) + (int)((double)(int)versusDraftPartyUnit.Status.param.dex * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Dex) + (int)((double)(int)versusDraftPartyUnit.Status.param.spd * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Speed) + (int)((double)(int)versusDraftPartyUnit.Status.param.cri * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Critical) + (int)((double)(int)versusDraftPartyUnit.Status.param.luk * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Luck) + (int)((double)versusDraftPartyUnit.GetCombination() * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Combo) + (int)((double)(int)versusDraftPartyUnit.Status.param.mov * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Move) + (int)((double)(int)versusDraftPartyUnit.Status.param.jmp * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Jump); ++num2; } } photonPlayerParam.units = unitDataElemList.ToArray(); photonPlayerParam.totalAtk = num3; photonPlayerParam.totalStatus = Mathf.FloorToInt((float)(num4 / unitDataElemList.Count)); photonPlayerParam.rankpoint = player.VERSUS_POINT; photonPlayerParam.draft_id = VersusDraftList.DraftID; instance1.SetMyPlayerParam(photonPlayerParam.Serialize()); byte[] msg = GameUtility.Object2Binary <VersusDraftReady.VersusReadyMessageData>(new VersusDraftReady.VersusReadyMessageData() { h = 1, pidx = myPlayerIndex, pid = num1 }); instance1.SendRoomMessageBinary(true, msg, MyPhoton.SEND_TYPE.Normal, false); FlowNode_GameObject.ActivateOutputLinks((Component)self, 2); }
public override void Begin(VersusDraftReady self) { MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance; List <JSON_MyPhotonPlayerParam> myPlayersStarted = instance.GetMyPlayersStarted(); List <MyPhoton.MyPlayer> roomPlayerList = instance.GetRoomPlayerList(); for (int index1 = 0; index1 < roomPlayerList.Count; ++index1) { JSON_MyPhotonPlayerParam param = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index1].json); int index2 = myPlayersStarted.FindIndex((Predicate <JSON_MyPhotonPlayerParam>)(sp => sp.playerID == param.playerID)); if (index2 > -1) { myPlayersStarted[index2] = param; } } if (roomPlayerList.Count < 2) { MyPhoton.MyPlayer player = instance.GetMyPlayer(); JSON_MyPhotonPlayerParam photonPlayerParam = myPlayersStarted.Find((Predicate <JSON_MyPhotonPlayerParam>)(sp => sp.playerID != player.playerID)); int num1 = 0; int num2 = 0; int num3 = 0; List <JSON_MyPhotonPlayerParam.UnitDataElem> unitDataElemList = new List <JSON_MyPhotonPlayerParam.UnitDataElem>(); for (int index = 0; index < VersusDraftList.VersusDraftUnitDataListEnemy.Count && index < 3; ++index) { UnitData unitData = VersusDraftList.VersusDraftUnitDataListEnemy[index]; if (unitData != null) { unitDataElemList.Add(new JSON_MyPhotonPlayerParam.UnitDataElem() { slotID = num1, place = index, unit = unitData }); num2 = num2 + (int)unitData.Status.param.atk + (int)unitData.Status.param.mag; num3 = num3 + (int)((double)(int)unitData.Status.param.hp * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.HP) + (int)((double)(int)unitData.Status.param.atk * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Attack) + (int)((double)(int)unitData.Status.param.def * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Defense) + (int)((double)(int)unitData.Status.param.mag * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.MagAttack) + (int)((double)(int)unitData.Status.param.mnd * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.MagDefense) + (int)((double)(int)unitData.Status.param.dex * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Dex) + (int)((double)(int)unitData.Status.param.spd * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Speed) + (int)((double)(int)unitData.Status.param.cri * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Critical) + (int)((double)(int)unitData.Status.param.luk * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Luck) + (int)((double)unitData.GetCombination() * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Combo) + (int)((double)(int)unitData.Status.param.mov * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Move) + (int)((double)(int)unitData.Status.param.jmp * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Jump); ++num1; } } photonPlayerParam.units = unitDataElemList.ToArray(); photonPlayerParam.totalAtk = num2; photonPlayerParam.totalStatus = Mathf.FloorToInt((float)(num3 / unitDataElemList.Count)); photonPlayerParam.draft_id = -1; } if (instance.IsOldestPlayer()) { instance.UpdateRoomParam("started", (object)new FlowNode_StartMultiPlay.PlayerList() { players = myPlayersStarted.ToArray() }.Serialize()); } FlowNode_GameObject.ActivateOutputLinks((Component)self, 3); }
private void SendRoomMessage(VersusDraftList.VersusDraftMessageData mess, bool immediate = false) { if (mess == null) { return; } MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance; MyPhoton.MyPlayer myPlayer = instance.GetMyPlayer(); int myPlayerIndex = instance.MyPlayerIndex; int num = myPlayer != null ? myPlayer.playerID : 0; mess.pidx = myPlayerIndex; mess.pid = num; byte[] msg = GameUtility.Object2Binary <VersusDraftList.VersusDraftMessageData>(mess); instance.SendRoomMessageBinary(true, msg, MyPhoton.SEND_TYPE.Normal, false); if (!immediate) { return; } instance.SendFlush(); }
private UnitData GetUnitData() { MyPhoton pt = PunMonoSingleton <MyPhoton> .Instance; if (UnityEngine.Object.op_Inequality((UnityEngine.Object)pt, (UnityEngine.Object)null)) { string roomParam = pt.GetRoomParam("started"); if (roomParam != null) { JSON_MyPhotonPlayerParam[] players = JSONParser.parseJSONObject <FlowNode_StartMultiPlay.PlayerList>(roomParam).players; if (players.Length > 0) { JSON_MyPhotonPlayerParam photonPlayerParam = Array.Find <JSON_MyPhotonPlayerParam>(players, (Predicate <JSON_MyPhotonPlayerParam>)(p => p.playerID == pt.GetMyPlayer().playerID)); if (photonPlayerParam != null) { UnitData unitData = new UnitData(); unitData.Deserialize(photonPlayerParam.units[0].unitJson); return(unitData); } } } } return((UnitData)null); }
public override void OnActivate(int pinID) { if (pinID == 100) { GameManager instance = MonoSingleton <GameManager> .Instance; JSON_MyPhotonPlayerParam data = (JSON_MyPhotonPlayerParam)null; if (instance.AudienceMode) { MyPhoton.MyRoom audienceRoom = instance.AudienceRoom; if (audienceRoom != null) { JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(audienceRoom.json); if (myPhotonRoomParam != null && myPhotonRoomParam.players != null && myPhotonRoomParam.players.Length >= this.ROOM_MAX_PLAYERCNT) { data = myPhotonRoomParam.players[!this.MyPlayer ? 1 : 0]; } } } else { MyPhoton pt = PunMonoSingleton <MyPhoton> .Instance; List <MyPhoton.MyPlayer> roomPlayerList = pt.GetRoomPlayerList(); if (roomPlayerList != null) { if (this.MyPlayer) { data = JSON_MyPhotonPlayerParam.Create(0, 0); } else { MyPhoton.MyPlayer myPlayer = roomPlayerList.Find((Predicate <MyPhoton.MyPlayer>)(p => p.playerID != pt.GetMyPlayer().playerID)); if (myPlayer != null) { data = JSON_MyPhotonPlayerParam.Parse(myPlayer.json); } } } } if (data != null) { DataSource.Bind <JSON_MyPhotonPlayerParam>(this.BindObj, data); } } this.ActivateOutputLinks(200); }
public override void Update(FlowNode_StartMultiPlay self) { MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance; if (instance.CurrentState != MyPhoton.MyState.ROOM) { self.Failure(); } else { MyPhoton.MyRoom currentRoom = instance.GetCurrentRoom(); if (currentRoom == null) { self.Failure(); } else { JSON_MyPhotonRoomParam myPhotonRoomParam = !string.IsNullOrEmpty(currentRoom.json) ? JSON_MyPhotonRoomParam.Parse(currentRoom.json) : (JSON_MyPhotonRoomParam)null; if (myPhotonRoomParam == null) { self.Failure(); } else { if (myPhotonRoomParam.started == 0) { myPhotonRoomParam.started = 1; instance.SetRoomParam(myPhotonRoomParam.Serialize()); } if ((double)this.mStartWait > 0.0) { this.mStartWait -= Time.get_deltaTime(); if ((double)this.mStartWait > 0.0) { return; } GlobalVars.SelectedQuestID = myPhotonRoomParam.iname; GlobalVars.SelectedFriendID = (string)null; GlobalVars.SelectedFriend = (FriendData)null; GlobalVars.SelectedSupport.Set((SupportData)null); self.Success(); DebugUtility.Log("StartMultiPlay: " + myPhotonRoomParam.Serialize()); } else if ((double)this.mWait > 0.0) { this.mWait -= Time.get_deltaTime(); } else { List <MyPhoton.MyPlayer> roomPlayerList = instance.GetRoomPlayerList(); if (this.mConfirm) { using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList.GetEnumerator()) { while (enumerator.MoveNext()) { if (JSON_MyPhotonPlayerParam.Parse(enumerator.Current.json).state != 3) { return; } } } this.mStartWait = 0.1f; } else { MyPhoton.MyPlayer myPlayer = instance.GetMyPlayer(); if (this.mRecvList.Count <= 0) { this.mSend.senderPlayerID = myPlayer.playerID; List <JSON_MyPhotonPlayerParam> photonPlayerParamList = new List <JSON_MyPhotonPlayerParam>(); for (int index = 0; index < roomPlayerList.Count; ++index) { JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index].json); photonPlayerParamList.Add(photonPlayerParam); } photonPlayerParamList.Sort((Comparison <JSON_MyPhotonPlayerParam>)((a, b) => a.playerIndex - b.playerIndex)); this.mSend.playerListJson = new FlowNode_StartMultiPlay.PlayerList() { players = photonPlayerParamList.ToArray() }.Serialize(); string msg = this.mSend.Serialize(); DebugUtility.Log("[PUN] send started player list: " + msg); instance.SendRoomMessage(true, msg, MyPhoton.SEND_TYPE.Normal); this.mRecvList.Add(this.mSend); } List <MyPhoton.MyEvent> events = instance.GetEvents(); for (int index = events.Count - 1; index >= 0; --index) { FlowNode_StartMultiPlay.State_GameStart.RecvData jsonObject = JSONParser.parseJSONObject <FlowNode_StartMultiPlay.State_GameStart.RecvData>(events[index].json); if (jsonObject == null || jsonObject.version < this.mSend.version) { DebugUtility.LogError("[PUN] started player list version error: " + events[index].json); instance.Disconnect(); return; } if (jsonObject.version <= this.mSend.version) { jsonObject.senderPlayerID = events[index].playerID; DebugUtility.Log("[PUN] recv started player list: " + events[index].json); this.mRecvList.Add(jsonObject); events.Remove(events[index]); } } // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type FlowNode_StartMultiPlay.State_GameStart.\u003CUpdate\u003Ec__AnonStorey217 updateCAnonStorey217 = new FlowNode_StartMultiPlay.State_GameStart.\u003CUpdate\u003Ec__AnonStorey217(); using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList.GetEnumerator()) { while (enumerator.MoveNext()) { // ISSUE: reference to a compiler-generated field updateCAnonStorey217.p = enumerator.Current; // ISSUE: reference to a compiler-generated method if (this.mRecvList.FindIndex(new Predicate <FlowNode_StartMultiPlay.State_GameStart.RecvData>(updateCAnonStorey217.\u003C\u003Em__212)) < 0) { return; } } } bool flag = true; using (List <FlowNode_StartMultiPlay.State_GameStart.RecvData> .Enumerator enumerator = this.mRecvList.GetEnumerator()) { while (enumerator.MoveNext()) { if (!enumerator.Current.playerListJson.Equals(this.mSend.playerListJson)) { flag = false; break; } } } if (!flag) { DebugUtility.Log("[PUN] started player list is not equal. ver:" + (object)this.mSend.version); this.mRecvList.Clear(); ++this.mSend.version; this.mWait = 1f; } else { DebugUtility.Log("[PUN]started player list decided. ver:" + (object)this.mSend.version); List <JSON_MyPhotonPlayerParam> myPlayersStarted = instance.GetMyPlayersStarted(); myPlayersStarted.Clear(); foreach (JSON_MyPhotonPlayerParam player in JSONParser.parseJSONObject <FlowNode_StartMultiPlay.PlayerList>(this.mSend.playerListJson).players) { player.SetupUnits(); myPlayersStarted.Add(player); } if (instance.IsOldestPlayer()) { instance.AddRoomParam("started", this.mSend.playerListJson); } if (events.Count > 0) { DebugUtility.LogError("[PUN] event must be empty."); } events.Clear(); JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(myPlayer.json); photonPlayerParam.state = 3; instance.SetMyPlayerParam(photonPlayerParam.Serialize()); this.mConfirm = true; } } } } } } }
public override void Update(FlowNode_StartMultiPlay self) { DebugUtility.Log("StartMultiPlay State_ResumeStart Update"); MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance; if (instance.CurrentState != MyPhoton.MyState.ROOM) { self.Failure(); } else { MyPhoton.MyRoom currentRoom = instance.GetCurrentRoom(); if (currentRoom == null) { self.Failure(); } else { JSON_MyPhotonPlayerParam photonPlayerParam1 = JSON_MyPhotonPlayerParam.Parse(instance.GetMyPlayer().json); if (photonPlayerParam1.state != 2) { photonPlayerParam1.state = 2; instance.SetMyPlayerParam(photonPlayerParam1.Serialize()); } JSON_MyPhotonRoomParam myPhotonRoomParam = !string.IsNullOrEmpty(currentRoom.json) ? JSON_MyPhotonRoomParam.Parse(currentRoom.json) : (JSON_MyPhotonRoomParam)null; if (myPhotonRoomParam == null) { self.Failure(); } else { GlobalVars.SelectedQuestID = myPhotonRoomParam.iname; GlobalVars.SelectedFriendID = (string)null; GlobalVars.SelectedFriend = (FriendData)null; GlobalVars.SelectedSupport.Set((SupportData)null); self.Success(); DebugUtility.Log("StartMultiPlay: " + myPhotonRoomParam.Serialize()); List <MyPhoton.MyPlayer> roomPlayerList = instance.GetRoomPlayerList(); List <JSON_MyPhotonPlayerParam> photonPlayerParamList = new List <JSON_MyPhotonPlayerParam>(); for (int index = 0; index < roomPlayerList.Count; ++index) { JSON_MyPhotonPlayerParam photonPlayerParam2 = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index].json); photonPlayerParam2.playerID = roomPlayerList[index].playerID; photonPlayerParamList.Add(photonPlayerParam2); } photonPlayerParamList.Sort((Comparison <JSON_MyPhotonPlayerParam>)((a, b) => a.playerIndex - b.playerIndex)); List <JSON_MyPhotonPlayerParam> myPlayersStarted = instance.GetMyPlayersStarted(); myPlayersStarted.Clear(); string roomParam = instance.GetRoomParam("started"); if (roomParam != null) { foreach (JSON_MyPhotonPlayerParam player in JSONParser.parseJSONObject <FlowNode_StartMultiPlay.PlayerList>(roomParam).players) { player.SetupUnits(); myPlayersStarted.Add(player); } } else { using (List <JSON_MyPhotonPlayerParam> .Enumerator enumerator = photonPlayerParamList.GetEnumerator()) { while (enumerator.MoveNext()) { JSON_MyPhotonPlayerParam current = enumerator.Current; current.SetupUnits(); myPlayersStarted.Add(current); } } } photonPlayerParam1.state = 3; instance.SetMyPlayerParam(photonPlayerParam1.Serialize()); instance.SetResumeMyPlayer(GlobalVars.ResumeMultiplayPlayerID); instance.MyPlayerIndex = GlobalVars.ResumeMultiplaySeatID; } } } }
public override void Update(FlowNode_StartMultiPlay self) { DebugUtility.Log("StartMultiPlay State_Start Update"); MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance; if (instance.CurrentState != MyPhoton.MyState.ROOM) { self.Failure(); } else { MyPhoton.MyRoom currentRoom = instance.GetCurrentRoom(); if (currentRoom == null) { self.Failure(); } else if (this.mPlayerNum != currentRoom.playerCount) { self.FailureStartMulti(); } else if (!instance.IsOldestPlayer() && !currentRoom.start) { self.Failure(); } else { bool flag = true; using (List <MyPhoton.MyPlayer> .Enumerator enumerator = instance.GetRoomPlayerList().GetEnumerator()) { while (enumerator.MoveNext()) { JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(enumerator.Current.json); if (photonPlayerParam.state != 2) { flag = false; if (instance.IsOldestPlayer()) { if (!instance.IsOldestPlayer(photonPlayerParam.playerID)) { if (photonPlayerParam.state != 1) { self.FailureStartMulti(); return; } } else { continue; } } DebugUtility.Log("StartMultiPlay State_Start Update allStart is false"); break; } } } if (flag) { DebugUtility.Log("StartMultiPlay State_Start Update change state to game start"); self.GotoState <FlowNode_StartMultiPlay.State_GameStart>(); } else if (currentRoom.start) { DebugUtility.Log("StartMultiPlay State_Start Update room is closed"); JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(instance.GetMyPlayer().json); if (photonPlayerParam.state == 2) { return; } photonPlayerParam.state = 2; instance.SetMyPlayerParam(photonPlayerParam.Serialize()); DebugUtility.Log("StartMultiPlay State_Start Update update my state"); } else { if (!instance.IsOldestPlayer()) { return; } DebugUtility.Log("StartMultiPlay State_Start Update close room"); instance.CloseRoom(); } } } }
public override void Update(FlowNode_MultiPlayJoinRoom self) { MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance; if (instance.CurrentState != MyPhoton.MyState.ROOM) { self.Failure(); } else { MyPhoton.MyPlayer myPlayer = instance.GetMyPlayer(); List <MyPhoton.MyPlayer> roomPlayerList = instance.GetRoomPlayerList(); using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList.GetEnumerator()) { while (enumerator.MoveNext()) { MyPhoton.MyPlayer current = enumerator.Current; JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(current.json); if (current.playerID < myPlayer.playerID && photonPlayerParam.playerIndex <= 0) { DebugUtility.Log("[PUN]waiting for player index turn..." + (object)current.playerID + " me:" + (object)myPlayer.playerID); return; } } } MyPhoton.MyRoom currentRoom = instance.GetCurrentRoom(); if (currentRoom.maxPlayers == 0) { self.Failure(); } else { bool[] flagArray = new bool[currentRoom.maxPlayers]; for (int index = 0; index < flagArray.Length; ++index) { flagArray[index] = false; } using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList.GetEnumerator()) { while (enumerator.MoveNext()) { MyPhoton.MyPlayer current = enumerator.Current; JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(current.json); if (current.playerID < myPlayer.playerID && photonPlayerParam.playerIndex > 0) { flagArray[photonPlayerParam.playerIndex - 1] = true; DebugUtility.Log("[PUN]player index " + (object)photonPlayerParam.playerIndex + " is used. (room:" + (object)currentRoom.maxPlayers + ")"); } } } for (int index = 0; index < currentRoom.maxPlayers; ++index) { if (!flagArray[index]) { int num = index + 1; DebugUtility.Log("[PUN]empty player index found: " + (object)num); self.mJoinPlayerParam.playerID = myPlayer.playerID; self.mJoinPlayerParam.playerIndex = num; instance.SetMyPlayerParam(self.mJoinPlayerParam.Serialize()); instance.MyPlayerIndex = num; self.Success(); break; } } } } }
public override void Update(FlowNode_StartMultiPlay self) { MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance; if (instance.CurrentState != MyPhoton.MyState.ROOM) { self.Failure(); } else { MyPhoton.MyRoom currentRoom = instance.GetCurrentRoom(); if (currentRoom == null) { self.Failure(); } else { JSON_MyPhotonRoomParam myPhotonRoomParam = !string.IsNullOrEmpty(currentRoom.json) ? JSON_MyPhotonRoomParam.Parse(currentRoom.json) : (JSON_MyPhotonRoomParam)null; if (myPhotonRoomParam == null) { self.Failure(); } else { if (myPhotonRoomParam.started == 0) { myPhotonRoomParam.started = 1; instance.SetRoomParam(myPhotonRoomParam.Serialize()); } if ((double)this.mStartWait > 0.0) { this.mStartWait -= Time.get_deltaTime(); if ((double)this.mStartWait > 0.0) { return; } GlobalVars.SelectedQuestID = myPhotonRoomParam.iname; GlobalVars.SelectedFriendID = (string)null; GlobalVars.SelectedFriend = (FriendData)null; GlobalVars.SelectedSupport.Set((SupportData)null); self.Success(); DebugUtility.Log("StartMultiPlay: " + myPhotonRoomParam.Serialize()); } else if ((double)this.mWait > 0.0) { this.mWait -= Time.get_deltaTime(); } else { List <MyPhoton.MyPlayer> roomPlayerList = instance.GetRoomPlayerList(); if ((myPhotonRoomParam.type == 1 || myPhotonRoomParam.type == 3) && roomPlayerList.Count == 1) { self.FailureStartMulti(); } else if (this.mConfirm) { using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList.GetEnumerator()) { while (enumerator.MoveNext()) { JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(enumerator.Current.json); if (photonPlayerParam.state != 3) { return; } if (photonPlayerParam.state < 2) { self.Failure(); return; } } } this.mStartWait = 0.1f; } else { MyPhoton.MyPlayer myPlayer = instance.GetMyPlayer(); if (this.mRecvList.Count <= 0) { this.mSend.senderPlayerID = myPlayer.photonPlayerID; this.mSend.playerListJson = (string)null; List <JSON_MyPhotonPlayerParam> photonPlayerParamList = new List <JSON_MyPhotonPlayerParam>(); for (int index = 0; index < roomPlayerList.Count; ++index) { JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index].json); photonPlayerParamList.Add(photonPlayerParam); } photonPlayerParamList.Sort((Comparison <JSON_MyPhotonPlayerParam>)((a, b) => a.playerIndex - b.playerIndex)); FlowNode_StartMultiPlay.PlayerList playerList = new FlowNode_StartMultiPlay.PlayerList(); playerList.players = photonPlayerParamList.ToArray(); Json_MyPhotonPlayerBinaryParam[] playerBinaryParamArray = new Json_MyPhotonPlayerBinaryParam[playerList.players.Length]; for (int index = 0; index < playerList.players.Length; ++index) { playerList.players[index].CreateJsonUnitData(); playerBinaryParamArray[index] = new Json_MyPhotonPlayerBinaryParam(); playerBinaryParamArray[index].Set(playerList.players[index]); } this.mSend.playerList = playerBinaryParamArray; byte[] msg = GameUtility.Object2Binary <FlowNode_StartMultiPlay.RecvData>(this.mSend); instance.SendRoomMessageBinary(true, msg, MyPhoton.SEND_TYPE.Sync, false); this.mRecvList.Add(this.mSend); this.mSend.playerListJson = playerList.Serialize(); } List <MyPhoton.MyEvent> events = instance.GetEvents(); for (int index = events.Count - 1; index >= 0; --index) { FlowNode_StartMultiPlay.RecvData buffer = (FlowNode_StartMultiPlay.RecvData)null; if (!GameUtility.Binary2Object <FlowNode_StartMultiPlay.RecvData>(out buffer, events[index].binary)) { DebugUtility.LogError("[PUN] started player list version error: " + events[index].json); instance.Disconnect(); return; } if (buffer == null || buffer.version < this.mSend.version) { DebugUtility.LogError("[PUN] started player list version error: " + events[index].json); instance.Disconnect(); return; } if (buffer.version <= this.mSend.version) { buffer.senderPlayerID = events[index].playerID; DebugUtility.Log("[PUN] recv started player list: " + events[index].json); this.mRecvList.Add(buffer); events.Remove(events[index]); } } using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList.GetEnumerator()) { while (enumerator.MoveNext()) { MyPhoton.MyPlayer p = enumerator.Current; if (this.mRecvList.FindIndex((Predicate <FlowNode_StartMultiPlay.RecvData>)(r => r.senderPlayerID == p.photonPlayerID)) < 0) { return; } } } bool flag = true; using (List <FlowNode_StartMultiPlay.RecvData> .Enumerator enumerator = this.mRecvList.GetEnumerator()) { while (enumerator.MoveNext()) { FlowNode_StartMultiPlay.RecvData current = enumerator.Current; if (current.playerList.Length == this.mSend.playerList.Length) { for (int index = 0; index < this.mSend.playerList.Length; ++index) { if (!Json_MyPhotonPlayerBinaryParam.IsEqual(current.playerList[index], this.mSend.playerList[index])) { flag = false; } } if (!flag) { break; } } else { flag = false; break; } } } if (!flag) { DebugUtility.Log("[PUN] started player list is not equal. ver:" + (object)this.mSend.version); this.mRecvList.Clear(); ++this.mSend.version; this.mWait = 1f; } else { DebugUtility.Log("[PUN]started player list decided. ver:" + (object)this.mSend.version); List <JSON_MyPhotonPlayerParam> myPlayersStarted = instance.GetMyPlayersStarted(); myPlayersStarted.Clear(); foreach (JSON_MyPhotonPlayerParam player in JSONParser.parseJSONObject <FlowNode_StartMultiPlay.PlayerList>(this.mSend.playerListJson).players) { player.SetupUnits(); myPlayersStarted.Add(player); } if (instance.IsOldestPlayer()) { instance.UpdateRoomParam("started", (object)this.mSend.playerListJson); } if (events.Count > 0) { DebugUtility.LogError("[PUN] event must be empty."); } events.Clear(); JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(myPlayer.json); photonPlayerParam.state = 3; instance.SetMyPlayerParam(photonPlayerParam.Serialize()); this.mConfirm = true; } } } } } } }
public override void OnActivate(int pinID) { switch (pinID) { case 0: case 4: case 22: this.ResetPlacementParam(); string empty1 = string.Empty; string str1 = !PlayerPrefsUtility.HasKey(PlayerPrefsUtility.ROOM_COMMENT_KEY) ? LocalizedText.Get("sys.DEFAULT_ROOM_COMMENT") : PlayerPrefsUtility.GetString(PlayerPrefsUtility.ROOM_COMMENT_KEY, string.Empty); if (string.IsNullOrEmpty(str1)) { str1 = LocalizedText.Get("sys.DEFAULT_ROOM_COMMENT"); } if (!MyMsgInput.isLegal(str1)) { DebugUtility.Log("comment is not legal"); this.ActivateOutputLinks(4801); break; } GlobalVars.ResumeMultiplayPlayerID = 0; GlobalVars.ResumeMultiplaySeatID = 0; GlobalVars.SelectedMultiPlayRoomComment = str1; DebugUtility.Log("MakeRoom Comment:" + GlobalVars.SelectedMultiPlayRoomComment); bool flag = false; if (pinID == 4) { GlobalVars.SelectedQuestID = FlowNode_OnUrlSchemeLaunch.LINEParam_decided.iname; GlobalVars.SelectedMultiPlayRoomType = FlowNode_OnUrlSchemeLaunch.LINEParam_decided.type; GlobalVars.EditMultiPlayRoomPassCode = "0"; flag = true; DebugUtility.Log("MakeRoom for LINE Quest:" + GlobalVars.SelectedQuestID + " Type:" + (object)GlobalVars.SelectedMultiPlayRoomType + " PassCodeHash:" + GlobalVars.SelectedMultiPlayRoomPassCodeHash); } GlobalVars.EditMultiPlayRoomPassCode = "0"; string s = FlowNode_Variable.Get("MultiPlayPasscode"); if (!string.IsNullOrEmpty(s)) { int result = 0; if (int.TryParse(s, out result)) { GlobalVars.EditMultiPlayRoomPassCode = result.ToString(); } } bool isPrivate = flag; FlowNode_MultiPlayAPI.RoomMakeTime = Time.get_realtimeSinceStartup(); bool limit = GlobalVars.SelectedMultiPlayLimit & GlobalVars.EditMultiPlayRoomPassCode == "0"; int unitlv = isPrivate || !limit ? 0 : GlobalVars.MultiPlayJoinUnitLv; bool clear = !isPrivate && limit && GlobalVars.MultiPlayClearOnly; int selectedMultiTowerFloor1 = GlobalVars.SelectedMultiTowerFloor; if (Network.Mode != Network.EConnectMode.Online) { GlobalVars.SelectedMultiPlayRoomID = (int)(DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds; GlobalVars.SelectedMultiPlayPhotonAppID = string.Empty; GlobalVars.SelectedMultiPlayRoomName = Guid.NewGuid().ToString(); DebugUtility.Log("MakeRoom RoomID:" + (object)GlobalVars.SelectedMultiPlayRoomID + " AppID:" + GlobalVars.SelectedMultiPlayPhotonAppID + " Name:" + GlobalVars.SelectedMultiPlayRoomName); this.Success(); break; } MultiInvitationSendWindow.ClearInvited(); ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.MAKE; if (pinID != 22) { this.ExecRequest((WebAPI) new ReqMPRoomMake(GlobalVars.SelectedQuestID, str1, GlobalVars.EditMultiPlayRoomPassCode, isPrivate, limit, unitlv, clear, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; } this.ExecRequest((WebAPI) new ReqMultiTwRoomMake(GlobalVars.SelectedMultiTowerID, str1, GlobalVars.EditMultiPlayRoomPassCode, selectedMultiTowerFloor1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 2: case 5: case 23: case 50: string fuid = (string)null; if (pinID == 5) { fuid = FlowNode_OnUrlSchemeLaunch.LINEParam_decided.creatorFUID; } else if (pinID == 50) { fuid = GlobalVars.MultiInvitationRoomOwner; } DebugUtility.Log("ListRoom FUID:" + fuid); if (Network.Mode != Network.EConnectMode.Online) { this.StartCoroutine(this.GetPhotonRoomList(fuid)); break; } FlowNode_MultiPlayAPI.RoomList = (ReqMPRoom.Response)null; string iname = string.Empty; if (pinID == 2) { iname = GlobalVars.SelectedQuestID; } int selectedMultiTowerFloor2 = GlobalVars.SelectedMultiTowerFloor; ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.ROOM; if (pinID != 23) { this.ExecRequest((WebAPI) new ReqMPRoom(fuid, iname, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; } this.ExecRequest((WebAPI) new ReqMultiTwRoom(fuid, iname, selectedMultiTowerFloor2, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 3: case 6: case 24: case 51: if (FlowNode_MultiPlayAPI.RoomList == null || FlowNode_MultiPlayAPI.RoomList.rooms == null || FlowNode_MultiPlayAPI.RoomList.rooms.Length <= 0) { this.Failure(); break; } this.ResetPlacementParam(); bool LockRoom = false; switch (pinID) { case 6: if (FlowNode_MultiPlayAPI.RoomList.rooms.Length != 1 || FlowNode_MultiPlayAPI.RoomList.rooms[0] == null) { this.Failure(); return; } GlobalVars.SelectedMultiPlayRoomID = FlowNode_MultiPlayAPI.RoomList.rooms[0].roomid; DebugUtility.Log("JoinRoom for LINE RoomID:" + (object)GlobalVars.SelectedMultiPlayRoomID); break; case 51: if (FlowNode_MultiPlayAPI.RoomList.rooms.Length != 1 || FlowNode_MultiPlayAPI.RoomList.rooms[0] == null) { this.Failure(); return; } LockRoom = GlobalVars.MultiInvitationRoomLocked; GlobalVars.SelectedMultiPlayRoomID = FlowNode_MultiPlayAPI.RoomList.rooms[0].roomid; DebugUtility.Log("JoinRoom for Invitation RoomID:" + (object)GlobalVars.SelectedMultiPlayRoomID); break; } GlobalVars.ResumeMultiplayPlayerID = 0; GlobalVars.ResumeMultiplaySeatID = 0; GlobalVars.SelectedQuestID = (string)null; for (int index = 0; index < FlowNode_MultiPlayAPI.RoomList.rooms.Length; ++index) { if (FlowNode_MultiPlayAPI.RoomList.rooms[index].quest != null && !string.IsNullOrEmpty(FlowNode_MultiPlayAPI.RoomList.rooms[index].quest.iname) && FlowNode_MultiPlayAPI.RoomList.rooms[index].roomid == GlobalVars.SelectedMultiPlayRoomID) { GlobalVars.SelectedQuestID = FlowNode_MultiPlayAPI.RoomList.rooms[index].quest.iname; break; } } if (string.IsNullOrEmpty(GlobalVars.SelectedQuestID)) { this.Failure(); break; } if (Network.Mode != Network.EConnectMode.Online) { this.StartCoroutine(this.GetPhotonRoomName()); break; } int selectedMultiTowerFloor3 = GlobalVars.SelectedMultiTowerFloor; ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.JOIN; if (pinID != 24) { this.ExecRequest((WebAPI) new ReqMPRoomJoin(GlobalVars.SelectedMultiPlayRoomID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), LockRoom)); break; } this.ExecRequest((WebAPI) new ReqMultiTwRoomJoin(GlobalVars.SelectedMultiPlayRoomID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), LockRoom, selectedMultiTowerFloor3, false)); break; case 7: case 26: case 55: case 56: if (Network.Mode != Network.EConnectMode.Online) { this.Success(); break; } if (!string.IsNullOrEmpty(GlobalVars.EditMultiPlayRoomComment) && !MyMsgInput.isLegal(GlobalVars.EditMultiPlayRoomComment)) { DebugUtility.Log("comment is not legal"); this.ActivateOutputLinks(4801); break; } switch (pinID) { case 55: GlobalVars.EditMultiPlayRoomPassCode = "0"; GlobalVars.EditMultiPlayRoomComment = GlobalVars.SelectedMultiPlayRoomComment; break; case 56: GlobalVars.EditMultiPlayRoomPassCode = "1"; GlobalVars.EditMultiPlayRoomComment = GlobalVars.SelectedMultiPlayRoomComment; break; } ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.UPDATE; if (GlobalVars.SelectedMultiPlayRoomType != JSON_MyPhotonRoomParam.EType.TOWER) { this.ExecRequest((WebAPI) new ReqMPRoomUpdate(GlobalVars.SelectedMultiPlayRoomID, GlobalVars.EditMultiPlayRoomComment, GlobalVars.EditMultiPlayRoomPassCode, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; } string selectedMultiTowerId = GlobalVars.SelectedMultiTowerID; int selectedMultiTowerFloor4 = GlobalVars.SelectedMultiTowerFloor; this.ExecRequest((WebAPI) new ReqMultiTwRoomUpdate(GlobalVars.SelectedMultiPlayRoomID, GlobalVars.EditMultiPlayRoomComment, GlobalVars.EditMultiPlayRoomPassCode, selectedMultiTowerId, selectedMultiTowerFloor4, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 8: case 25: case 28: if (Network.Mode != Network.EConnectMode.Online) { this.Failure(); break; } if (GlobalVars.SelectedMultiPlayRoomID < FlowNode_MultiPlayAPI.ROOMID_VALIDATE_MIN || GlobalVars.SelectedMultiPlayRoomID > FlowNode_MultiPlayAPI.ROOMID_VALIDATE_MAX) { this.Failure(); break; } this.ResetPlacementParam(); GlobalVars.ResumeMultiplayPlayerID = 0; GlobalVars.ResumeMultiplaySeatID = 0; ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.JOIN; if (pinID != 25 && pinID != 28) { this.ExecRequest((WebAPI) new ReqMPRoomJoin(GlobalVars.SelectedMultiPlayRoomID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), true)); break; } this.API = FlowNode_MultiPlayAPI.EAPI.MT_JOIN; this.ExecRequest((WebAPI) new ReqMultiTwRoomJoin(GlobalVars.SelectedMultiPlayRoomID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), true, 0, pinID == 28)); break; case 9: if (Network.Mode != Network.EConnectMode.Online) { this.Success(); break; } ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.VERSION; this.ExecRequest((WebAPI) new ReqMPVersion(new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 10: if (Network.Mode != Network.EConnectMode.Online) { this.Success(); break; } GlobalVars.SelectedMultiPlayRoomName = string.Empty; GlobalVars.VersusRoomReuse = false; GlobalVars.ResumeMultiplayPlayerID = 0; GlobalVars.ResumeMultiplaySeatID = 0; GlobalVars.MultiPlayVersusKey = MonoSingleton <GameManager> .Instance.GetVersusKey(GlobalVars.SelectedMultiPlayVersusType); ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_START; this.ExecRequest((WebAPI) new ReqVersusStart(GlobalVars.SelectedMultiPlayVersusType, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 11: if (Network.Mode != Network.EConnectMode.Online) { this.Success(); break; } string empty2 = string.Empty; string str2 = !PlayerPrefsUtility.HasKey(PlayerPrefsUtility.ROOM_COMMENT_KEY) ? LocalizedText.Get("sys.DEFAULT_ROOM_COMMENT") : PlayerPrefsUtility.GetString(PlayerPrefsUtility.ROOM_COMMENT_KEY, string.Empty); if (string.IsNullOrEmpty(str2)) { str2 = LocalizedText.Get("sys.DEFAULT_ROOM_COMMENT"); } if (!MyMsgInput.isLegal(str2)) { DebugUtility.Log("comment is not legal"); this.ActivateOutputLinks(4801); break; } FlowNode_MultiPlayAPI.RoomMakeTime = Time.get_realtimeSinceStartup(); GlobalVars.SelectedMultiPlayRoomComment = str2; ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_MAKE; this.ExecRequest((WebAPI) new ReqVersusMake(GlobalVars.SelectedMultiPlayVersusType, str2, GlobalVars.SelectedQuestID, false, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 12: if (Network.Mode != Network.EConnectMode.Online) { this.Failure(); break; } if (GlobalVars.SelectedMultiPlayRoomID < FlowNode_MultiPlayAPI.ROOMID_VALIDATE_MIN || GlobalVars.SelectedMultiPlayRoomID > FlowNode_MultiPlayAPI.ROOMID_VALIDATE_MAX) { this.Failure(); break; } ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_JOIN; this.ExecRequest((WebAPI) new ReqVersusRoomJoin(GlobalVars.SelectedMultiPlayRoomID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 13: if (Network.Mode != Network.EConnectMode.Online) { this.Success(); break; } if (!MyMsgInput.isLegal(GlobalVars.EditMultiPlayRoomComment)) { DebugUtility.Log("comment is not legal"); this.ActivateOutputLinks(4801); break; } ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.UPDATE; this.ExecRequest((WebAPI) new ReqVersusRoomUpdate(GlobalVars.SelectedMultiPlayRoomID, GlobalVars.EditMultiPlayRoomComment, GlobalVars.SelectedQuestID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 14: GlobalVars.SelectedMultiPlayRoomName = string.Empty; GlobalVars.VersusRoomReuse = false; GlobalVars.ResumeMultiplayPlayerID = 0; GlobalVars.ResumeMultiplaySeatID = 0; GlobalVars.MultiPlayVersusKey = MonoSingleton <GameManager> .Instance.GetVersusKey(GlobalVars.SelectedMultiPlayVersusType); this.Success(); break; case 15: if (Network.Mode != Network.EConnectMode.Online) { this.Success(); break; } ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_LINE_REQ; this.ExecRequest((WebAPI) new ReqVersusLine(GlobalVars.SelectedMultiPlayRoomName, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 16: if (Network.Mode != Network.EConnectMode.Online) { this.Success(); break; } GlobalVars.VersusRoomReuse = false; FlowNode_MultiPlayAPI.RoomMakeTime = Time.get_realtimeSinceStartup(); ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_LINE_MAKE; this.ExecRequest((WebAPI) new ReqVersusLineMake(GlobalVars.SelectedMultiPlayRoomName, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 17: if (Network.Mode != Network.EConnectMode.Online) { this.Failure(); break; } GlobalVars.SelectedMultiPlayRoomID = FlowNode_OnUrlSchemeLaunch.LINEParam_decided.roomid; if (GlobalVars.SelectedMultiPlayRoomID < FlowNode_MultiPlayAPI.ROOMID_VALIDATE_MIN || GlobalVars.SelectedMultiPlayRoomID > FlowNode_MultiPlayAPI.ROOMID_VALIDATE_MAX) { this.Failure(); break; } ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_JOIN; this.ExecRequest((WebAPI) new ReqVersusRoomJoin(GlobalVars.SelectedMultiPlayRoomID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 18: if (Network.Mode != Network.EConnectMode.Online) { this.Failure(); break; } ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_STATUS; this.ExecRequest((WebAPI) new ReqVersusStatus(new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 19: if (Network.Mode != Network.EConnectMode.Online) { this.Failure(); break; } ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_SEASON; this.ExecRequest((WebAPI) new ReqVersusSeason(new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 20: if (Network.Mode != Network.EConnectMode.Online) { this.Failure(); break; } ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_FRIEND; this.ExecRequest((WebAPI) new ReqVersusFriendScore(new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 21: GameManager instance1 = MonoSingleton <GameManager> .Instance; MyPhoton instance2 = PunMonoSingleton <MyPhoton> .Instance; if (UnityEngine.Object.op_Inequality((UnityEngine.Object)instance2, (UnityEngine.Object)null) && instance2.IsConnectedInRoom()) { GlobalVars.CreateAutoMultiTower = true; if (instance2.IsCreatedRoom()) { instance2.OpenRoom(true, false); MyPhoton.MyRoom currentRoom = instance2.GetCurrentRoom(); if (currentRoom != null) { JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(currentRoom.json); if (myPhotonRoomParam != null) { List <MultiTowerFloorParam> mtAllFloorParam = instance1.GetMTAllFloorParam(GlobalVars.SelectedMultiTowerID); if (mtAllFloorParam != null) { GlobalVars.SelectedMultiTowerFloor = Mathf.Min(mtAllFloorParam.Count, GlobalVars.SelectedMultiTowerFloor + 1); } myPhotonRoomParam.challegedMTFloor = GlobalVars.SelectedMultiTowerFloor; myPhotonRoomParam.iname = GlobalVars.SelectedMultiTowerID + "_" + myPhotonRoomParam.challegedMTFloor.ToString(); instance2.SetRoomParam(myPhotonRoomParam.Serialize()); } } } instance2.AddMyPlayerParam("BattleStart", (object)false); instance2.AddMyPlayerParam("resume", (object)false); MyPhoton.MyPlayer myPlayer = instance2.GetMyPlayer(); if (myPlayer != null) { JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(myPlayer.json); if (photonPlayerParam != null) { photonPlayerParam.mtChallengeFloor = instance1.GetMTChallengeFloor(); photonPlayerParam.mtClearedFloor = instance1.GetMTClearedMaxFloor(); instance2.SetMyPlayerParam(photonPlayerParam.Serialize()); } } this.Success(); break; } this.Failure(); break; case 27: if (Network.Mode != Network.EConnectMode.Online) { this.Failure(); break; } ((Behaviour)this).set_enabled(true); this.API = FlowNode_MultiPlayAPI.EAPI.MT_STATUS; this.ExecRequest((WebAPI) new ReqMultiTwStatus(GlobalVars.SelectedMultiTowerID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); break; case 29: MyPhoton instance3 = PunMonoSingleton <MyPhoton> .Instance; if (UnityEngine.Object.op_Inequality((UnityEngine.Object)instance3, (UnityEngine.Object)null) && instance3.IsConnectedInRoom()) { this.Success(); break; } this.Failure(); break; } }
public override void OnActivate(int pinID) { if (!GameUtility.Config_UseAssetBundles.Value) { this.ActivateOutputLinks(100); } else { switch (pinID) { case 0: MyPhoton pt = PunMonoSingleton <MyPhoton> .Instance; if (UnityEngine.Object.op_Inequality((UnityEngine.Object)pt, (UnityEngine.Object)null)) { List <MyPhoton.MyPlayer> roomPlayerList = pt.GetRoomPlayerList(); if (roomPlayerList != null && roomPlayerList.Count > 1) { MyPhoton.MyPlayer myPlayer = roomPlayerList.Find((Predicate <MyPhoton.MyPlayer>)(p => p.playerID != pt.GetMyPlayer().playerID)); if (myPlayer != null) { this.AddAssets(JSON_MyPhotonPlayerParam.Parse(myPlayer.json)); break; } break; } break; } break; case 1: GameManager instance = MonoSingleton <GameManager> .Instance; if (instance.AudienceRoom != null) { JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(instance.AudienceRoom.json); if (myPhotonRoomParam != null) { for (int index = 0; index < myPhotonRoomParam.players.Length; ++index) { if (myPhotonRoomParam.players[index] != null) { myPhotonRoomParam.players[index].SetupUnits(); this.AddAssets(myPhotonRoomParam.players[index]); } } break; } break; } break; } this.StartCoroutine(this.AsyncDownload()); } }
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); } } } }
public override void OnActivate(int pinID) { MyPhoton pt = PunMonoSingleton <MyPhoton> .Instance; if (UnityEngine.Object.op_Inequality((UnityEngine.Object)pt, (UnityEngine.Object)null)) { string roomParam = pt.GetRoomParam("started"); if (roomParam != null) { JSON_MyPhotonPlayerParam[] players = JSONParser.parseJSONObject <FlowNode_StartMultiPlay.PlayerList>(roomParam).players; if (players.Length > 0) { JSON_MyPhotonPlayerParam photonPlayerParam = this.Type != FlowNode_BindMultiUnit.TargetType.Player ? Array.Find <JSON_MyPhotonPlayerParam>(players, (Predicate <JSON_MyPhotonPlayerParam>)(p => p.playerID != pt.GetMyPlayer().playerID)) : Array.Find <JSON_MyPhotonPlayerParam>(players, (Predicate <JSON_MyPhotonPlayerParam>)(p => p.playerID == pt.GetMyPlayer().playerID)); if (photonPlayerParam != null) { PartyData partyOfType = MonoSingleton <GameManager> .Instance.Player.FindPartyOfType(PlayerPartyTypes.RankMatch); for (int index = 0; index < this.Targets.Length && index < photonPlayerParam.units.Length && (GlobalVars.SelectedMultiPlayRoomType != JSON_MyPhotonRoomParam.EType.RANKMATCH || partyOfType == null || index < partyOfType.VSWAITMEMBER_START); ++index) { photonPlayerParam.units[index].unit = new UnitData(); photonPlayerParam.units[index].unit.Deserialize(photonPlayerParam.units[index].unitJson); DataSource.Bind <UnitData>(this.Targets[index], photonPlayerParam.units[index].unit); GameParameter.UpdateAll(this.Targets[index]); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Image, (UnityEngine.Object)null) && index == 0) { DataSource.Bind <UnitData>(this.Image, photonPlayerParam.units[index].unit); GameParameter.UpdateAll(this.Image); } } } } } } this.ActivateOutputLinks(2); }
public override void Update(FlowNode_MultiPlayJoinRoom self) { MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance; if (instance.CurrentState != MyPhoton.MyState.ROOM) { self.Failure(); } else { MyPhoton.MyPlayer myPlayer = instance.GetMyPlayer(); List <MyPhoton.MyPlayer> roomPlayerList = instance.GetRoomPlayerList(); using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList.GetEnumerator()) { while (enumerator.MoveNext()) { MyPhoton.MyPlayer current = enumerator.Current; JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(current.json); if (current.playerID < myPlayer.playerID && photonPlayerParam.playerIndex <= 0) { DebugUtility.Log("[PUN]waiting for player index turn..." + (object)current.playerID + " me:" + (object)myPlayer.playerID); return; } } } MyPhoton.MyRoom currentRoom = instance.GetCurrentRoom(); if (currentRoom.maxPlayers == 0) { Debug.LogError((object)("Invalid Room:" + currentRoom.name)); PhotonNetwork.room.IsOpen = false; self.Failure(); } else { bool[] flagArray = new bool[currentRoom.maxPlayers]; for (int index = 0; index < flagArray.Length; ++index) { flagArray[index] = false; } using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList.GetEnumerator()) { while (enumerator.MoveNext()) { MyPhoton.MyPlayer current = enumerator.Current; JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(current.json); if (current.playerID < myPlayer.playerID && photonPlayerParam.playerIndex > 0) { flagArray[photonPlayerParam.playerIndex - 1] = true; DebugUtility.Log("[PUN]player index " + (object)photonPlayerParam.playerIndex + " is used. (room:" + (object)currentRoom.maxPlayers + ")"); } } } for (int index = 0; index < currentRoom.maxPlayers; ++index) { if (!flagArray[index]) { int num = index + 1; DebugUtility.Log("[PUN]empty player index found: " + (object)num); if (instance.IsMultiVersus && num >= 3) { foreach (PhotonPlayer player in PhotonNetwork.playerList) { new MyPhoton.MyPlayer().playerID = player.ID; Hashtable customProperties = player.CustomProperties; if (customProperties != null && ((Dictionary <object, object>)customProperties).Count > 0 && ((Dictionary <object, object>)customProperties).ContainsKey((object)"json")) { string buffer; GameUtility.Binary2Object <string>(out buffer, (byte[])customProperties.get_Item((object)"json")); Debug.Log((object)("player json : " + buffer)); } } Debug.LogError((object)"MultiVersus is playerindex over : 3"); } self.mJoinPlayerParam.playerID = myPlayer.playerID; self.mJoinPlayerParam.playerIndex = num; self.mJoinPlayerParam.UpdateMultiTowerPlacement(true); instance.SetMyPlayerParam(self.mJoinPlayerParam.Serialize()); instance.MyPlayerIndex = num; self.Success(); break; } } } } }