SWLobbyFilterData Class
Namespace: SWNetwork.Lobby
The filter data object.

Declaration

public class SWLobbyFilterData
Methods
Description
AddFilter(string, string)
Adds a string typed index filter with the specified name, and value.
AddFilter(string, int, int)
Adds a int typed index filter with the specified name, minimum value, and maximum value.

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);
}
});
Copy link
On this page
Example