Photon Plugins API Documentation v5.0RC1

Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Properties | List of all members
Photon.Hive.Plugin.PluginBase Class Reference

Base plugin class that should be extended to make custom ones. More...

Inheritance diagram for Photon.Hive.Plugin.PluginBase:
Photon.Hive.Plugin.IGamePlugin

Public Member Functions

 PluginBase ()
 Constructor. More...
 
virtual void BeforeCloseGame (IBeforeCloseGameCallInfo info)
 Calls info.Continue(). Override to change. More...
 
virtual void BeforeJoin (IBeforeJoinGameCallInfo info)
 Calls info.Continue(). Override to change. More...
 
virtual void BeforeSetProperties (IBeforeSetPropertiesCallInfo info)
 Calls info.Continue(). Override to change. More...
 
virtual void OnCloseGame (ICloseGameCallInfo info)
 Calls info.Continue(). Override to change. More...
 
virtual void OnCreateGame (ICreateGameCallInfo info)
 Calls info.Continue(). Override to change. More...
 
virtual void OnJoin (IJoinGameCallInfo info)
 Calls info.Continue(). Override to change. More...
 
virtual void OnLeave (ILeaveGameCallInfo info)
 Calls info.Continue(). Override to change. Handles MasterClient switch if needs be. (if the leaving actor is MasterClient) More...
 
virtual void OnRaiseEvent (IRaiseEventCallInfo info)
 Calls info.Continue(). Override to change. More...
 
virtual void OnSetProperties (ISetPropertiesCallInfo info)
 Calls info.Continue(). Override to change. More...
 
virtual void OnSetPropertiesFailed (ISetPropertiesFailedCallInfo info)
 Calls info.Continue(). Override to change. More...
 
virtual bool OnUnknownType (Type type, ref object value)
 Does nothing. Override to change. More...
 
virtual bool SetupInstance (IPluginHost host, Dictionary< string, string > config, out string errorMsg)
 Initialize plugin instance. More...
 

Static Public Attributes

static Version PluginsVersion = new Version(1, 2)
 
static Version BuildVersion = new Version()
 

Protected Member Functions

virtual void OnChangeMasterClientId (int oldId, int newId)
 MasterClient change callback. More...
 
virtual void ReportError (short errorCode, Exception exception, object state)
 Does nothing. Override to change. More...
 
virtual void StrictModeCheck (ICallInfo info)
 
void BroadcastEvent (byte code, Dictionary< byte, object > data)
 Broadcast event to all actors joined to the room. More...
 

Protected Attributes

bool fireAssert = true
 Flag to skip debug asserts used during testing More...
 

Properties

IPluginHost?? PluginHost [get, protected set]
 Reference to the game hosting the plugin. More...
 
string AppVersion [get]
 Version of the application to which this plugin belongs to. More...
 
string AppId [get]
 ID of the application to which this plugin belongs to. More...
 
string Region [get]
 Cloud region to which the application is connected to. More...
 
string Cloud [get]
 Type of cloud the application is connected to. Public or Enterprise. More...
 
string EnvironmentVerion [get]
 Full string environment information. More...
 
virtual string Name [get]
 Name of the plugin. Default is not allowed. This should be the name used when requesting the plugin from the client in CreateGame operation. This will be returned to the client in the CreateGame operation response. More...
 
virtual string Version [get]
 Version of the plugin. This will be returned to the client in the CreateGame operation response. More...
 
virtual bool IsPersistent [get]
 Indicates whether or not serialized room state should be persisted between sessions. More...
 
bool UseStrictMode [get, protected set]
 Indicates whether the plugin uses strict mode or not. If a plugin is in "strict mode" then all callbacks should be processed one of the available methods. If plugin version >= 1.0 then this should be true. If plugin version <= 0.9 then this should be false. More...
 
- Properties inherited from Photon.Hive.Plugin.IGamePlugin
string Name [get]
 Name of the plugin. Default is not allowed. This should be the name used when requesting the plugin from the client in CreateGame operation. This will be returned to the client in the CreateGame operation response. More...
 
