Filter Rooms

Overview

Filters the public rooms of your game in the Lobby server.

Methods

FilterRoom(SWLobbyFilterData, byte, Action<bool, SWGetRoomFilterReply, SWLobbyError>)

Called by players to begin an asynchronous operation to filter rooms in the Lobby server using the specified filterData and count.

Class

The filter data object.

The response object when the operation finished successfully.

The error that occurred when a lobby API operation failed.

Maximum number of indexes of a room is 3.

Maximum page row count is 15.

Example

// Creating a new indexData object
SWLobbyIndexData indexData = new SWLobbyIndexData();

// Adding a string typed index
// with name equals to "level" and 
// value equals to "hard"
indexData.AddIndex("level", "hard");

// Adding a int typed index
// with name equals to "rank" and
// value equals to 50
indexData.AddIndex("rank", 50);

// Using the indexData to create room
NetworkClient.Lobby.CreateRoom("new room", true, 4, indexData, (successful, reply, error) =>{
    if (successful){
        Debug.Log("Room created " + reply);
    }
    else{
        Debug.Log("Failed to create room " + error);
    }
});
// Creating a new filterData object
SWLobbyFilterData filterData = new SWLobbyFilterData();

// Adding a string typed filter
// with name equals to "level" and
// value equals to "hard"
filterData.AddFilter("level", "hard");

// Adding a int typed index
// with name equals to "rank" and
// value between 1 to 100
filterData.AddFilter("rank", 1, 100);

// Using the filterData to filter rooms
// 10 is the max number of return rooms
NetworkClient.Lobby.FilterRoom(filterData, 10, (okay, reply, error) =>{
    if (okay){
        Debug.Log("Filtered rooms " + reply);
    }
    else{
        Debug.Log("Failed to Filtered rooms " + error);
    }
});

Last updated