Match Up
Provides simple drop-in matchmaking support for any networking system.
MatchFilter Class Reference

Defines a filter to use when retrieving matches via GetMatchList() More...

Inherits MatchData.

Public Types

enum  OperationType {
  EQUALS, NOT_EQUALS, LIKE, NOT_LIKE,
  LESS, GREATER
}
 Supported filter operations are EQUAL, NOT_EQUAL, LIKE, NOT_LIKE, LESS, and GREATER More...
 
- Public Types inherited from MatchData
enum  ValueType { STRING, INT, FLOAT }
 The type of the value stored by this MatchData More...
 

Public Member Functions

 MatchFilter (string key, double value, OperationType operation=OperationType.EQUALS)
 Create a float or double filter. More...
 
 MatchFilter (string key, long value, OperationType operation=OperationType.EQUALS)
 Create a int or long filter. More...
 
 MatchFilter (string key, string value, OperationType operation=OperationType.EQUALS)
 Create a string filter. More...
 
string Serialize ()
 Convert this Filter to a string for sending to the matchmaking server. More...
 
- Public Member Functions inherited from MatchData
 MatchData (string value, ValueType valueType)
 Create a new instance of matchData with a specific ValueType. More...
 
 MatchData (double value)
 Create a new instance of matchData that stores a double More...
 
 MatchData (float value)
 Create a new instance of matchData that stores a float More...
 
 MatchData (int value)
 Create a new instance of matchData that stores an int More...
 
 MatchData (uint value)
 Create a new instance of matchData that stores an unsigned int More...
 
 MatchData (long value)
 Create a new instance of matchData that stores a long More...
 
 MatchData (ulong value)
 Create a new instance of matchData that stores a ulong More...
 
 MatchData (string value)
 Create a new instance of matchData that stores a string More...
 
virtual string Serialize (string key)
 Serialize the match data for sending to the matchmaking server. More...
 
override string ToString ()
 

Static Public Member Functions

static string Serialize (List< MatchFilter > filters)
 Convert a List of MatchFilters to a string for sending to the matchmaking server. More...
 
- Static Public Member Functions inherited from MatchData
static implicit operator double (MatchData matchData)
 Implicitly converts a MatchData object to a double More...
 
static implicit operator float (MatchData matchData)
 Implicitly converts a MatchData object to a float More...
 
static implicit operator int (MatchData matchData)
 Implicitly converts a MatchData object to an int More...
 
static implicit operator long (MatchData matchData)
 Implicitly converts a MatchData object to a long More...
 
static implicit operator MatchData (int value)
 Implicitly converts an int to a MatchData object. More...
 
static implicit operator MatchData (uint value)
 Implicitly converts an unsigned int to a MatchData object. More...
 
static implicit operator MatchData (long value)
 Implicitly converts a long to a MatchData object. More...
 
static implicit operator MatchData (ulong value)
 Implicitly converts an unsigned long to a MatchData object. More...
 
static implicit operator MatchData (double value)
 Implicitly converts a double to a MatchData object. More...
 
static implicit operator MatchData (float value)
 Implicitly converts a float to a MatchData object. More...
 
static implicit operator MatchData (string value)
 Implicitly converts a string to a MatchData object. More...
 
static implicit operator string (MatchData matchData)
 Implicitly converts a MatchData object to a string More...
 
static implicit operator uint (MatchData matchData)
 Implicitly converts a MatchData object to an unsigned int More...
 
static implicit operator ulong (MatchData matchData)
 Implicitly converts a MatchData object to an unsigned long More...
 
static string SerializeDict (Dictionary< string, MatchData > data)
 Converts an entire Dictionary of MatchData into a string for sending to the matchmaking server. More...
 

Public Attributes

string key
 The key whose value will be filtered on. More...
 
OperationType operation
 The OperationType to use when applying this filter. More...
 
- Public Attributes inherited from MatchData
ValueType valueType
 The type of the value stored by this MatchData More...
 

Additional Inherited Members

- Properties inherited from MatchData
double doubleValue [get]
 Get the value as a double More...
 
float floatValue [get]
 Get the value as a float More...
 
int intValue [get]
 Get the value as an int More...
 
long longValue [get]
 Get the value as a long More...
 
string stringValue [get]
 Get the value as a string More...
 
uint uintValue [get]
 Get the value as an unsigned int More...
 
ulong ulongValue [get]
 Get the value as an unsigned long More...
 

Detailed Description

Defines a filter to use when retrieving matches via GetMatchList()

Filter the results of GetMatchList() by passing in a Dictionary of filters like so:

var filters = new List<MatchFilter>() {
new MatchFilter("eloScore", 100, MatchFilter.OperationType.GREATER),
new MatchFilter("eloScore", 300, MatchFilter.OperationType.LESS)
};
matchUp.GetMatchList(OnMatchList, filters);

The above example would retrieve only matches with an eloScore between 100 and 300.

Member Enumeration Documentation

◆ OperationType

enum OperationType
strong

Supported filter operations are EQUAL, NOT_EQUAL, LIKE, NOT_LIKE, LESS, and GREATER

LIKE performs an sql search using a wildcard on both sides of the value. ex: WHERE someKey LIKE "%someValue%" Attempting to use the LIKE operation on a non-string value will result in undefined behaviour (but most likely your filter just won't do anything).

Constructor & Destructor Documentation

◆ MatchFilter() [1/3]

MatchFilter ( string  key,
double  value,
OperationType  operation = OperationType.EQUALS 
)

Create a float or double filter.

Parameters
keyThe key of the MatchData to filter
valueThe value to compare against
operationThe OperationType to use when applying the filter

◆ MatchFilter() [2/3]

MatchFilter ( string  key,
long  value,
OperationType  operation = OperationType.EQUALS 
)

Create a int or long filter.

Parameters
keyThe key of the MatchData to filter
valueThe value to compare against
operationThe OperationType to use when applying the filter

◆ MatchFilter() [3/3]

MatchFilter ( string  key,
string  value,
OperationType  operation = OperationType.EQUALS 
)

Create a string filter.

Parameters
keyThe key of the MatchData to filter
valueThe value to compare against
operationThe OperationType to use when applying the filter

Member Function Documentation

◆ Serialize() [1/2]

string Serialize ( )

Convert this Filter to a string for sending to the matchmaking server.

Returns
A string containing all of the info that the matchmaking server needs to apply the filter.

◆ Serialize() [2/2]

static string Serialize ( List< MatchFilter filters)
static

Convert a List of MatchFilters to a string for sending to the matchmaking server.

Parameters
filtersThe List of MatchFilters to convert
Returns
A string containing all of the info that the matchmaking server needs to apply the filters.

Member Data Documentation

◆ key

string key

The key whose value will be filtered on.

◆ operation

OperationType operation

The OperationType to use when applying this filter.