Photon .NET Client API 4.1.4.8

Public Member Functions | List of all members
ExitGames.Client.Photon.IPhotonPeerListener Interface Reference

Callback interface for the Photon client side. Must be provided to a new PhotonPeer in its constructor. More...

Inheritance diagram for ExitGames.Client.Photon.IPhotonPeerListener:
Photon.Chat.ChatClient Photon.Realtime.LoadBalancingClient

Public Member Functions

void DebugReturn (DebugLevel level, string message)
 Provides textual descriptions for various error conditions and noteworthy situations. In cases where the application needs to react, a call to OnStatusChanged is used. OnStatusChanged gives "feedback" to the game, DebugReturn provies human readable messages on the background. More...
 
void OnOperationResponse (OperationResponse operationResponse)
 Callback method which gives you (async) responses for called operations. More...
 
void OnStatusChanged (StatusCode statusCode)
 OnStatusChanged is called to let the game know when asynchronous actions finished or when errors happen. More...
 
void OnEvent (EventData eventData)
 Called whenever an event from the Photon Server is dispatched. More...
 

Detailed Description

Callback interface for the Photon client side. Must be provided to a new PhotonPeer in its constructor.

These methods are used by your PhotonPeer instance to keep your app updated. Read each method's description and check out the samples to see how to use them.

Member Function Documentation

◆ DebugReturn()

void ExitGames.Client.Photon.IPhotonPeerListener.DebugReturn ( DebugLevel  level,
string  message 
)

Provides textual descriptions for various error conditions and noteworthy situations. In cases where the application needs to react, a call to OnStatusChanged is used. OnStatusChanged gives "feedback" to the game, DebugReturn provies human readable messages on the background.

All debug output of the library will be reported through this method. Print it or put it in a buffer to use it on-screen. Use PhotonPeer.DebugOut to select how verbose the output is.

Parameters
levelDebugLevel (severity) of the message.
messageDebug text. Print to System.Console or screen.

Implemented in Photon.Realtime.LoadBalancingClient.

◆ OnEvent()

void ExitGames.Client.Photon.IPhotonPeerListener.OnEvent ( EventData  eventData)

Called whenever an event from the Photon Server is dispatched.

Events are used for communication between clients and allow the server to update clients anytime. The creation of an event is often triggered by an operation (called by this client or an other).

Each event carries a Code plus optional content in its Parameters. Your application should identify which content to expect by the event's Code.

Events can be defined and modified server-side.

If you use the LoadBalancing api as basis, several events like EvJoin and EvLeave are pre-defined. The LoadBalancing api provides the EventCode and ParameterCode classes for pre-defined events.

Photon also allows you to come up with custom events on the fly, purely client-side. To do so, use OpRaiseEvent.

Events are incoming messages and as such buffered in the peer. Calling PhotonPeer.DispatchIncomingCommands will call IPhotonPeerListener.OnEvent, to hand over received events.

PhotonPeer.ReuseEventInstance is an option to optimize memory usage by reusing one EventData instance.

Parameters
eventDataThe event currently being dispatched.

Implemented in Photon.Realtime.LoadBalancingClient.

◆ OnOperationResponse()

void ExitGames.Client.Photon.IPhotonPeerListener.OnOperationResponse ( OperationResponse  operationResponse)

Callback method which gives you (async) responses for called operations.

Similar to method-calling, operations can have a result. Because operation-calls are non-blocking and executed on the server, responses are provided after a roundtrip as call to this method.

Example: Trying to create a room usually succeeds but can fail if the room's name is already in use (room names are their IDs).

This method is used as general callback for all operations. Each response corresponds to a certain "type" of operation by its OperationCode.

When you join a room, the server will assign a consecutive number to each client: the "actorNr" or "player number". This is sent back in the operation result.

Fetch your actorNr of a Join response like this:

int actorNr = (int)operationResponse[(byte)OperationCode.ActorNr];

Parameters
operationResponseThe response to an operation-call.

Implemented in Photon.Realtime.LoadBalancingClient.

◆ OnStatusChanged()

void ExitGames.Client.Photon.IPhotonPeerListener.OnStatusChanged ( StatusCode  statusCode)

OnStatusChanged is called to let the game know when asynchronous actions finished or when errors happen.

Not all of the many StatusCode values will apply to your game. Example: If you don't use encryption, the respective status changes are never made.

The values are all part of the StatusCode enumeration and described value-by-value.

Parameters
statusCodeA code to identify the situation.

Implemented in Photon.Realtime.LoadBalancingClient.


The documentation for this interface was generated from the following file: