Override the Quantum plugin class to create a custom server object. More...
Inherits PluginBase, and IHost.
Public Member Functions | |
DeterministicPlugin () | |
Create a DeterministicPlugin instance which creates a new instance of Server.DeterministicServer More... | |
DeterministicPlugin (IServer server) | |
Create a DeterministicPlugin instance passing in a server object. More... | |
override void | BeforeJoin (IBeforeJoinGameCallInfo info) |
Optionally fires a webhook (WebHooksConfig.EnableOnJoin) and then continue the process with OnBeforeJoinContinue(). The join operation will be on hold (non-blocking) in this case. More... | |
void | Disconnect (int actorNr, string message) |
Removed the actor from the plugin host. Is automatically called when the DeterministicServer is closed. More... | |
void | LogError (string message) |
Directs log to PluginHost. More... | |
void | LogException (Exception exn) |
Directs log to PluginHost. More... | |
void | LogException (string message, Exception exn) |
Directs log to PluginHost. More... | |
void | LogFatal (string message) |
Directs log to PluginHost. More... | |
void | LogInfo (string message) |
Directs log to PluginHost. More... | |
void | LogWarning (string message) |
Directs log to PluginHost. More... | |
override void | OnCloseGame (ICloseGameCallInfo info) |
Called when the room is closing. The Quantum server is closed right away. When the close webhook is enabled, the processing is halted until a response is completed. More... | |
override void | OnCreateGame (ICreateGameCallInfo info) |
Optionally fires a webhook (WebHooksConfig.EnableOnCreate) and then continue the process with OnCreateGameContinue(). The create operation will be on hold (blocking) in this case. LobbyProperties are validated and overwritten. More... | |
override void | OnLeave (ILeaveGameCallInfo info) |
Called when an actor leaves the room. Quantum ignores the inactive flag. When enabled a webhook is fired, processing the leave action is never halted, though. More... | |
bool | TrySendAddPlayerWebRequest (string userId, int playerSlot, byte[] runtimePlayer, WebhookHostCallbacks.AddRuntimePlayerWebResponse callback) |
Check plugin config for "WebHookEnableRuntimePlayer". If true sends a RuntimePlayer web request. More... | |
bool | TrySendGameConfigsWebRequest (string userId, byte[] runtimeConfig, object sessionConfig, WebhookHostCallbacks.SendGameConfigsWebResponse callback) |
Checks the plugin config for "WebHookEnableRuntimeConfig" and tries to send a webhook accordingly. This can be only issued once successfully as internally HasRuntimeConfigWebhookBeenSent is checked. More... | |
bool | TrySendPlayerAddedWebRequest (string userId, int playerSlot, int player) |
If "WebHookEnablePlayerAdded" is enabled in the Photon config a fire and forget webrequest is send to a custom backend when a player was successfully added to the Quantum simulation. More... | |
bool | TrySendPlayerRemovedWebRequest (string userId, int playerSlot, int player, int playerRemovedReason) |
If "WebHookEnablePlayerRemoved" is enabled in the Photon config a fire and forget webrequest is send to a custom backend when a player was successfully removed to the Quantum simulation. More... | |
Public Attributes | |
string | GameId => PluginHost == null ? string.Empty : PluginHost.GameId |
Returns the room name. More... | |
bool | IsClosed => _isClosed |
Returns true when the plugin has been closed. More... | |
override string | Name => "QuantumPlugin" |
Plugin name. This will correspond with the plugin name that the client selects when connecting to a room. More... | |
IServer | Server => _server |
Server object that the plugin needs as an entry to call rudimentary callbacks. More... | |
string | UniqueGameId => _uniqueGameId ?? WebHooksUtil.CreateGameId(this, PluginHost) |
Returns a unique game id, a combination of region, cloud and room name. More... | |
Protected Member Functions | |
virtual void | OnBeforeJoinContinue (JoinQuantumGameResponse response, WebHookError error, IBeforeJoinGameCallInfo info) |
Continuation of the before join operation if a webhook was used. Exceptions thrown will be caught and logged as errors. More... | |
virtual void | OnCreateGameContinue (CreateQuantumGameResponse response, WebHookError error, ICreateGameCallInfo info) |
If a webhook is send during CreateGame it will eventually continue here with the response or error. Exceptions thrown will be cached and logged as errors. More... | |
bool | TryGetActorNumber (string userId, out int actorNr) |
Search the actor number for a UserId. This may fail. More... | |
bool | TryGetUserId (int actorNumber, out string userId) |
Search the Photon user id using a Photon actor id, this may fail. More... | |
Protected Attributes | |
QuantumWebHooksConfig | WebHooksConfig => _webHooksConfig # new QuantumWebHooksConfig() |
Return the current webhook config or lazy initialize a default one. More... | |
Properties | |
IPhotonDeterministicCounters | Counters [get, set] |
Quantum performance counter. Can be null . More... | |
int | EmptyRoomTTL [get] |
Retrieve the EmptyRoomTTL value from GameProperties, return 0 when nothing was found. More... | |
Override the Quantum plugin class to create a custom server object.
|
inline |
Create a DeterministicPlugin instance which creates a new instance of Server.DeterministicServer
|
inline |
Create a DeterministicPlugin instance passing in a server object.
server | Server object of type Server.DeterministicServer |
|
inline |
Optionally fires a webhook (WebHooksConfig.EnableOnCreate) and then continue the process with OnCreateGameContinue(). The create operation will be on hold (blocking) in this case. LobbyProperties are validated and overwritten.
info | Create game info object |
|
inlineprotectedvirtual |
If a webhook is send during CreateGame it will eventually continue here with the response or error. Exceptions thrown will be cached and logged as errors.
response | Will be set if the webhook was successful. |
error | Will be set if the webhook was unsuccessful or an error occurred. |
info | Info object to continue or fail the game creation. |
|
inline |
Optionally fires a webhook (WebHooksConfig.EnableOnJoin) and then continue the process with OnBeforeJoinContinue(). The join operation will be on hold (non-blocking) in this case.
info | Join game info object |
|
inlineprotectedvirtual |
Continuation of the before join operation if a webhook was used. Exceptions thrown will be caught and logged as errors.
response | Will be set if the webhook was successful. |
error | Will be set if the webhook was unsuccessful or an error occurred. |
info | Info object to continue or fail the join operation. |
|
inlineprotected |
Search the actor number for a UserId. This may fail.
userId | Client User Id |
actorNr | Client Actor Id |
true
if an actor was found for the UserId
|
inlineprotected |
Search the Photon user id using a Photon actor id, this may fail.
actorNumber | Client Actor Id |
userId | Client User Id |
true
if an actor was found for the actor id
|
inline |
Called when an actor leaves the room. Quantum ignores the inactive flag. When enabled a webhook is fired, processing the leave action is never halted, though.
info |
|
inline |
Called when the room is closing. The Quantum server is closed right away. When the close webhook is enabled, the processing is halted until a response is completed.
info |
|
inline |
Directs log to PluginHost.
|
inline |
Directs log to PluginHost.
|
inline |
Directs log to PluginHost.
|
inline |
Directs log to PluginHost.
|
inline |
Directs log to PluginHost.
|
inline |
Directs log to PluginHost.
|
inline |
Removed the actor from the plugin host. Is automatically called when the DeterministicServer is closed.
actorNr | Actor Number from DeterministicPluginClient.ActorNr |
message | Disconnect message |
|
inline |
Check plugin config for "WebHookEnableRuntimePlayer". If true
sends a RuntimePlayer web request.
userId | Photon user id |
playerSlot | Player index (when one client controls multiple players). Must be set. |
runtimePlayer | RuntimePlayer in bytes. Can be null according to Webhook API. |
callback | Callback to forward the response. Must be set. |
true
if webhook was send.
|
inline |
If "WebHookEnablePlayerAdded" is enabled in the Photon config a fire and forget webrequest is send to a custom backend when a player was successfully added to the Quantum simulation.
userId | Photon user id |
playerSlot | Local player slot |
player | Global player id |
true
if webhook was send.
|
inline |
If "WebHookEnablePlayerRemoved" is enabled in the Photon config a fire and forget webrequest is send to a custom backend when a player was successfully removed to the Quantum simulation.
userId | Photon user id |
playerSlot | Local player slot or -1 if all players |
player | Global player id or -1 if all players |
playerRemovedReason | Reason that the player was removed |
true
if webhook was send.
|
inline |
Checks the plugin config for "WebHookEnableRuntimeConfig" and tries to send a webhook accordingly. This can be only issued once successfully as internally HasRuntimeConfigWebhookBeenSent is checked.
userId | User id |
runtimeConfig | RuntimeConfig from the client. Can be null according to Webhook API. |
sessionConfig | SessionConfig as DeterministicSessionConfig object from the client. Can be null according to Webhook API. |
callback | Webhook callback. Must be set. |
true
, if webhook was sent or previously sendIServer Photon.Deterministic.DeterministicPlugin.Server => _server |
Server object that the plugin needs as an entry to call rudimentary callbacks.
override string Photon.Deterministic.DeterministicPlugin.Name => "QuantumPlugin" |
Plugin name. This will correspond with the plugin name that the client selects when connecting to a room.
string Photon.Deterministic.DeterministicPlugin.UniqueGameId => _uniqueGameId ?? WebHooksUtil.CreateGameId(this, PluginHost) |
Returns a unique game id, a combination of region, cloud and room name.
string Photon.Deterministic.DeterministicPlugin.GameId => PluginHost == null ? string.Empty : PluginHost.GameId |
Returns the room name.
bool Photon.Deterministic.DeterministicPlugin.IsClosed => _isClosed |
Returns true
when the plugin has been closed.
|
protected |
Return the current webhook config or lazy initialize a default one.
|
get |
Retrieve the EmptyRoomTTL value from GameProperties, return 0 when nothing was found.
|
getset |
Quantum performance counter. Can be null
.