예제 #1
0
        void requestStartRatedMatch()
        {
            switch (currentState)
            {
            case states.NOT_INIT:
                printOutputLine("The app has not initialized properly and we don't know your userID.");
                break;

            case states.IDLE:
            case states.REQUEST_FIND:
            case states.FINDING_ROOM:
            case states.REQUEST_JOIN:
            case states.REQUEST_CREATE:
            case states.REQUEST_LEAVE:
            case states.IN_EMPTY_ROOM:
                printOutputLine("You need to be in a room with another player to start a rated match.");
                break;

            case states.IN_FULL_ROOM:
                printOutputLine("Trying to start a rated match.  This call should be made once a rated match begins so we will be able to submit results after the game is done.");

                Matchmaking.StartMatch(currentRoom.ID).OnComplete(startRatedMatchResponse);
                break;

            default:
                printOutputLine("You have hit an unknown state.");
                break;
            }
        }
예제 #2
0
        private void ProcessRoomData(Room room)
        {
            m_lastUpdateTime = Time.time;

            if (m_state == MatchRoomState.Configuring)
            {
                // get the User info for the other player
                if (room.UsersOptional != null)
                {
                    foreach (var user in room.UsersOptional)
                    {
                        if (PlatformManager.MyID != user.ID)
                        {
                            Debug.Log("Found remote user: "******"")
            {
                // process remote move
                ProcessRemoteMove(room.DataStore[m_remotePlayer.OculusID]);
                TransitionToState(MatchRoomState.MyTurn);
            }

            // If the room ownership transferred to me, we can mark the remote turn complete.
            // We don't do this when the remote move comes in if we aren't yet the owner because
            // the local user will not be able to write to the datastore if they aren't the
            // owner of the room.
            if (m_state == MatchRoomState.MyTurn && room.OwnerOptional != null && room.OwnerOptional.ID == PlatformManager.MyID)
            {
                m_gameController.MarkRemoteTurnComplete();
            }

            if (room.UsersOptional == null || (room.UsersOptional != null && room.UsersOptional.Count != 2))
            {
                Debug.Log("Other user quit the room");
                m_gameController.RemoteMatchEnded();
            }
        }