Exemplo n.º 1
0
 void OnApplicationQuit()
 {
     // be a good matchmaking citizen and leave any queue immediately
     Matchmaking.Cancel();
     if (m_matchRoom != 0)
     {
         Rooms.Leave(m_matchRoom);
     }
 }
Exemplo n.º 2
0
    void RetryUntilConnectedToServer()
    {
        Matchmaking.Cancel();
        DisconnectFromServer();
        if (isConnected)
        {
            return;
        }

        Debug.Log("Retrying in " + RetryTime + " seconds...");
        timeRetryStarted = renderTime;
        state            = WaitingForRetry;
    }
Exemplo n.º 3
0
    protected override void OnQuit()
    {
        Matchmaking.Cancel();

        if (IsConnectedToServer())
        {
            DisconnectFromServer();
        }

        if (roomId == 0)
        {
            isReadyToShutdown = true;
        }
        else
        {
            LeaveRoom(roomId, LeaveRoomOnQuitCallback);
        }
    }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
 public void LeaveQueue()
 {
     Matchmaking.Cancel();
     EndMatch();
 }