string Version [get]
 Version of the plugin. This will be returned to the client in the CreateGame operation response. More...
 
bool IsPersistent [get]
 Flag used with webhooks plugin to indicate whether or not rooms should be persisted between connections. If true, SerializedGameState should be sent to web service before removing the room from memory. Also it could be loaded in OnCreateGame or BeforeJoin. More...
 

Detailed Description

Base plugin class that should be extended to make custom ones.

Constructor & Destructor Documentation

◆ PluginBase()

Photon.Hive.Plugin.PluginBase.PluginBase ( )
inline

Constructor.

Member Function Documentation

◆ BeforeCloseGame()

virtual void Photon.Hive.Plugin.PluginBase.BeforeCloseGame ( IBeforeCloseGameCallInfo  info)
inlinevirtual

Calls info.Continue(). Override to change.

Parameters
infoData passed in the callback call.

Implements Photon.Hive.Plugin.IGamePlugin.

◆ BeforeJoin()

virtual void Photon.Hive.Plugin.PluginBase.BeforeJoin ( IBeforeJoinGameCallInfo  info)
inlinevirtual

Calls info.Continue(). Override to change.

Parameters
infoData passed in the callback call.

Implements Photon.Hive.Plugin.IGamePlugin.

◆ BeforeSetProperties()

virtual void Photon.Hive.Plugin.PluginBase.BeforeSetProperties ( IBeforeSetPropertiesCallInfo  info)
inlinevirtual

Calls info.Continue(). Override to change.

Parameters
infoData passed in the callback call.

Implements Photon.Hive.Plugin.IGamePlugin.

◆ BroadcastEvent()

void Photon.Hive.Plugin.PluginBase.BroadcastEvent ( byte  code,
Dictionary< byte, object >  data 
)
inlineprotected

Broadcast event to all actors joined to the room.

Parameters
codeEvent code.
dataEvent data.

◆ OnChangeMasterClientId()

virtual void Photon.Hive.Plugin.PluginBase.OnChangeMasterClientId ( int  oldId,
int  newId 
)
inlineprotectedvirtual

MasterClient change callback.

Parameters
oldIdActor number of the old MasterClient.
newIdActor number of the new MasterClient.

◆ OnCloseGame()

virtual void Photon.Hive.Plugin.PluginBase.OnCloseGame ( ICloseGameCallInfo  info)
inlinevirtual

Calls info.Continue(). Override to change.

Parameters
infoData passed in the callback call.

Implements Photon.Hive.Plugin.IGamePlugin.

◆ OnCreateGame()

virtual void Photon.Hive.Plugin.PluginBase.OnCreateGame ( ICreateGameCallInfo  info)
inlinevirtual

Calls info.Continue(). Override to change.

Parameters
infoData passed in the callback call.

Implements Photon.Hive.Plugin.IGamePlugin.

◆ OnJoin()

virtual void Photon.Hive.Plugin.PluginBase.OnJoin ( IJoinGameCallInfo  info)
inlinevirtual

Calls info.Continue(). Override to change.

Parameters
infoData passed in the callback call.

Implements Photon.Hive.Plugin.IGamePlugin.

◆ OnLeave()

virtual void Photon.Hive.Plugin.PluginBase.OnLeave ( ILeaveGameCallInfo  info)
inlinevirtual

Calls info.Continue(). Override to change. Handles MasterClient switch if needs be. (if the leaving actor is MasterClient)

Parameters
infoData passed in the callback call.

Implements Photon.Hive.Plugin.IGamePlugin.

◆ OnRaiseEvent()

virtual void Photon.Hive.Plugin.PluginBase.OnRaiseEvent ( IRaiseEventCallInfo  info)
inlinevirtual

Calls info.Continue(). Override to change.

Parameters
infoData passed in the callback call.

Implements Photon.Hive.Plugin.IGamePlugin.

◆ OnSetProperties()

virtual void Photon.Hive.Plugin.PluginBase.OnSetProperties ( ISetPropertiesCallInfo  info)
inlinevirtual

Calls info.Continue(). Override to change.

