![]() |
Liberi
An exergame built for kids with CP!
|
Main game server class. More...
Inherits MonoBehaviour.
Public Member Functions | |
| delegate void | ConnectedToWorldServerHandler () |
| delegate void | PlayerJoinedServerHandler (int peerIndex, string playerId, PlayerProfile playerProfile) |
| delegate void | PlayerSyncedHandler (int peerIndex, string playerId, PlayerProfile playerProfile) |
| delegate void | PlayerLeftServerHandler (int peerIndex, string playerId, PlayerProfile playerProfile) |
| delegate void | PlayerJoinedWorldServerHandler (string playerId, string playerNickname) |
| delegate void | PlayerLeftWorldServerHandler (string playerId, string playerNickname) |
| delegate void | WorldDataReceivedHandler (UJeli worldDataPage) |
| delegate void | ServerSpawnedHandler (GameServerType serverType, string mapId, IPEndPoint endPoint) |
| delegate void | ServerSpawnFailedHandler (GameServerType serverType, string mapId) |
| delegate void | ServerSyncFinishedHandler () |
| void | Log (string line) |
| Write one line to the server log. Log entries are automatically timestamped. More... | |
| int | GetPlayerPeerIndex (string playerId) |
| Get the peer index of the player with the given ID. More... | |
| string | GetPlayerID (int peerIndex) |
| Get the ID of the player with the given peer index. More... | |
| PlayerProfile | GetPlayerProfile (string playerId) |
| Get the profile of the player with the given ID. More... | |
| PlayerProfile | GetPlayerProfile (int peerIndex) |
| Get the profile of the player with the given peer index. More... | |
| void | RequestServerSpawn (GameServerType serverType, string mapId) |
| Sends a server spawn request to the world server. More... | |
| void | PullWorldData (string pageName, WorldDataReceivedHandler callback, bool useCache=false) |
| Requests a specific page of world data from the world server. More... | |
| UJeli | GetCachedWorldData (string pageName) |
| Returns a cached copy of a previously fetched world data page. More... | |
| void | PushWorldData (string pageName, UJeli pageContents) |
| Pushes a world data page to the world server. More... | |
| void | PushPlayerData (string playerid, string tablePath, string propertyName, string propertyValue) |
| Pushes a single change to a player's persistent data. More... | |
| void | PushPlayerData (params PlayerDataChange[] changes) |
| Pushes an arbitrary number of changes to a player's persistent data. More... | |
| void | Abort (string error) |
| Abort the server process with a given error. More... | |
| void | DisconnectFromWorldServer () |
| Disconnect from the world server. More... | |
Public Attributes | |
| int | Width |
| int | Height |
| string | WorldID |
| GameServerType | ServerType |
| string | MapID |
Properties | |
| static GameServer | Instance [get] |
| Gets the sole instance of this game server. More... | |
| int | ServerPoolIndex [get] |
| Gets the index of the server pool which created this server. -1 if this server is not pooled. More... | |
| bool | IsPooled [get] |
| Gets whether or not this server was created by a server pool. More... | |
| UJeli | MapSettings [get] |
| Settings for this map, pulled from the world server. More... | |
| int | NumPlayers [get] |
| Gets the number of connected players. More... | |
| string[] | PlayerIDs [get] |
| Gets an array containing the IDs of all connected players. More... | |
| int[] | PlayerPeerIndices [get] |
| Gets an array containing the peer indices of all connected players. More... | |
| PlayerProfile[] | PlayerProfiles [get] |
| Gets an array containing the profiles of all connected players. More... | |
| string[] | PlayerNicknames [get] |
| Gets an array containing the nicknames of all connected players. More... | |
| bool | IsConnectedToWorldServer [get] |
| Whether or not this server is connected to the world server. More... | |
Events | |
| ConnectedToWorldServerHandler | ConnectedToWorldServer = delegate { } |
| Event fired when this server connects to the world server. More... | |
| PlayerJoinedServerHandler | PlayerJoinedServer = delegate { } |
| Event fired when a player joins this server. More... | |
| PlayerSyncedHandler | PlayerSynced = delegate { } |
| Event fired when a player is fully synchronized with this server. More... | |
| PlayerLeftServerHandler | PlayerLeftServer = delegate { } |
| Event fired when a player leaves this server. More... | |
| PlayerJoinedWorldServerHandler | PlayerJoinedWorldServer = delegate { } |
| Event fired when a player joins the world server. More... | |
| PlayerLeftWorldServerHandler | PlayerLeftWorldServer = delegate { } |
| Event fired when a player leaves the world server. More... | |
| ServerSpawnedHandler | ServerSpawned = delegate { } |
| Event fired when a requested server spawn is successful. More... | |
| ServerSpawnFailedHandler | ServerSpawnFailed = delegate { } |
| Event fired when a requested server spawn fails. More... | |
| ServerSyncFinishedHandler | ServerSyncFinished = delegate { } |
| Event fired when server finsihes syncing (all map objects have had their OnSpawn called). More... | |
Main game server class.
Definition at line 19 of file GameServer.cs.
|
inline |
Abort the server process with a given error.
| error | The error to report on abort. |
Definition at line 1192 of file GameServer.cs.
|
inline |
Disconnect from the world server.
Definition at line 1287 of file GameServer.cs.
|
inline |
Returns a cached copy of a previously fetched world data page.
| pageName | The name of the data page. |
Definition at line 628 of file GameServer.cs.
|
inline |
Get the ID of the player with the given peer index.
Definition at line 429 of file GameServer.cs.
|
inline |
Get the peer index of the player with the given ID.
Definition at line 417 of file GameServer.cs.
|
inline |
Get the profile of the player with the given ID.
Definition at line 441 of file GameServer.cs.
|
inline |
Get the profile of the player with the given peer index.
Definition at line 453 of file GameServer.cs.
|
inline |
Write one line to the server log. Log entries are automatically timestamped.
| line |
Definition at line 394 of file GameServer.cs.
|
inline |
Requests a specific page of world data from the world server.
| pageName | The name of the data page. |
| callback | The callback to call once the world data is received. |
| useCache | Whether or not to use a cached copy if available. |
Definition at line 592 of file GameServer.cs.
|
inline |
Pushes a single change to a player's persistent data.
| playerid | The ID of the player whose data to change. |
| tablePath | The path of the data table to change. |
| propertyName | The name of the property to change. |
| propertyValue | The desired value of the property. |
Definition at line 661 of file GameServer.cs.
|
inline |
Pushes an arbitrary number of changes to a player's persistent data.
| changes | An array of player data changes. |
Definition at line 676 of file GameServer.cs.
|
inline |
Pushes a world data page to the world server.
| pageName | The name of the data page. |
| pageContents | The new data page contents to push. |
Definition at line 640 of file GameServer.cs.
|
inline |
Sends a server spawn request to the world server.
| serverType | The type of server to spawn. |
| mapId | The ID of the map for the spawned server to load. |
Definition at line 467 of file GameServer.cs.
|
staticget |
Gets the sole instance of this game server.
Definition at line 95 of file GameServer.cs.
|
get |
Whether or not this server is connected to the world server.
Definition at line 179 of file GameServer.cs.
|
get |
Gets whether or not this server was created by a server pool.
Definition at line 111 of file GameServer.cs.
|
get |
Settings for this map, pulled from the world server.
Definition at line 119 of file GameServer.cs.
|
get |
Gets the number of connected players.
Definition at line 127 of file GameServer.cs.
|
get |
Gets an array containing the IDs of all connected players.
Definition at line 135 of file GameServer.cs.
|
get |
Gets an array containing the nicknames of all connected players.
Definition at line 165 of file GameServer.cs.
|
get |
Gets an array containing the peer indices of all connected players.
Definition at line 143 of file GameServer.cs.
|
get |
Gets an array containing the profiles of all connected players.
Definition at line 151 of file GameServer.cs.
|
get |
Gets the index of the server pool which created this server. -1 if this server is not pooled.
Definition at line 103 of file GameServer.cs.
| ConnectedToWorldServerHandler GameServer.ConnectedToWorldServer = delegate { } |
Event fired when this server connects to the world server.
Definition at line 56 of file GameServer.cs.
| PlayerJoinedServerHandler GameServer.PlayerJoinedServer = delegate { } |
Event fired when a player joins this server.
Definition at line 60 of file GameServer.cs.
| PlayerJoinedWorldServerHandler GameServer.PlayerJoinedWorldServer = delegate { } |
Event fired when a player joins the world server.
Definition at line 72 of file GameServer.cs.
| PlayerLeftServerHandler GameServer.PlayerLeftServer = delegate { } |
Event fired when a player leaves this server.
Definition at line 68 of file GameServer.cs.
| PlayerLeftWorldServerHandler GameServer.PlayerLeftWorldServer = delegate { } |
Event fired when a player leaves the world server.
Definition at line 76 of file GameServer.cs.
| PlayerSyncedHandler GameServer.PlayerSynced = delegate { } |
Event fired when a player is fully synchronized with this server.
Definition at line 64 of file GameServer.cs.
| ServerSpawnedHandler GameServer.ServerSpawned = delegate { } |
Event fired when a requested server spawn is successful.
Definition at line 80 of file GameServer.cs.
| ServerSpawnFailedHandler GameServer.ServerSpawnFailed = delegate { } |
Event fired when a requested server spawn fails.
Definition at line 84 of file GameServer.cs.
| ServerSyncFinishedHandler GameServer.ServerSyncFinished = delegate { } |
Event fired when server finsihes syncing (all map objects have had their OnSpawn called).
Definition at line 88 of file GameServer.cs.