PlayerIO

The fastest way to build online games without breaking a sweat.

Multiplayer Reference

Multiplayer  class documentationClass BasePlayer

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

The base class you inherit from for your Player class.

Properties

 
public Achievements
Achievements  [read-only]

The Achievements object of the connected player

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 GameRequests
GameRequests  [read-only]

The GameRequests object of the connected player

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 Leaderboards
Leaderboards  [read-only]

The Leaderboards object of the connected player

public Notifications
Notifications  [read-only]

The Notifications object of the connected player

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 PlayerInsight
PlayerInsight  [read-only]

The PlayerInsight object of the connected player

public DatabaseObject
PlayerObject  [read-only]

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

public PublishingNetwork
PublishingNetwork  [read-only]

The PlayerIO Publishing Network object of the connected player

public Yahoo
Yahoo  [read-only]

DEPRECATED

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 (string type, params object[] parameters)

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

public void
Send (Message message)

Send a message to the connected client

BasePlayer.Achievements

public Achievements
Achievements  [read-only]

The Achievements object of the connected player

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

public GameRequests
GameRequests  [read-only]

The GameRequests object of the connected player

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

public Leaderboards
Leaderboards  [read-only]

The Leaderboards object of the connected player

BasePlayer.Notifications

public Notifications
Notifications  [read-only]

The Notifications object of the connected player

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

public PlayerInsight
PlayerInsight  [read-only]

The PlayerInsight object 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.PublishingNetwork

public PublishingNetwork
PublishingNetwork  [read-only]

The PlayerIO Publishing Network object of the connected player

BasePlayer.Yahoo

public Yahoo
Yahoo  [read-only]

DEPRECATED

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

BasePlayer.Send

public void
Send (Message message)

Send a message to the connected client

Arguments

Message message
The message to send