void StartMatchmaking() { var options = new MatchmakingOptions(); options.SetEnqueueQueryKey("quickmatch_query"); options.SetCreateRoomJoinPolicy(RoomJoinPolicy.Everyone); options.SetCreateRoomMaxUsers(MaxClients); options.SetEnqueueDataSettings("version", Constants.Version.GetHashCode()); Matchmaking.Enqueue2("quickmatch", options).OnComplete(MatchmakingEnqueueCallback); timeMatchmakingStarted = renderTime; state = InMatchmaking; }
private void TransitionToState(MatchRoomState state) { var m_oldState = m_state; m_state = state; switch (m_state) { case MatchRoomState.None: m_matchButtonText.text = "Find Match"; // the player can abort from any of the other states to the None state // so we need to be careful to clean up all state variables m_remotePlayer = null; Matchmaking.Cancel(); if (m_matchRoom != 0) { Rooms.Leave(m_matchRoom); m_matchRoom = 0; } break; case MatchRoomState.Queued: Assert.AreEqual(MatchRoomState.None, m_oldState); m_matchButtonText.text = "Leave Queue"; Matchmaking.Enqueue2(POOL).OnComplete(MatchmakingEnqueueCallback); break; case MatchRoomState.Configuring: Assert.AreEqual(MatchRoomState.Queued, m_oldState); m_matchButtonText.text = "Cancel Match"; break; case MatchRoomState.MyTurn: case MatchRoomState.RemoteTurn: Assert.AreNotEqual(MatchRoomState.None, m_oldState); Assert.AreNotEqual(MatchRoomState.Queued, m_oldState); m_matchButtonText.text = "Cancel Match"; break; } }