Ejemplo n.º 1
0
        void requestFindFilteredRoom()
        {
            switch (currentState)
            {
            case states.NOT_INIT:
                printOutputLine("The app has not initialized properly and we don't know your userID.");
                break;

            case states.IDLE:
                printOutputLine("Trying to find a matchmaking room");

                // Our search filter criterion
                //
                // We're filtering using two different queries setup on the developer portal
                //
                // map - query to filter by map.  The query allows you to filter with up to two different maps using keys called 'map_1' and 'map_2'
                // game_type - query to filter by game type.  The query allows you to filter with up to two different game types using keys called 'type_1' and 'type_2'
                //
                // In the example below we are filtering for matches that are of type CTF and on either Big_Map or Really_Big_Map.
                //

                Matchmaking.CustomQuery             roomCustomQuery = new Matchmaking.CustomQuery();
                Matchmaking.CustomQuery.Criterion[] queries         = new Matchmaking.CustomQuery.Criterion[2];

                queries[0].key        = "map";
                queries[0].importance = MatchmakingCriterionImportance.Required;
                queries[0].parameters = new Dictionary <string, object>();
                queries[0].parameters.Add("map_param_1", "Really_Big_Map");
                queries[0].parameters.Add("map_param_2", "Big_Map");

                queries[1].key        = "game_type";
                queries[1].importance = MatchmakingCriterionImportance.Required;
                queries[1].parameters = new Dictionary <string, object>();
                queries[1].parameters.Add("game_type_param", "CTF");

                roomCustomQuery.criteria = queries;
                roomCustomQuery.data     = null;

                Matchmaking.Enqueue(Constants.FILTER_POOL, roomCustomQuery);
                currentState = states.REQUEST_FIND;
                break;

            case states.REQUEST_FIND:
                printOutputLine("You have already made a request to find a room.  Please wait for that request to complete.");
                break;

            case states.FINDING_ROOM:
                printOutputLine("You have already currently looking for a room.  Please wait for the match to be made.");
                break;

            case states.REQUEST_JOIN:
                printOutputLine("We are currently trying to join a room.  Please wait to see if we can join it.");
                break;

            case states.REQUEST_LEAVE:
                printOutputLine("We are currently trying to leave a room.  Please wait to see if we can leave it.");
                break;

            case states.REQUEST_CREATE:
                printOutputLine("You have already requested a matchmaking room to be created.  Please wait for the room to be made.");
                break;

            case states.IN_EMPTY_ROOM:
                printOutputLine("You have already in a matchmaking room.  Please wait for an opponent to join.");
                break;

            case states.IN_FULL_ROOM:
                printOutputLine("You have already in a match.");
                break;

            default:
                printOutputLine("You have hit an unknown state.");
                break;
            }
        }
Ejemplo n.º 2
0
        void requestCreateFilterRoom()
        {
            switch (currentState)
            {
            case states.NOT_INIT:
                printOutputLine("The app has not initialized properly and we don't know your userID.\n");
                break;

            case states.IDLE:
                printOutputLine("Trying to create a matchmaking room");

                // We're going to create a room that has the following values set:
                // game_type_name = "CTF"
                // map_name = "Really_Big_Map"
                //

                Matchmaking.CustomQuery roomCustomQuery = new Matchmaking.CustomQuery();

                roomCustomQuery.criteria = null;
                roomCustomQuery.data     = new Dictionary <string, object>();

                roomCustomQuery.data.Add("game_type_name", "CTF");
                roomCustomQuery.data.Add("map_name", "Really_Big_Map");

                Matchmaking.CreateAndEnqueueRoom(Constants.FILTER_POOL, 8, true, roomCustomQuery).OnComplete(createRoomResponse);
                currentState = states.REQUEST_CREATE;
                break;

            case states.REQUEST_FIND:
                printOutputLine("You have already made a request to find a room.  Please wait for that request to complete.\n");
                break;

            case states.FINDING_ROOM:
                printOutputLine("You have already currently looking for a room.  Please wait for the match to be made.\n");
                break;

            case states.REQUEST_JOIN:
                printOutputLine("We are currently trying to join a room.  Please wait to see if we can join it.\n");
                break;

            case states.REQUEST_LEAVE:
                printOutputLine("We are currently trying to leave a room.  Please wait to see if we can leave it.\n");
                break;

            case states.REQUEST_CREATE:
                printOutputLine("You have already requested a matchmaking room to be created.  Please wait for the room to be made.\n");
                break;

            case states.IN_EMPTY_ROOM:
                printOutputLine("You have already in a matchmaking room.  Please wait for an opponent to join.\n");
                break;

            case states.IN_FULL_ROOM:
                printOutputLine("You have already in a match.\n");
                break;

            default:
                printOutputLine("You have hit an unknown state.\n");
                break;
            }
        }