Parameters
infoData passed in the callback call.

Implements Photon.Hive.Plugin.IGamePlugin.

◆ OnSetPropertiesFailed()

virtual void Photon.Hive.Plugin.PluginBase.OnSetPropertiesFailed ( ISetPropertiesFailedCallInfo  info)
inlinevirtual

Calls info.Continue(). Override to change.

Parameters
infoData passed in the callback call.

◆ OnUnknownType()

virtual bool Photon.Hive.Plugin.PluginBase.OnUnknownType ( Type  type,
ref object  value 
)
inlinevirtual

Does nothing. Override to change.

Parameters
typeThe Type of the object.
valueThe object with unknown type.
Returns
False.

Implements Photon.Hive.Plugin.IGamePlugin.

◆ ReportError()

virtual void Photon.Hive.Plugin.PluginBase.ReportError ( short  errorCode,
Exception  exception,
object  state 
)
inlineprotectedvirtual

Does nothing. Override to change.

Parameters
errorCodeCode of the error. Photon.Hive.Plugin.ErrorCodes
exceptionException thrown.
stateOptional object to be added in the report. It could help in debugging the error.

Implements Photon.Hive.Plugin.IGamePlugin.

◆ SetupInstance()

virtual bool Photon.Hive.Plugin.PluginBase.SetupInstance ( IPluginHost  host,
Dictionary< string, string >  config,
out string  errorMsg 
)
inlinevirtual

Initialize plugin instance.

Parameters
hostThe game hosting the plugin.
configThe plugin assembly key/value configuration entries.
errorMsgError message in case something wrong happens when setting up the plugin instance.
Returns
If the plugin instance setup is successful.

Implements Photon.Hive.Plugin.IGamePlugin.

◆ StrictModeCheck()

virtual void Photon.Hive.Plugin.PluginBase.StrictModeCheck ( ICallInfo  info)
inlineprotectedvirtual

Member Data Documentation

◆ BuildVersion

Version Photon.Hive.Plugin.PluginBase.BuildVersion = new Version()
static

◆ fireAssert

bool Photon.Hive.Plugin.PluginBase.fireAssert = true
protected

Flag to skip debug asserts used during testing

◆ PluginsVersion

Version Photon.Hive.Plugin.PluginBase.PluginsVersion = new Version(1, 2)
static

Property Documentation

◆ AppId

string Photon.Hive.Plugin.PluginBase.AppId
get

ID of the application to which this plugin belongs to.

◆ AppVersion

string Photon.Hive.Plugin.PluginBase.AppVersion
get

Version of the application to which this plugin belongs to.

◆ Cloud

string Photon.Hive.Plugin.PluginBase.Cloud
get

Type of cloud the application is connected to. Public or Enterprise.

◆ EnvironmentVerion

string Photon.Hive.Plugin.PluginBase.EnvironmentVerion
get

Full string environment information.

◆ IsPersistent

virtual bool Photon.Hive.Plugin.PluginBase.IsPersistent
get

Indicates whether or not serialized room state should be persisted between sessions.

This is mainly related to webhooks plugin in particular.

◆ Name

virtual string Photon.Hive.Plugin.PluginBase.Name
get

Name of the plugin. Default is not allowed. This should be the name used when requesting the plugin from the client in CreateGame operation. This will be returned to the client in the CreateGame operation response.

◆ PluginHost

IPluginHost?? Photon.Hive.Plugin.PluginBase.PluginHost
getprotected set

Reference to the game hosting the plugin.

◆ Region

string Photon.Hive.Plugin.PluginBase.Region
get

Cloud region to which the application is connected to.

◆ UseStrictMode

bool Photon.Hive.Plugin.PluginBase.UseStrictMode
getprotected set

Indicates whether the plugin uses strict mode or not. If a plugin is in "strict mode" then all callbacks should be processed one of the available methods. If plugin version >= 1.0 then this should be true. If plugin version <= 0.9 then this should be false.

◆ Version

virtual string Photon.Hive.Plugin.PluginBase.Version
get

Version of the plugin. This will be returned to the client in the CreateGame operation response.