PixelCrushers.MessageSystem Class Reference

General purpose message system. More...

Classes

class  ListenerInfo
 

Static Public Member Functions

static bool IsListenerRegistered (IMessageHandler listener, string message, string parameter)
 Checks if the specified listener, message, and parameter is registered with the message system.
 
static void AddListener (IMessageHandler listener, string message, string parameter)
 Adds a listener.
 
static void AddListener (IMessageHandler listener, StringField message, StringField parameter)
 Adds a listener.
 
static void AddListener (IMessageHandler listener, StringField message, string parameter)
 Adds a listener.
 
static void AddListener (IMessageHandler listener, string message, StringField parameter)
 Adds a listener.
 
static void RemoveListener (IMessageHandler listener, string message, string parameter)
 Removes a listener from listening to a specific message and parameter.
 
static void RemoveListener (IMessageHandler listener, StringField message, StringField parameter)
 Removes a listener from listening to a specific message and parameter.
 
static void RemoveListener (IMessageHandler listener, StringField message, string parameter)
 Removes a listener from listening to a specific message and parameter.
 
static void RemoveListener (IMessageHandler listener, string message, StringField parameter)
 Removes a listener from listening to a specific message and parameter.
 
static void RemoveListener (IMessageHandler listener)
 Removes a listener from listening to all messages.
 
static void LogWhenSendingMessages (GameObject sender)
 Log a debug message when this object sends a message.
 
static void StopLoggingWhenSendingMessages (GameObject sender)
 Stop logging debug messages when this object sends a message.
 
static void LogWhenReceivingMessages (GameObject listener)
 Log a debug message when this listener receives a message.
 
static void StopLoggingWhenReceivingMessages (GameObject listener)
 Stop logging debug messages when this listener receives a message.
 
static void SendMessageWithTarget (object sender, object target, string message, string parameter, params object[] values)
 Sends a message to listeners.
 
static void SendMessageWithTarget (object sender, object target, StringField message, string parameter, params object[] values)
 Sends a message to listeners.
 
static void SendMessageWithTarget (object sender, object target, StringField message, StringField parameter, params object[] values)
 Sends a message to listeners.
 
static void SendMessageWithTarget (object sender, object target, string message, StringField parameter, params object[] values)
 Sends a message to listeners.
 
static void SendMessage (object sender, string message, string parameter, params object[] values)
 Sends a message to listeners.
 
static void SendMessage (object sender, StringField message, StringField parameter, params object[] values)
 Sends a message to listeners.
 
static void SendMessage (object sender, StringField message, string parameter, params object[] values)
 Sends a message to listeners.
 
static void SendMessage (object sender, string message, StringField parameter, params object[] values)
 Sends a message to listeners.
 
static void SendCompositeMessage (object sender, string message)
 Sends a message.
 

Properties

static bool sendInEditMode [get, set]
 Send messages even when not playing.
 
static bool allowReceiveSameFrameAdded [get, set]
 Allow listeners to receive messages on the same frame they registered with the MessageSystem.
 
static bool debug [get, set]
 Log message system activity.
 
static bool allowExceptions [get, set]
 Don't catch exceptions thrown by message recipients.
 

Detailed Description

General purpose message system.

Member Function Documentation

◆ AddListener() [1/4]

static void PixelCrushers.MessageSystem.AddListener ( IMessageHandler  listener,
string  message,
string  parameter 
)
inlinestatic

Adds a listener.

Parameters
listenerListener.
messageMessage to listen for.
parameterMessage parameter to listen for, or blank for any parameter with the message.

◆ AddListener() [2/4]

static void PixelCrushers.MessageSystem.AddListener ( IMessageHandler  listener,
string  message,
StringField  parameter 
)
inlinestatic

Adds a listener.

Parameters
listenerListener.
messageMessage to listen for.
parameterMessage parameter to listen for, or blank for any parameter with the message.

◆ AddListener() [3/4]

static void PixelCrushers.MessageSystem.AddListener ( IMessageHandler  listener,
StringField  message,
string  parameter 
)
inlinestatic

Adds a listener.

Parameters
listenerListener.
messageMessage to listen for.
parameterMessage parameter to listen for, or blank for any parameter with the message.

◆ AddListener() [4/4]

static void PixelCrushers.MessageSystem.AddListener ( IMessageHandler  listener,
StringField  message,
StringField  parameter 
)
inlinestatic

Adds a listener.

Parameters
listenerListener.
messageMessage to listen for.
parameterMessage parameter to listen for, or blank for any parameter with the message.

◆ IsListenerRegistered()

static bool PixelCrushers.MessageSystem.IsListenerRegistered ( IMessageHandler  listener,
string  message,
string  parameter 
)
inlinestatic

Checks if the specified listener, message, and parameter is registered with the message system.

Parameters
listenerListener to check.
messageMessage to check.
parameterParameter to check, or blank for any parameter.
Returns

◆ LogWhenReceivingMessages()

static void PixelCrushers.MessageSystem.LogWhenReceivingMessages ( GameObject  listener)
inlinestatic

Log a debug message when this listener receives a message.

◆ LogWhenSendingMessages()

static void PixelCrushers.MessageSystem.LogWhenSendingMessages ( GameObject  sender)
inlinestatic

Log a debug message when this object sends a message.

◆ RemoveListener() [1/5]

static void PixelCrushers.MessageSystem.RemoveListener ( IMessageHandler  listener)
inlinestatic

Removes a listener from listening to all messages.

◆ RemoveListener() [2/5]

static void PixelCrushers.MessageSystem.RemoveListener ( IMessageHandler  listener,
string  message,
string  parameter 
)
inlinestatic

Removes a listener from listening to a specific message and parameter.

