Photon Fusion 2.0.4

Public Member Functions | Properties | List of all members
ICommunicator Interface Reference

Interface for a Communicator More...

Public Member Functions

bool Poll ()
 Check if there are data package to be retrieved More...
 
void PushPackage (int senderActor, int eventCode, object data)
 Push a new Package into the communicator queues More...
 
int ReceivePackage (out int senderActor, byte *buffer, int bufferLength)
 Retrieve a Data Package More...
 
void RegisterPackageCallback< T > (Action< int, T > callback)
 Register a callback for a specific Message Type More...
 
void SendMessage (int targetActor, IMessage message)
 Send a Protocol Message using the communicator system More...
 
bool SendPackage (byte code, int targetActor, bool reliable, byte *buffer, int bufferLength)
 Sends a package data using the communication system More...
 
void Service ()
 Step the Communicator internals More...
 

Properties

int CommunicatorID [get]
 Represents the current ID of the communicator. More...
 

Detailed Description

Interface for a Communicator

Member Function Documentation

◆ Poll()

bool Poll ( )

Check if there are data package to be retrieved

Returns
True if the internal buffer has pendind data

◆ PushPackage()

void PushPackage ( int  senderActor,
int  eventCode,
object  data 
)

Push a new Package into the communicator queues

Parameters
senderActorData Sender Actor
eventCodeEvent Code of the Package
dataPackage

◆ ReceivePackage()

int ReceivePackage ( out int  senderActor,
byte *  buffer,
int  bufferLength 
)

Retrieve a Data Package

Parameters
senderActorData Package Sender
bufferBuffer to be filled with the Data
bufferLengthBuffer length
Returns
Total number of bytes written to buffer

◆ RegisterPackageCallback< T >()

void RegisterPackageCallback< T > ( Action< int, T >  callback)

Register a callback for a specific Message Type

Template Parameters
TMessage Type
Parameters
callbackCallback to be invoked when a Message of type T is received
Type Constraints
T :IMessage 

◆ SendMessage()

void SendMessage ( int  targetActor,
IMessage  message 
)

Send a Protocol Message using the communicator system

Parameters
targetActorTarget Actor of the Protocol Message
messageProtocol Message to be sent

◆ SendPackage()

bool SendPackage ( byte  code,
int  targetActor,
bool  reliable,
byte *  buffer,
int  bufferLength 
)

Sends a package data using the communication system

Parameters
codeEvent Code used to send the Package
targetActorTarget Actor of the Package
reliableFlag if this Package should be sent reliably
bufferData Buffer
bufferLengthBuffer Length

◆ Service()

void Service ( )

Step the Communicator internals

Property Documentation

◆ CommunicatorID

int CommunicatorID
get

Represents the current ID of the communicator.