Player.IO

Build fun, powerful & scalable online and mobile games with the reliable backend your users expect

Sign Up | Sign In

Multiplayer Reference

Multiplayer  class documentationClass BasePlayer

Namespace: PlayerIO.GameLibrary
Language: C# / .NET

The base class you inherit from for your Player class.

Properties

 
public IConnection
Connection  [read-only]

For internal usage

public string
ConnectUserId  [read-only]

The UserId that was originally used when the client called PlayerIO.Connect(...)

public int
Id  [read-only]

Every time a client connects, an Id is assigned that uniquely identifies them in the room as long as they remain connected.

public IPAddress
IPAddress  [read-only]

The ip address the player is connected from

public Dictionary<string, string>
JoinData  [read-only]

The data supplied by the client when the room was joined. That is, when the JoinRoom(...) or CreateJoinRoom(...) methods were called.

public PartnerPay
PartnerPay  [read-only]

The PartnerPay object of the connected player

public PayVault
PayVault  [read-only]

The PayVault vault of the connected player

public DatabaseObject
PlayerObject  [read-only]

The PlayerObject of the connected player in the "PlayerObjects" BigDB table.

Methods

 
public void
Disconnect ()

Disconnects the client from the room.

public virtual Dictionary<string, string>
GetDebugValues ()

Override this method to provide custom debug data for the playerlist in the development server.

public void
GetPlayerObject (Callback<DatabaseObject> callback)

Gets the PlayerObject (from the BigDB PlayerObjects table) for the connected player. The object is loaded from BigDB on first load, then reused for subsequent GetPlayerObject requests, which means that subsequent calls to GetPlayerObjects will call the callback instantly.

public void
RefreshPlayerObject (Callback callback)

Reloads the PlayerObject from the BigDB PlayerObjects table

public void
Send (Message message)

Send a message to the connected client

public void
Send (string type, params object[] parameters)

Send a message to the connected client without first having to construct a Message object.

BasePlayer.Connection

public IConnection
Connection  [read-only]

For internal usage

BasePlayer.ConnectUserId

public string
ConnectUserId  [read-only]

The UserId that was originally used when the client called PlayerIO.Connect(...)

BasePlayer.Id

public int
Id  [read-only]

Every time a client connects, an Id is assigned that uniquely identifies them in the room as long as they remain connected.

BasePlayer.IPAddress

public IPAddress
IPAddress  [read-only]

The ip address the player is connected from

BasePlayer.JoinData

public Dictionary<string, string>
JoinData  [read-only]

The data supplied by the client when the room was joined. That is, when the JoinRoom(...) or CreateJoinRoom(...) methods were called.

BasePlayer.PartnerPay

public PartnerPay
PartnerPay  [read-only]

The PartnerPay object of the connected player

BasePlayer.PayVault

public PayVault
PayVault  [read-only]

The PayVault vault of the connected player

BasePlayer.PlayerObject

public DatabaseObject
PlayerObject  [read-only]

The PlayerObject of the connected player in the "PlayerObjects" BigDB table.

This object is loaded via the GetPlayerObject() method or automatically when a player joins the game if the Game.PreloadPlayerObjects property is set to true.

BasePlayer.Disconnect

public void
Disconnect ()

Disconnects the client from the room.

BasePlayer.GetDebugValues

public virtual Dictionary<string, string>
GetDebugValues ()

Override this method to provide custom debug data for the playerlist in the development server.

Each key-value pair is displayed in the playerlist as a column value, instead of the default one-column-per-property.

Example

This is how you'd override the method and provide two values for each player, that will show up in the development server.

BasePlayer.GetPlayerObject

public void
GetPlayerObject (Callback<DatabaseObject> callback)

Gets the PlayerObject (from the BigDB PlayerObjects table) for the connected player. The object is loaded from BigDB on first load, then reused for subsequent GetPlayerObject requests, which means that subsequent calls to GetPlayerObjects will call the callback instantly.

Arguments

Callback<DatabaseObject> callback
A callback that will be called with the loaded PlayerObject

BasePlayer.RefreshPlayerObject

public void
RefreshPlayerObject (Callback callback)

Reloads the PlayerObject from the BigDB PlayerObjects table

Arguments

Callback callback
A callback that will be called when the new playerobject is loaded.

BasePlayer.Send

public void
Send (Message message)

Send a message to the connected client

Arguments

Message message
The message to send

BasePlayer.Send

public void
Send (string type, params object[] parameters)

Send a message to the connected client without first having to construct a Message object.

Arguments

string type
The type of message to send
params object[] parameters
The data to put in the message to send