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

Declaration

1
public class SWLobbyFilterData
Copied!
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

1
// Creating a new indexData object
2
SWLobbyIndexData indexData = new SWLobbyIndexData();
3
4
// Adding a string typed index
5
// with name equals to "level" and
6
// value equals to "hard"
7
indexData.AddIndex("level", "hard");
8
9
// Adding a int typed index
10
// with name equals to "rank" and
11
// value equals to 50
12
indexData.AddIndex("rank", 50);
13
14
// Using the indexData to create room
15
NetworkClient.Lobby.CreateRoom("new room", true, 4, indexData, (successful, reply, error) =>
16
{
17
if (successful)
18
{
19
Debug.Log("Room created " + reply);
20
}
21
else
22
{
23
Debug.Log("Failed to create room " + error);
24
}
25
});
Copied!
1
// Creating a new filterData object
2
SWLobbyFilterData filterData = new SWLobbyFilterData();
3
4
// Adding a string typed filter
5
// with name equals to "level" and
6
// value equals to "hard"
7
filterData.AddFilter("level", "hard");
8
9
// Adding a int typed index
10
// with name equals to "rank" and
11
// value between 1 to 100
12
filterData.AddFilter("rank", 1, 100);
13
14
// Using the filterData to filter rooms
15
// 10 is the max number of return rooms
16
NetworkClient.Lobby.FilterRoom(filterData, 10, (okay, reply, error) =>
17
{
18
if (okay)
19
{
20
Debug.Log("Filtered rooms " + reply);
21
}
22
else
23
{
24
Debug.Log("Failed to Filtered rooms " + error);
25
}
26
});
Copied!
Last modified 2yr ago
Copy link
Contents
Example