Photon Quantum 3.0.0

Public Member Functions | Public Attributes | Properties | List of all members
Quantum.QuantumNetworkCommunicator Class Reference

This class implements the Quantum interface ICommunicator and uses Photon Realtime in Unity to support sending RaiseEvent(byte, byte[], int, bool, int[]) and receiving AddEventListener(Photon.Deterministic.OnEventReceived) network messages from the Photon Cloud. More...

Inherits ICommunicator.

Public Member Functions

 QuantumNetworkCommunicator (RealtimeClient loadBalancingClient, ShutdownConnectionOptions shutdownConnectionOptions=ShutdownConnectionOptions.Disconnect)
 Create instance to assign to SessionRunner.Arguments.Communicator. The client object is expected to be connected to a game server (joined a room). More...
 
void AddEventListener (OnEventReceived onEventReceived)
 Called by Quantum to subscribe to incoming messages. More...
 
void DisposeEventObject (object obj)
 Called by Quantum to recycle incoming message objects. More...
 
void OnDestroy ()
 Called by Quantum when the simulation is shut down. Also called by the SessionRunner when shutting down. More...
 
System.Threading.Tasks.Task OnDestroyAsync ()
 Called when the SessionRunner is shutting down async. More...
 
void RaiseEvent (Byte eventCode, byte[] message, int messageLength, Boolean reliable, Int32[] toPlayers)
 Called by Quantum to send messages. More...
 
void Service ()
 Called by Quantum to update the Realtime client. More...
 

Public Attributes

Int32 ActorNumber => _realtimeClient.LocalPlayer.ActorNumber
 Returns the Photon Actor Number that this client was assigned to. More...
 
RealtimeClient NetworkClient => _realtimeClient
 The Realtime client object which is assigned inside the constructor. More...
 

Properties

Boolean IsConnected [get]
 Returns RealtimeClient.IsConnected. More...
 
Int32 RoundTripTime [get]
 Returns the RTT measured by the Realtime client. More...
 
ShutdownConnectionOptions ShutdownConnectionOptions [get, set]
 When this class is assigned to a Quantum session this option configures what happens to the standing online connecting when the Quantum simulation is completed. By default the connection is shutdown as well. Other options are staying in the Photon room or returning to the master server. More...
 

Detailed Description

This class implements the Quantum interface ICommunicator and uses Photon Realtime in Unity to support sending RaiseEvent(byte, byte[], int, bool, int[]) and receiving AddEventListener(Photon.Deterministic.OnEventReceived) network messages from the Photon Cloud.

Constructor & Destructor Documentation

◆ QuantumNetworkCommunicator()

Quantum.QuantumNetworkCommunicator.QuantumNetworkCommunicator ( RealtimeClient  loadBalancingClient,
ShutdownConnectionOptions  shutdownConnectionOptions = ShutdownConnectionOptions.Disconnect 
)
inline

Create instance to assign to SessionRunner.Arguments.Communicator. The client object is expected to be connected to a game server (joined a room).

Parameters
loadBalancingClientThe connected Realtime client object
shutdownConnectionOptionsOptionally chose the shutdown behaviour

Member Function Documentation

◆ DisposeEventObject()

void Quantum.QuantumNetworkCommunicator.DisposeEventObject ( object  obj)
inline

Called by Quantum to recycle incoming message objects.

Parameters
objMessage object to recycle

◆ RaiseEvent()

void Quantum.QuantumNetworkCommunicator.RaiseEvent ( Byte  eventCode,
byte[]  message,
int  messageLength,
Boolean  reliable,
Int32[]  toPlayers 
)
inline

Called by Quantum to send messages.

◆ AddEventListener()

void Quantum.QuantumNetworkCommunicator.AddEventListener ( OnEventReceived  onEventReceived)
inline

Called by Quantum to subscribe to incoming messages.

◆ Service()

void Quantum.QuantumNetworkCommunicator.Service ( )
inline

Called by Quantum to update the Realtime client.

◆ OnDestroy()

void Quantum.QuantumNetworkCommunicator.OnDestroy ( )
inline

Called by Quantum when the simulation is shut down. Also called by the SessionRunner when shutting down.

◆ OnDestroyAsync()

System.Threading.Tasks.Task Quantum.QuantumNetworkCommunicator.OnDestroyAsync ( )
inline

Called when the SessionRunner is shutting down async.

Member Data Documentation

◆ NetworkClient

RealtimeClient Quantum.QuantumNetworkCommunicator.NetworkClient => _realtimeClient

The Realtime client object which is assigned inside the constructor.

◆ ActorNumber

Int32 Quantum.QuantumNetworkCommunicator.ActorNumber => _realtimeClient.LocalPlayer.ActorNumber

Returns the Photon Actor Number that this client was assigned to.

Property Documentation

◆ ShutdownConnectionOptions

ShutdownConnectionOptions Quantum.QuantumNetworkCommunicator.ShutdownConnectionOptions
getset

When this class is assigned to a Quantum session this option configures what happens to the standing online connecting when the Quantum simulation is completed. By default the connection is shutdown as well. Other options are staying in the Photon room or returning to the master server.

◆ IsConnected

Boolean Quantum.QuantumNetworkCommunicator.IsConnected
get

Returns RealtimeClient.IsConnected.

◆ RoundTripTime

Int32 Quantum.QuantumNetworkCommunicator.RoundTripTime
get

Returns the RTT measured by the Realtime client.