private void Update() { MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance; if (this.mIgnore) { return; } if (instance.CurrentState != MyPhoton.MyState.ROOM) { if (instance.CurrentState != MyPhoton.MyState.NOP) { instance.Disconnect(); } this.ActivateOutputLinks(1); } else { List <MyPhoton.MyPlayer> roomPlayerList = instance.GetRoomPlayerList(); bool flag1 = GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.RAID; bool flag2 = GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.VERSUS && GlobalVars.SelectedMultiPlayVersusType == VERSUS_TYPE.Friend; if (roomPlayerList.Find((Predicate <MyPhoton.MyPlayer>)(p => p.playerID == 1)) == null && (flag1 || flag2)) { this.ActivateOutputLinks(7); } else { MyPhoton.MyRoom currentRoom = instance.GetCurrentRoom(); if (instance.IsUpdateRoomProperty) { if (currentRoom.start) { this.ActivateOutputLinks(5); return; } instance.IsUpdateRoomProperty = false; } JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(currentRoom.json); string str = myPhotonRoomParam != null ? myPhotonRoomParam.comment : string.Empty; if (!this.mRoomComment.Equals(str)) { DebugUtility.Log("change room comment"); this.ActivateOutputLinks(6); } this.mRoomComment = str; bool flag3 = false; if (roomPlayerList == null) { instance.Disconnect(); } else if (this.mPlayers == null) { flag3 = true; } else if (this.mPlayers.Count != roomPlayerList.Count) { flag3 = true; } else { for (int index = 0; index < this.mPlayers.Count; ++index) { if (this.mPlayers[index].playerID != roomPlayerList[index].playerID) { flag3 = true; break; } if (!this.mPlayers[index].json.Equals(roomPlayerList[index].json)) { flag3 = true; break; } } } if (!string.IsNullOrEmpty(this.mQuestName) && !this.mQuestName.Equals(myPhotonRoomParam.iname)) { DebugUtility.Log("change quest iname" + myPhotonRoomParam.iname); this.ActivateOutputLinks(10); } this.mQuestName = myPhotonRoomParam.iname; if (flag3) { this.mPlayers = new List <MyPhoton.MyPlayer>((IEnumerable <MyPhoton.MyPlayer>)roomPlayerList); this.ActivateOutputLinks(2); if (instance.IsOldestPlayer()) { JSON_MyPhotonPlayerParam[] photonPlayerParamArray = new JSON_MyPhotonPlayerParam[roomPlayerList.Count]; for (int index = 0; index < photonPlayerParamArray.Length; ++index) { photonPlayerParamArray[index] = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index].json); } myPhotonRoomParam.players = photonPlayerParamArray; instance.SetRoomParam(myPhotonRoomParam.Serialize()); } bool flag4 = true; using (List <MyPhoton.MyPlayer> .Enumerator enumerator = this.mPlayers.GetEnumerator()) { while (enumerator.MoveNext()) { JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(enumerator.Current.json); if (photonPlayerParam.state == 0 || photonPlayerParam.state == 4) { flag4 = false; break; } } } if (flag4) { this.ActivateOutputLinks(3); } else { this.ActivateOutputLinks(4); } } else { int count = instance.GetRoomPlayerList().Count; if (count == 1 && this.mMemberCnt != count) { this.ActivateOutputLinks(9); } this.mMemberCnt = instance.GetRoomPlayerList().Count; if (this.mIgnoreFullMember || instance.GetCurrentRoom().maxPlayers != count) { return; } this.ActivateOutputLinks(8); } } } }
public override void OnActivate(int pinID) { switch (pinID) { case 100: MyPhoton.MyPlayer myPlayer1 = PunMonoSingleton <MyPhoton> .Instance.GetMyPlayer(); JSON_MyPhotonPlayerParam photonPlayerParam1 = myPlayer1 != null?JSON_MyPhotonPlayerParam.Parse(myPlayer1.json) : (JSON_MyPhotonPlayerParam)null; if (photonPlayerParam1 != null && photonPlayerParam1.state != 0 && photonPlayerParam1.state != 4) { this.ActivateOutputLinks(1); break; } this.ActivateOutputLinks(2); break; case 101: List <MyPhoton.MyPlayer> roomPlayerList1 = PunMonoSingleton <MyPhoton> .Instance.GetRoomPlayerList(); if (roomPlayerList1 != null) { using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList1.GetEnumerator()) { while (enumerator.MoveNext()) { MyPhoton.MyPlayer current = enumerator.Current; JSON_MyPhotonPlayerParam photonPlayerParam2 = current != null?JSON_MyPhotonPlayerParam.Parse(current.json) : (JSON_MyPhotonPlayerParam)null; if (photonPlayerParam2 == null || photonPlayerParam2.state == 0 || photonPlayerParam2.state == 4) { this.ActivateOutputLinks(2); return; } } } } this.ActivateOutputLinks(1); break; case 102: MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance; List <MyPhoton.MyPlayer> roomPlayerList2 = instance.GetRoomPlayerList(); MyPhoton.MyPlayer myPlayer2 = instance.GetMyPlayer(); if (roomPlayerList2 != null && myPlayer2 != null) { using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList2.GetEnumerator()) { while (enumerator.MoveNext()) { MyPhoton.MyPlayer current = enumerator.Current; if (current.playerID != myPlayer2.playerID) { JSON_MyPhotonPlayerParam photonPlayerParam2 = current != null?JSON_MyPhotonPlayerParam.Parse(current.json) : (JSON_MyPhotonPlayerParam)null; if (photonPlayerParam2 == null || photonPlayerParam2.state == 0 || photonPlayerParam2.state == 4) { this.ActivateOutputLinks(2); return; } } } } } this.ActivateOutputLinks(1); break; case 200: MyPhoton.MyRoom currentRoom = PunMonoSingleton <MyPhoton> .Instance.GetCurrentRoom(); if (currentRoom == null || currentRoom.playerCount < currentRoom.maxPlayers) { this.ActivateOutputLinks(2); break; } this.ActivateOutputLinks(1); break; case 300: if (string.IsNullOrEmpty(GlobalVars.SelectedQuestID)) { this.ActivateOutputLinks(2); } QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID); PlayerData player = MonoSingleton <GameManager> .Instance.Player; if (quest != null && player != null) { if (player.Stamina >= quest.RequiredApWithPlayerLv(player.Lv, true)) { this.ActivateOutputLinks(1); break; } MonoSingleton <GameManager> .Instance.StartBuyStaminaSequence(true); this.ActivateOutputLinks(2); break; } this.ActivateOutputLinks(2); break; } }