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

Extra data for a match. Holds one string, float, double, int, or long. More...

Inherited by MatchFilter.

Public Types

enum  ValueType { STRING, INT, FLOAT }
 The type of the value stored by this MatchData More...
 

Public Member Functions

 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 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

ValueType valueType
 The type of the value stored by this MatchData More...
 

Properties

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

Extra data for a match. Holds one string, float, double, int, or long.

You can add as many MatchData entries as you want for match. MatchData can be set by the host when creating a match or any time afterwards. MatchData is received on clients when they GetMatchList (unless you pass in false for includeMatchData) and when they JoinMatch(). MatchData can not be requested except by listing matches or joining a match. You can use MatchFilter to filter the results of GetMatchList() based on a Match's MatchData. For example, the server might create a match with MatchData eloScore = 100 <verbatim> Clients could then use MatchFilter to search for matches with eloScore < 150 and > 50 </verbatim>

Member Enumeration Documentation

◆ ValueType

enum ValueType
strong

The type of the value stored by this MatchData

Constructor & Destructor Documentation

◆ MatchData() [1/8]

MatchData ( string  value,
ValueType  valueType 
)

Create a new instance of matchData with a specific ValueType.

Parameters
valueThe value as a string
valueTypeThe ValueType to store the value as

◆ MatchData() [2/8]

MatchData ( double  value)

Create a new instance of matchData that stores a double

Parameters
valueThe value

◆ MatchData() [3/8]

MatchData ( float  value)

Create a new instance of matchData that stores a float

Parameters
valueThe value

◆ MatchData() [4/8]

MatchData ( int  value)

Create a new instance of matchData that stores an int

Parameters
valueThe value

◆ MatchData() [5/8]

MatchData ( uint  value)

Create a new instance of matchData that stores an unsigned int

Parameters
valueThe value

◆ MatchData() [6/8]

MatchData ( long  value)

Create a new instance of matchData that stores a long

Parameters
valueThe value

◆ MatchData() [7/8]

MatchData ( ulong  value)

Create a new instance of matchData that stores a ulong

Parameters
valueThe value

◆ MatchData() [8/8]

MatchData ( string  value)

Create a new instance of matchData that stores a string

Parameters
valueThe value

Member Function Documentation

◆ operator double()

static implicit operator double ( MatchData  matchData)
static

Implicitly converts a MatchData object to a double

These operators make accessing MatchData a little easier. So you can do things like: double eloScore = matchData["eloScore"]; instead of: double eloScore = matchData["eloScore"].doubleValue;

Parameters
value

◆ operator float()

static implicit operator float ( MatchData  matchData)
static

Implicitly converts a MatchData object to a float

These operators make accessing MatchData a little easier. So you can do things like: double eloScore = matchData["eloScore"]; instead of: double eloScore = matchData["eloScore"].doubleValue;

Parameters
value

◆ operator int()

static implicit operator int ( MatchData  matchData)
static

Implicitly converts a MatchData object to an int

These operators make accessing MatchData a little easier. So you can do things like: int eloScore = matchData["eloScore"]; instead of: int eloScore = matchData["eloScore"].intValue;

Parameters
value

◆ operator long()

static implicit operator long ( MatchData  matchData)
static

Implicitly converts a MatchData object to a long

These operators make accessing MatchData a little easier. So you can do things like: int eloScore = matchData["eloScore"]; instead of: int eloScore = matchData["eloScore"].intValue;

Parameters
value

◆ operator MatchData() [1/7]

static implicit operator MatchData ( int  value)
static

Implicitly converts an int to a MatchData object.

These operators make storing MatchData a little easier. So you can do things like:

var matchData = new Dictionary<string, MatchData>( { "eloScore", 200 } );

instead of:

var matchData = new Dictionary<string, MatchData>( { "eloScore", new MatchData(200) } );
Parameters
value

◆ operator MatchData() [2/7]

static implicit operator MatchData ( uint  value)
static

Implicitly converts an unsigned int to a MatchData object.

These operators make storing MatchData a little easier. So you can do things like:

var matchData = new Dictionary<string, MatchData>( { "eloScore", 200 } );