Parameters
listenerListener.
messageMessage to no longer listen for, or blank for all messages.
parameterMessage parameter, or blank for all parameters.

◆ RemoveListener() [3/5]

static void PixelCrushers.MessageSystem.RemoveListener ( IMessageHandler  listener,
string  message,
StringField  parameter 
)
inlinestatic

Removes a listener from listening to a specific message and parameter.

Parameters
listenerListener.
messageMessage to no longer listen for.
parameterMessaeg parameter, or blank for all parameters.

◆ RemoveListener() [4/5]

static void PixelCrushers.MessageSystem.RemoveListener ( IMessageHandler  listener,
StringField  message,
string  parameter 
)
inlinestatic

Removes a listener from listening to a specific message and parameter.

Parameters
listenerListener.
messageMessage to no longer listen for.
parameterMessaeg parameter, or blank for all parameters.

◆ RemoveListener() [5/5]

static void PixelCrushers.MessageSystem.RemoveListener ( IMessageHandler  listener,
StringField  message,
StringField  parameter 
)
inlinestatic

Removes a listener from listening to a specific message and parameter.

Parameters
listenerListener.
messageMessage to no longer listen for.
parameterMessaeg parameter, or blank for all parameters.

◆ SendCompositeMessage()

static void PixelCrushers.MessageSystem.SendCompositeMessage ( object  sender,
string  message 
)
inlinestatic

Sends a message.

If the message contains a colon (:), the part after the colon is sent as the parameter. If it contains a second colon, the part after the second colon is sent as a value.

◆ SendMessage() [1/4]

static void PixelCrushers.MessageSystem.SendMessage ( object  sender,
string  message,
string  parameter,
params object[]  values 
)
inlinestatic

Sends a message to listeners.

Parameters
senderObject/info about object that's sending the message.
messageMessage.
parameterMessage parameter.
valuesAny number of additional values to send with message.

◆ SendMessage() [2/4]

static void PixelCrushers.MessageSystem.SendMessage ( object  sender,
string  message,
StringField  parameter,
params object[]  values 
)
inlinestatic

Sends a message to listeners.

Parameters
senderObject/info about object that's sending the message.
messageMessage.
parameterMessage parameter.
valuesAny number of additional values to send with message.

◆ SendMessage() [3/4]

static void PixelCrushers.MessageSystem.SendMessage ( object  sender,
StringField  message,
string  parameter,
params object[]  values 
)
inlinestatic

Sends a message to listeners.

Parameters
senderObject/info about object that's sending the message.
messageMessage.
parameterMessage parameter.
valuesAny number of additional values to send with message.

◆ SendMessage() [4/4]

static void PixelCrushers.MessageSystem.SendMessage ( object  sender,
StringField  message,
StringField  parameter,
params object[]  values 
)
inlinestatic

Sends a message to listeners.

Parameters
senderObject/info about object that's sending the message.
messageMessage.
parameterMessage parameter.
valuesAny number of additional values to send with message.

◆ SendMessageWithTarget() [1/4]

static void PixelCrushers.MessageSystem.SendMessageWithTarget ( object  sender,
object  target,
string  message,
string  parameter,
params object[]  values 
)
inlinestatic

Sends a message to listeners.

Parameters
senderObject/info about object that's sending the message.
targetIntended recipient, or null for any.
messageMessage.
parameterMessage parameter.
valuesAny number of additional values to send with message.

◆ SendMessageWithTarget() [2/4]

static void PixelCrushers.MessageSystem.SendMessageWithTarget ( object  sender,
object  target,
string  message,
StringField  parameter,
params object[]  values 
)
inlinestatic

Sends a message to listeners.

Parameters
senderObject/info about object that's sending the message.
targetIntended recipient, or null for any.
messageMessage.
parameterMessage parameter.
valuesAny number of additional values to send with message.

◆ SendMessageWithTarget() [3/4]

static void PixelCrushers.MessageSystem.SendMessageWithTarget ( object  sender,
object  target,
StringField  message,
string  parameter,
params object[]  values 
)
inlinestatic

Sends a message to listeners.

Parameters
senderObject/info about object that's sending the message.
targetIntended recipient, or null for any.
messageMessage.
parameterMessage parameter.
valuesAny number of additional values to send with message.

◆ SendMessageWithTarget() [4/4]

static void PixelCrushers.MessageSystem.SendMessageWithTarget ( object  sender,
object  target,
StringField  message,
StringField  parameter,
params object[]  values 
)
inlinestatic

Sends a message to listeners.

Parameters
senderObject/info about object that's sending the message.
targetIntended recipient, or null for any.
messageMessage.
parameterMessage parameter.
valuesAny number of additional values to send with message.

◆ StopLoggingWhenReceivingMessages()

static void PixelCrushers.MessageSystem.StopLoggingWhenReceivingMessages ( GameObject  listener)
inlinestatic

Stop logging debug messages when this listener receives a message.

◆ StopLoggingWhenSendingMessages()

static void PixelCrushers.MessageSystem.StopLoggingWhenSendingMessages ( GameObject  sender)
inlinestatic

Stop logging debug messages when this object sends a message.

Property Documentation

◆ allowExceptions

bool PixelCrushers.MessageSystem.allowExceptions
staticgetset

Don't catch exceptions thrown by message recipients.

◆ allowReceiveSameFrameAdded

bool PixelCrushers.MessageSystem.allowReceiveSameFrameAdded
staticgetset

Allow listeners to receive messages on the same frame they registered with the MessageSystem.

◆ debug

bool PixelCrushers.MessageSystem.debug
staticgetset

Log message system activity.

◆ sendInEditMode

bool PixelCrushers.MessageSystem.sendInEditMode
staticgetset

Send messages even when not playing.


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