Photon Bolt Engine API  1.2.7
Public Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
Bolt.Event Class Reference

Base class that all events inherit from More...

Inheritance diagram for Bolt.Event:

Public Member Functions

void Send ()
 Enqueue this object for sending across the network More...
 

Properties

byte [] BinaryData [get, set]
 The raw bytes of the event data More...
 
bool FromSelf [get]
 Returns true if this event was sent from own connection More...
 
internal bool IsEntityEvent [get]
 
bool IsGlobalEvent [get]
 Returns true if this is a global event / not an entity event More...
 
BoltConnection RaisedBy [get]
 The connection which raised this event More...
 
internal override NetworkStorage Storage [get]
 

Private Member Functions

internal Event (Event_Meta meta)
 
internal void FreeStorage ()
 
internal void InitNetworkStorage ()
 
internal bool Pack (BoltConnection connection, UdpPacket packet)
 
internal void Read (BoltConnection connection, UdpPacket packet)
 

Private Attributes

internal const byte ENTITY_EVERYONE = 1
 
internal const byte ENTITY_EVERYONE_EXCEPT_CONTROLLER = 5
 
internal const byte ENTITY_EVERYONE_EXCEPT_OWNER = 3
 
internal const byte ENTITY_EVERYONE_EXCEPT_OWNER_AND_CONTROLLER = 13
 
internal const byte ENTITY_ONLY_CONTROLLER = 7
 
internal const byte ENTITY_ONLY_CONTROLLER_AND_OWNER = 15
 
internal const byte ENTITY_ONLY_OWNER = 9
 
internal const byte ENTITY_ONLY_SELF = 11
 
internal const byte GLOBAL_ALL_CLIENTS = 8
 
internal const byte GLOBAL_EVERYONE = 2
 
internal const byte GLOBAL_ONLY_SELF = 12
 
internal const byte GLOBAL_ONLY_SERVER = 6
 
internal const byte GLOBAL_OTHERS = 4
 
internal const byte GLOBAL_SPECIFIC_CONNECTION = 10
 
internal new Event_Meta Meta
 
internal ReliabilityModes Reliability
 
internal bool Reliable
 
internal const int RELIABLE_SEQUENCE_BITS = 12
 
internal const int RELIABLE_WINDOW_BITS = 10
 
internal uint Sequence
 
internal BoltConnection SourceConnection
 
NetworkStorage storage
 
internal BoltConnection TargetConnection
 
internal Entity TargetEntity
 
internal int Targets
 

Detailed Description

Base class that all events inherit from

Example: Using a LogEvent object to send a message.

void LogMessage(string message) {
var logEvt = new LogEvent();
logEvt.message = message;
logEvt.Send();
}

Constructor & Destructor Documentation

◆ Event()

internal Bolt.Event.Event ( Event_Meta  meta)
inlineprivate

Member Function Documentation

◆ FreeStorage()

internal void Bolt.Event.FreeStorage ( )
inlineprivate

◆ InitNetworkStorage()

internal void Bolt.Event.InitNetworkStorage ( )
inlineprivate

◆ Pack()

internal bool Bolt.Event.Pack ( BoltConnection  connection,
UdpPacket  packet 
)
inlineprivate

◆ Read()

internal void Bolt.Event.Read ( BoltConnection  connection,
UdpPacket  packet 
)
inlineprivate

◆ Send()

void Bolt.Event.Send ( )
inline

Enqueue this object for sending across the network

Example: Sending a log message.

void LogMessage(string message) {
var logEvt = new LogEvent();
logEvt.message = message;
logEvt.Send();
}

Member Data Documentation

◆ ENTITY_EVERYONE

internal const byte Bolt.Event.ENTITY_EVERYONE = 1
private

◆ ENTITY_EVERYONE_EXCEPT_CONTROLLER

internal const byte Bolt.Event.ENTITY_EVERYONE_EXCEPT_CONTROLLER = 5
private

◆ ENTITY_EVERYONE_EXCEPT_OWNER

internal const byte Bolt.Event.ENTITY_EVERYONE_EXCEPT_OWNER = 3
private

◆ ENTITY_EVERYONE_EXCEPT_OWNER_AND_CONTROLLER

internal const byte Bolt.Event.ENTITY_EVERYONE_EXCEPT_OWNER_AND_CONTROLLER = 13
private