instead of:

var matchData = new Dictionary<string, MatchData>( { "eloScore", new MatchData(200) } );
Parameters
value

◆ operator MatchData() [3/7]

static implicit operator MatchData ( long  value)
static

Implicitly converts a long to a MatchData object.

These operators make storing MatchData a little easier. So you can do things like:

var matchData = new Dictionary<string, MatchData>( { "eloScore", 200 } );

instead of:

var matchData = new Dictionary<string, MatchData>( { "eloScore", new MatchData(200) } );
Parameters
value

◆ operator MatchData() [4/7]

static implicit operator MatchData ( ulong  value)
static

Implicitly converts an unsigned long to a MatchData object.

These operators make storing MatchData a little easier. So you can do things like:

var matchData = new Dictionary<string, MatchData>( { "eloScore", 200 } );

instead of:

var matchData = new Dictionary<string, MatchData>( { "eloScore", new MatchData(200) } );
Parameters
value

◆ operator MatchData() [5/7]

static implicit operator MatchData ( double  value)
static

Implicitly converts a double to a MatchData object.

These operators make storing MatchData a little easier. So you can do things like:

var matchData = new Dictionary<string, MatchData>( { "eloScore", 200.0 } );

instead of:

var matchData = new Dictionary<string, MatchData>( { "eloScore", new MatchData(200.0) } );
Parameters
value

◆ operator MatchData() [6/7]

static implicit operator MatchData ( float  value)
static

Implicitly converts a float to a MatchData object.

These operators make storing MatchData a little easier. So you can do things like:

var matchData = new Dictionary<string, MatchData>( { "eloScore", 200.0f } );

instead of:

var matchData = new Dictionary<string, MatchData>( { "eloScore", new MatchData(200.0f) } );
Parameters
value

◆ operator MatchData() [7/7]

static implicit operator MatchData ( string  value)
static

Implicitly converts a string to a MatchData object.

These operators make storing MatchData a little easier. So you can do things like:

var matchData = new Dictionary<string, MatchData>( { "password", "hunter5"} );

instead of:

var matchData = new Dictionary<string, MatchData>( { "password", new MatchData("hunter5") } );
Parameters
value

◆ operator string()

static implicit operator string ( MatchData  matchData)
static

Implicitly converts a MatchData object to a string

These operators make accessing MatchData a little easier. So you can do things like: string password = matchData["password"]; instead of: string password = matchData["password"].stringValue;

Parameters
value

◆ operator uint()

static implicit operator uint ( MatchData  matchData)
static

Implicitly converts a MatchData object to an unsigned int

These operators make accessing MatchData a little easier. So you can do things like: int eloScore = matchData["eloScore"]; instead of: int eloScore = matchData["eloScore"].intValue;

Parameters
value

◆ operator ulong()

static implicit operator ulong ( MatchData  matchData)
static

Implicitly converts a MatchData object to an unsigned long

These operators make accessing MatchData a little easier. So you can do things like: int eloScore = matchData["eloScore"]; instead of: int eloScore = matchData["eloScore"].intValue;

Parameters
value

◆ Serialize()

virtual string Serialize ( string  key)
virtual

Serialize the match data for sending to the matchmaking server.

Returns
A string representing the MatchData

◆ SerializeDict()

static string SerializeDict ( Dictionary< string, MatchData data)
static

Converts an entire Dictionary of MatchData into a string for sending to the matchmaking server.

Parameters
dataThe dictionary of MatchData to serialize
Returns
A string represenation of all of the data.

Member Data Documentation

◆ valueType

ValueType valueType

The type of the value stored by this MatchData

Property Documentation

◆ doubleValue

double doubleValue
get

Get the value as a double

◆ floatValue

float floatValue
get

Get the value as a float

◆ intValue

int intValue
get

Get the value as an int

◆ longValue

long longValue
get

Get the value as a long

◆ stringValue

string stringValue
get

Get the value as a string

◆ uintValue

uint uintValue
get

Get the value as an unsigned int

◆ ulongValue

ulong ulongValue
get

Get the value as an unsigned long