Class GlobalMessage
Inheritance
Inherited Members
Namespace: MalteHusung.GlobalMessage
Assembly: cs.temp.dll.dll
Syntax
public class GlobalMessage
Fields
Instance
Declaration
public static readonly GlobalMessage Instance
Field Value
Type | Description |
---|---|
GlobalMessage |
Methods
AddGeneralReceiver(UnityAction<Object[]>, Type)
Adds a general receiver action for any message type. Use this version if the other typed versions e.g. AddReceiverViaObject(UnityAction, MessageType) are not an option.
Declaration
public void AddGeneralReceiver(UnityAction<object[]> receiverAction, Type messageType)
Parameters
Type | Name | Description |
---|---|---|
UnityAction<System.Object[]> | receiverAction | |
Type | messageType | must be a valid message type. See IsMessageType(Type, Boolean) |
AddReceiverViaClass<TMessageType>(UnityAction)
receiverAction
starts receiving messages of type TMessageType
Declaration
public void AddReceiverViaClass<TMessageType>(UnityAction receiverAction)
where TMessageType : MessageType
Parameters
Type | Name | Description |
---|---|---|
UnityAction | receiverAction |
Type Parameters
Name | Description |
---|---|
TMessageType | 0 parameter message type |
AddReceiverViaClass<TMessageType, T0>(UnityAction<T0>)
receiverAction
starts receiving messages of type TMessageType
Declaration
public void AddReceiverViaClass<TMessageType, T0>(UnityAction<T0> receiverAction)
where TMessageType : MessageType<T0>
Parameters
Type | Name | Description |
---|---|---|
UnityAction<T0> | receiverAction |
Type Parameters
Name | Description |
---|---|
TMessageType | 1 parameter message type |
T0 | 1st parameter type |
AddReceiverViaObject(UnityAction, MessageType)
receiverAction
starts receiving messages for msgObj
.
Declaration
public void AddReceiverViaObject(UnityAction receiverAction, MessageType msgObj)
Parameters
Type | Name | Description |
---|---|---|
UnityAction | receiverAction | |
MessageType | msgObj |
AddReceiverViaObject<T0>(UnityAction<T0>, MessageType<T0>)
receiverAction
starts receiving messages for msgObj
.
Declaration
public void AddReceiverViaObject<T0>(UnityAction<T0> receiverAction, MessageType<T0> msgObj)
Parameters
Type | Name | Description |
---|---|---|
UnityAction<T0> | receiverAction | |
MessageType<T0> | msgObj |
Type Parameters
Name | Description |
---|---|
T0 |
AddReceiverViaType(UnityAction, Type)
receiverAction
starts receiving messages of type msgType
.
Declaration
public void AddReceiverViaType(UnityAction receiverAction, Type msgType)
Parameters
Type | Name | Description |
---|---|---|
UnityAction | receiverAction | |
Type | msgType |
AddReceiverViaType<T0>(UnityAction<T0>, Type)
receiverAction
starts receiving messages of type msgType
.
Declaration
public void AddReceiverViaType<T0>(UnityAction<T0> receiverAction, Type msgType)
Parameters
Type | Name | Description |
---|---|---|
UnityAction<T0> | receiverAction | |
Type | msgType |
Type Parameters
Name | Description |
---|---|
T0 |
IsEditorMessageObjectType(Type, Boolean)
Valid Editor Message Object Types are message types for which an editor message object will be created by the system. Types are valid if they conform to IsMessageType(Type, Boolean), are not abstract and do not have the excluding MessageTypeEditorSettingsAttribute on them.
Declaration
public static bool IsEditorMessageObjectType(Type msgType, bool logErrorMsg = false)
Parameters
Type | Name | Description |
---|---|---|
Type | msgType | |
System.Boolean | logErrorMsg | Logs an error if the type is not valid |
Returns
Type | Description |
---|---|
System.Boolean | true if |
IsEditorVisibleMessageType(Type, Boolean)
Valid Editor Visible Message Types are message types for which editor information will be displayed and updated. Types are valid if they conform to IsMessageType(Type, Boolean) and do not have the excluding MessageTypeEditorSettingsAttribute on them.
Declaration
public static bool IsEditorVisibleMessageType(Type msgType, bool logErrorMsg = false)
Parameters
Type | Name | Description |
---|---|---|
Type | msgType | |
System.Boolean | logErrorMsg | Logs an error if the type is not valid |
Returns
Type | Description |
---|---|
System.Boolean | true if |
IsMessageType(Type, Boolean)
Message types must be of type MessageType or MessageType<T0> or inherit from them.
Declaration
public static bool IsMessageType(Type msgType, bool logErrorMsg = false)
Parameters
Type | Name | Description |
---|---|---|
Type | msgType | |
System.Boolean | logErrorMsg | Logs an error if the type is not valid |
Returns
Type | Description |
---|---|
System.Boolean | true if |
IsMessageType0Param(Type, Boolean)
Declaration
public static bool IsMessageType0Param(Type msgType, bool logErrorMsg = false)
Parameters
Type | Name | Description |
---|---|---|
Type | msgType | |
System.Boolean | logErrorMsg |
Returns
Type | Description |
---|---|
System.Boolean |
IsMessageType1Param(Type, Boolean)
Declaration
public static bool IsMessageType1Param(Type msgType, bool logErrorMsg = false)
Parameters
Type | Name | Description |
---|---|---|
Type | msgType | |
System.Boolean | logErrorMsg |
Returns
Type | Description |
---|---|
System.Boolean |
IsMessageType1Param(Type, out Type, Boolean)
Declaration
public static bool IsMessageType1Param(Type msgType, out Type parameterType, bool logErrorMsg = false)
Parameters
Type | Name | Description |
---|---|---|
Type | msgType | |
Type | parameterType | |
System.Boolean | logErrorMsg |
Returns
Type | Description |
---|---|
System.Boolean |
RemoveGeneralReceiver(UnityAction<Object[]>, Type)
Declaration
public void RemoveGeneralReceiver(UnityAction<object[]> receiverAction, Type msgType)
Parameters
Type | Name | Description |
---|---|---|
UnityAction<System.Object[]> | receiverAction | |
Type | msgType |
RemoveReceiverViaClass<TMessageType>(UnityAction)
Removes the receiver for a 0 parameter message type.
Declaration
public void RemoveReceiverViaClass<TMessageType>(UnityAction receiverAction)
where TMessageType : MessageType
Parameters
Type | Name | Description |
---|---|---|
UnityAction | receiverAction | the receiver action that should be removed |
Type Parameters
Name | Description |
---|---|
TMessageType | the message type for which to remove the receiver |
RemoveReceiverViaClass<TMessageType, T0>(UnityAction<T0>)
Removes the receiver for a 1 parameter message type.
Declaration
public void RemoveReceiverViaClass<TMessageType, T0>(UnityAction<T0> receiverAction)
where TMessageType : MessageType<T0>
Parameters
Type | Name | Description |
---|---|---|
UnityAction<T0> | receiverAction | the receiver action that should be removed |
Type Parameters
Name | Description |
---|---|
TMessageType | the message type for which to remove the receiver |
T0 | the 1st message parameter |
RemoveReceiverViaObject(UnityAction, MessageType)
Removes receiverAction
for msgObj
.
Declaration
public void RemoveReceiverViaObject(UnityAction receiverAction, MessageType msgObj)
Parameters
Type | Name | Description |
---|---|---|
UnityAction | receiverAction | the receiver action that should be removed |
MessageType | msgObj | the message object for which to remove the receiver |
RemoveReceiverViaObject<T0>(UnityAction<T0>, MessageType<T0>)
Removes receiverAction
for msgObj
.
Declaration
public void RemoveReceiverViaObject<T0>(UnityAction<T0> receiverAction, MessageType<T0> msgObj)
Parameters
Type | Name | Description |
---|---|---|
UnityAction<T0> | receiverAction | |
MessageType<T0> | msgObj |
Type Parameters
Name | Description |
---|---|
T0 |
RemoveReceiverViaType(UnityAction, Type)
Removes receiverAction
for messages of type msgType
.
Declaration
public void RemoveReceiverViaType(UnityAction receiverAction, Type msgType)
Parameters
Type | Name | Description |
---|---|---|
UnityAction | receiverAction | the receiver action that should be removed |
Type | msgType | the message type for which to remove the receiver |
RemoveReceiverViaType<T0>(UnityAction<T0>, Type)
Removes receiverAction
for messages of type msgType
.
Declaration
public void RemoveReceiverViaType<T0>(UnityAction<T0> receiverAction, Type msgType)
Parameters
Type | Name | Description |
---|---|---|
UnityAction<T0> | receiverAction | |
Type | msgType | the message type for which to remove the receiver |
Type Parameters
Name | Description |
---|---|
T0 |
SendDynamic(Type, Object, Object[])
Sends messages as any type. Only use this if the typed versions like SendViaObject(MessageType, Object) aren't an option, as this version is slower.
Declaration
public void SendDynamic(Type messageType, object sender, object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
Type | messageType | must be a valid message type. See IsMessageType(Type, Boolean) |
System.Object | sender | is displayed as the sender in the unity editor. Can be null if you don't need that info. |
System.Object[] | parameters | message parameters that will be sent. Count has to match |
SendViaClass<TMessageType>(Object)
Sends a message of type TMessageType
to all it's receivers.
Declaration
public void SendViaClass<TMessageType>(object sender)
where TMessageType : MessageType
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | is displayed as the sender in the unity editor. Can be null if you don't need that info. |
Type Parameters
Name | Description |
---|---|
TMessageType | any 0 parameter message type |
SendViaClass<TMessageType, T0>(T0, Object)
Sends a message of type TMessageType
to all it's receivers.
Declaration
public void SendViaClass<TMessageType, T0>(T0 param0, object sender)
where TMessageType : MessageType<T0>
Parameters
Type | Name | Description |
---|---|---|
T0 | param0 | 1st message parameter |
System.Object | sender | is displayed as the sender in the unity editor. Can be null if you don't need that info. |
Type Parameters
Name | Description |
---|---|
TMessageType | any 1 parameter message type |
T0 | 1st message parameter type |
SendViaObject(MessageType, Object)
Sends msgObject
to all it's receivers.
Declaration
public void SendViaObject(MessageType msgObject, object sender)
Parameters
Type | Name | Description |
---|---|---|
MessageType | msgObject | |
System.Object | sender | is displayed as the sender in the unity editor. Can be null if you don't need that info. |
SendViaObject<T0>(T0, MessageType<T0>, Object)
Sends msgObject
to all it's receivers.
Declaration
public void SendViaObject<T0>(T0 param0, MessageType<T0> msgObject, object sender)
Parameters
Type | Name | Description |
---|---|---|
T0 | param0 | 1st message parameter |
MessageType<T0> | msgObject | |
System.Object | sender | is displayed as the sender in the unity editor. Can be null if you don't need that info. |
Type Parameters
Name | Description |
---|---|
T0 |
SendViaType(Type, Object)
Sends a message of type msgType
to all it's receivers.
Declaration
public void SendViaType(Type msgType, object sender)
Parameters
Type | Name | Description |
---|---|---|
Type | msgType | any 0 parameter message type that conforms to IsMessageType(Type, Boolean) |
System.Object | sender | is displayed as the sender in the unity editor. Can be null if you don't need that info. |
SendViaType<T0>(T0, Type, Object)
Sends a message of type msgType
to all it's receivers.
Declaration
public void SendViaType<T0>(T0 param0, Type msgType, object sender)
Parameters
Type | Name | Description |
---|---|---|
T0 | param0 | 1st message parameter |
Type | msgType | any 1 parameter message type that conforms to IsMessageType(Type, Boolean) |
System.Object | sender | is displayed as the sender in the unity editor. Can be null if you don't need that info. |
Type Parameters
Name | Description |
---|---|
T0 |
Events
OnMessageSent
Type: sent message type
object: sender
Declaration
public event Action<Type, object> OnMessageSent
Event Type
Type | Description |
---|---|
Action<Type, System.Object> |
OnReceiverAdded
Type: message type
object: added receiver
Declaration
public event Action<Type, Delegate> OnReceiverAdded
Event Type
Type | Description |
---|---|
Action<Type, Delegate> |
OnReceiverRemoved
Type: message type
object: removed receiver
Declaration
public event Action<Type, Delegate> OnReceiverRemoved
Event Type
Type | Description |
---|---|
Action<Type, Delegate> |