Photon .NET Client API
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:
ExitGames.Client.Photon.Chat.ChatClient ExitGames.Client.Photon.LoadBalancing.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 asyncronous 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

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 ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.

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 over time. The creation of an event is often triggered by an operation (called by this client or an other).

Each event carries its specific content in its Parameters. Your application knows which content to expect by checking the event's 'type', given by the event's Code.

Events can be defined and extended server-side.

If you use the LoadBalancing application as base, several events like EvJoin and EvLeave are already defined. For these events and their Parameters, the library provides constants, so check the EventCode and ParameterCode classes.

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

Events are buffered on the client side and must be Dispatched. This way, OnEvent is always taking place in the same thread as a PhotonPeer.DispatchIncomingCommands call.

Parameters
eventDataThe event currently being dispatched.

Implemented in ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.

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 (see: Operations).

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 OperationResult's Parameters as value of key EventCode.ActorNr.

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 ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.

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

OnStatusChanged is called to let the game know when asyncronous 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 ExitGames.Client.Photon.LoadBalancing.LoadBalancingClient.


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