private void UpdatePhotonMessage() { MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance; if (UnityEngine.Object.op_Equality((UnityEngine.Object)instance, (UnityEngine.Object)null)) { return; } List <MyPhoton.MyEvent> events = instance.GetEvents(); if (events == null) { return; } while (events.Count > 0) { MyPhoton.MyEvent myEvent = events[0]; events.RemoveAt(0); if (myEvent.code == MyPhoton.SEND_TYPE.Normal && myEvent.binary != null) { VersusDraftReady.VersusReadyMessageData buffer = (VersusDraftReady.VersusReadyMessageData)null; if (GameUtility.Binary2Object <VersusDraftReady.VersusReadyMessageData>(out buffer, myEvent.binary) && buffer != null) { this.mMessageDataList.Add(buffer); } } } }
private void UpdatePhotonMessage() { MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance; if (UnityEngine.Object.op_Equality((UnityEngine.Object)instance, (UnityEngine.Object)null)) { return; } List <MyPhoton.MyEvent> events = instance.GetEvents(); if (events == null) { return; } while (events.Count > 0) { MyPhoton.MyEvent myEvent = events[0]; events.RemoveAt(0); if (myEvent.code == MyPhoton.SEND_TYPE.Normal && myEvent.binary != null) { VersusDraftList.VersusDraftMessageData buffer = (VersusDraftList.VersusDraftMessageData)null; if (GameUtility.Binary2Object <VersusDraftList.VersusDraftMessageData>(out buffer, myEvent.binary) && buffer != null) { switch (buffer.h) { case 1: VersusDraftUnit.ResetSelectUnit(); if (buffer.uidx0 >= 0 && this.mVersusDraftUnitList.Count > buffer.uidx0) { this.mVersusDraftUnitList[buffer.uidx0].SelectUnit(false); } if (buffer.uidx1 >= 0 && this.mVersusDraftUnitList.Count > buffer.uidx1) { this.mVersusDraftUnitList[buffer.uidx1].SelectUnit(false); } if (buffer.uidx2 >= 0 && this.mVersusDraftUnitList.Count > buffer.uidx2) { this.mVersusDraftUnitList[buffer.uidx2].SelectUnit(false); continue; } continue; case 2: if (buffer.uidx0 >= 0 && this.mVersusDraftUnitList.Count > buffer.uidx0) { this.mVersusDraftUnitList[buffer.uidx0].DecideUnit(false); ++this.mEnemyUnitIndex; } if (buffer.uidx1 >= 0 && this.mVersusDraftUnitList.Count > buffer.uidx1) { this.mVersusDraftUnitList[buffer.uidx1].DecideUnit(false); ++this.mEnemyUnitIndex; } if (buffer.uidx2 >= 0 && this.mVersusDraftUnitList.Count > buffer.uidx2) { this.mVersusDraftUnitList[buffer.uidx2].DecideUnit(false); ++this.mEnemyUnitIndex; continue; } continue; case 3: if (!this.ChangeTurn(true)) { for (int index = 0; index < this.SELECTABLE_UNIT_COUNT_OF_TURN[this.mTurn]; ++index) { this.mVersusDraftSelectedUnit[this.mSelectingUnitIndex + index].Selecting(); } continue; } continue; default: continue; } } } } }
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) { 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; } } } } } } }