◆ ENTITY_ONLY_CONTROLLER

internal const byte Bolt.Event.ENTITY_ONLY_CONTROLLER = 7
private

◆ ENTITY_ONLY_CONTROLLER_AND_OWNER

internal const byte Bolt.Event.ENTITY_ONLY_CONTROLLER_AND_OWNER = 15
private

◆ ENTITY_ONLY_OWNER

internal const byte Bolt.Event.ENTITY_ONLY_OWNER = 9
private

◆ ENTITY_ONLY_SELF

internal const byte Bolt.Event.ENTITY_ONLY_SELF = 11
private

◆ GLOBAL_ALL_CLIENTS

internal const byte Bolt.Event.GLOBAL_ALL_CLIENTS = 8
private

◆ GLOBAL_EVERYONE

internal const byte Bolt.Event.GLOBAL_EVERYONE = 2
private

◆ GLOBAL_ONLY_SELF

internal const byte Bolt.Event.GLOBAL_ONLY_SELF = 12
private

◆ GLOBAL_ONLY_SERVER

internal const byte Bolt.Event.GLOBAL_ONLY_SERVER = 6
private

◆ GLOBAL_OTHERS

internal const byte Bolt.Event.GLOBAL_OTHERS = 4
private

◆ GLOBAL_SPECIFIC_CONNECTION

internal const byte Bolt.Event.GLOBAL_SPECIFIC_CONNECTION = 10
private

◆ Meta

internal new Event_Meta Bolt.Event.Meta
private

◆ Reliability

internal ReliabilityModes Bolt.Event.Reliability
private

◆ Reliable

internal bool Bolt.Event.Reliable
private

◆ RELIABLE_SEQUENCE_BITS

internal const int Bolt.Event.RELIABLE_SEQUENCE_BITS = 12
private

◆ RELIABLE_WINDOW_BITS

internal const int Bolt.Event.RELIABLE_WINDOW_BITS = 10
private

◆ Sequence

internal uint Bolt.Event.Sequence
private

◆ SourceConnection

internal BoltConnection Bolt.Event.SourceConnection
private

◆ storage

NetworkStorage Bolt.Event.storage
private

◆ TargetConnection

internal BoltConnection Bolt.Event.TargetConnection
private

◆ TargetEntity

internal Entity Bolt.Event.TargetEntity
private

◆ Targets

internal int Bolt.Event.Targets
private

Property Documentation

◆ BinaryData

byte [] Bolt.Event.BinaryData
getset

The raw bytes of the event data

Example: Removing repeated chat messages by doing sequence comparison on the raw byte data and filtering out any repeated messages after a certain limit.

public override void OnEvent(ChatEvent chatEvt) {
bool repeated = true;
for(int i = 0; i < CHAT_REPEAT_LIMIT; i++) {
if(!chatEvt.BinaryData.SequenceEqual(previousChatEvts.GoBack(i).BinaryData) {
repeated = false;
break;
}
}
}

◆ FromSelf

bool Bolt.Event.FromSelf
get

Returns true if this event was sent from own connection

Example: Showing chat messages from other players.

public override void OnEvent(ChatEvent chatEvt) {
if(chatEvt.FromSelf) {
return;
}
ChatWindow.instance.ShowMessage(chatEvt.message, chatEvt.timestamp);
}

◆ IsEntityEvent

internal bool Bolt.Event.IsEntityEvent
getprivate

◆ IsGlobalEvent

bool Bolt.Event.IsGlobalEvent
get

Returns true if this is a global event / not an entity event

Example: Using the isGlobal property to determine whether to send local or whole-zone chat.

public override void OnEvent(ChatEvent chatEvt) {
if(chatEvt.isGlobalEvent) {
BroadcastZoneChat(chatEvt.message, chatEvt.timestamp);
}
else {
SendLocalChat(chatEvt.message, chatEvt.timestamp);
}
}

◆ RaisedBy

BoltConnection Bolt.Event.RaisedBy
get

The connection which raised this event

Example: Blocking messages from players on a chat restricted list.

public override void OnEvent(ChatEvent chatEvt) {
if(chatRestrictedPlayerList.ContainsKey(chatEvt.RaisedBy)) {
return;
}
ChatWindow.instance.ShowMessage(chatEvt.message, chatEvt.timestamp);
}

◆ Storage

internal override NetworkStorage Bolt.Event.Storage
getprivate