Word Game Builder 2.0.1f2
Reference Manual
|
A serializable class for event binding. More...
Public Member Functions | |
WGBEvent (MonoBehaviour target, string methodName) | |
Creates an event with a target MonoBehaviour and method name. More... | |
WGBEvent (GameObject target, string methodName) | |
Creates an event with a target GameObject and method name (uses SendMessage). More... | |
WGBEvent (WGBEventDelegate del) | |
Creates an event from a delegate. More... | |
WGBEvent (WGBEventDelegate del, string name) | |
Creates an event from a delegate and an optional name. More... | |
void | Add (MonoBehaviour target, string methodName) |
Adds a MonoBehaviour and method name to this event. More... | |
void | Add (GameObject target, string methodName) |
Adds a GameObject and method name to this event (Uses SendMessage). More... | |
void | Add (WGBEventDelegate del) |
Adds a delegate to this event. More... | |
void | Add (WGBEventDelegate del, string name) |
Adds a delegate to the event with an optional name. More... | |
WGBEventDelegate | GetDelegate () |
Gets the raw delegate value. More... | |
IList< WGBEvent > | GetInvocationList () |
Gets all individual events associated with this object. More... | |
void | Invoke () |
Invokes the event directly. This will never run outside of play mode. More... | |
void | InvokeUnsafe () |
Invokes the event directly. This can run in the editor, and therefore corrupt state! Use carefully. More... | |
bool | Remove (MonoBehaviour target, string methodName) |
Remove the first instance of an event by MonoBehaviour and method name. More... | |
bool | Remove (GameObject target, string methodName) |
Remove the first instance of an event by GameObject and method name. More... | |
bool | Remove (WGBEventDelegate del) |
Remove the first instance of an event by a delegate. More... | |
bool | Remove (WGBEventDelegate del, string name) |
Remove the first instance of an event by a delegate and name. More... | |
bool | Remove (WGBEvent evt) |
Remove the first instance of an event. More... | |
void | SetDelegate (MonoBehaviour target, string methodName) |
Sets the event with a MonoBehaviour and method name. More... | |
void | SetDelegate (GameObject target, string methodName) |
Sets the event with a GameObject and method name (Uses SendMessage). More... | |
void | SetDelegate (WGBEventDelegate del) |
Sets the event with a delegate. More... | |
void | SetDelegate (WGBEventDelegate del, string name) |
Sets the event with a delegate and an optional name. More... | |
Static Public Member Functions | |
static void | Invoke (WGBEvent evt, WordGameLanguage currentLanguage, ILetterTile currentLetterTile, ITilePool currentTilePool, IWildcardTileManager currentWildcardTileManager, IWordGamePlayer currentPlayer, IWordGameAgent currentAgent, System.Action additionalPreCallback=null, System.Action additionalPostCallback=null) |
Invoke an event with the current event state. More... | |
static implicit | operator bool (WGBEvent e) |
Boolean operator. Returns true if the event is both not null and not empty. More... | |
static WGBEvent | operator+ (WGBEvent e, WGBEventDelegate del) |
Add operator. Provides .NET-like syntax for adding delegates to an event (on____ += myDelegate). More... | |
static WGBEvent | operator- (WGBEvent e, WGBEventDelegate del) |
Subtract operator. Provides .NET-like syntax for removing delegates from an event (on___ -= myDelegate). More... | |
Properties | |
static IWordGameAgent | currentAgent [get] |
Gets the current agent. This can only be used during event callbacks, for events invoked with the static Invoke method. More... | |
static WordGameLanguage | currentLanguage [get] |
Gets the current language. This can only be used during event callbacks, for events invoked with the static Invoke method. More... | |
static ILetterTile | currentLetterTile [get] |
Gets the current letter tile. This can only be used during event callbacks, for events invoked with the static Invoke method. More... | |
static IWordGamePlayer | currentPlayer [get] |
Gets the current player. This can only be used during event callbacks, for events invoked with the static Invoke method. More... | |
static ITilePool | currentTilePool [get] |
Gets the current tile pool. This can only be used during event callbacks, for events invoked with the static Invoke method. More... | |
static IWildcardTileManager | currentWildcardTileManager [get] |
Gets the current wildcard tile manager. This can only be used during event callbacks, for events invoked with the static Invoke method. More... | |
bool | isDelegate [get] |
If true, this event is a delegate. In the case of multiple events, this is based on the first added value. More... | |
string | methodName [get] |
The event method name. In the case of multiple events, this is based on the first added value. More... | |
string | rawMethodName [get] |
The event raw method name, without namespace or any other qualifiers. In the case of multiple events, this is based on the first added value. More... | |
MonoBehaviour | target [get] |
The event target. In the case of multiple events, this is based on the first added value. More... | |
GameObject | targetGameObject [get] |
The event target's GameObject. In the case of multiple events, this is based on the first added value. More... | |
A serializable class for event binding.
Events can be bound (public MonoBehaviour methods), use SendMessage (GameObject and method name), or use delegates. This class supports multicast events, and is safe (it will not throw exceptions for missing delegates or methods).
|
inline |
Creates an event with a target MonoBehaviour and method name.
target | The MonoBehaviour with the method to search for. |
methodName | The name of the method to search for. |
|
inline |
Creates an event with a target GameObject and method name (uses SendMessage).
target | The GameObject with the method to search for. |
methodName | The name of the method to search for. |
|
inline |
Creates an event from a delegate.
del | The delegate to search for. |
|
inline |
Creates an event from a delegate and an optional name.
del | The delegate to search for. |
name | The name of the delegate to search for. |
|
inline |
Adds a MonoBehaviour and method name to this event.
target | The MonoBehaviour with the method to search for. |
methodName | The name of the method to search for. |
|
inline |
Adds a GameObject and method name to this event (Uses SendMessage).
target | The GameObject with the method to search for. |
methodName | The name of the method to search for. |
|
inline |
Adds a delegate to this event.
del | The delegate to search for. |
|
inline |
Adds a delegate to the event with an optional name.
del | The delegate to search for. |
name | The name of the delegate to search for. |
|
inline |
Gets the raw delegate value.
|
inline |
Gets all individual events associated with this object.
Events are multicast - multiple events can be associated with a single object. This method gets all individual contained events. This allocates a new list.
|
inline |
Invokes the event directly. This will never run outside of play mode.
When an event is invoked directly, state variables are not set.
|
inlinestatic |
Invoke an event with the current event state.
Events that are invoked during other event callbacks are deferred into a queue until the current event is finished.
evt | The event to invoke. |
currentLanguage | The current language (defaults to Language.current). |
currentLetterTile | The current letter tile, if any. |
currentTilePool | The current tile pool, if any. |
currentWildcardTileManager | The current wildcard tile manager, if any. |
currentPlayer | The current player, if any. |
currentAgent | The current agent, if any. |
additionalPreCallback | An additional action that is run just before the event actually occurs. |
additionalPostCallback | An additional action that is run just after the event actually occurs. |
|
inline |
Invokes the event directly. This can run in the editor, and therefore corrupt state! Use carefully.
When an event is invoked directly, state variables are not set.
|
inlinestatic |
Boolean operator. Returns true if the event is both not null and not empty.
e | The event to test. |
true
if the event is both null and not empty, otherwise false
.
|
inlinestatic |
Add operator. Provides .NET-like syntax for adding delegates to an event (on____ += myDelegate).
e | The event to add to. |
del | The delegate to add to the event. |
|
inlinestatic |
Subtract operator. Provides .NET-like syntax for removing delegates from an event (on___ -= myDelegate).
e | The event to remove from.. |
del | The delegate to remove from the event. |
|
inline |
Remove the first instance of an event by MonoBehaviour and method name.
target | The MonoBehaviour with the method to search for. |
methodName | The name of the method to search for. |
true
if the event was successfully removed, otherwise false
.
|
inline |
Remove the first instance of an event by GameObject and method name.
target | The GameObject with the method to search for. |
methodName | The name of the method to search for. |
true
if the event was successfully removed, otherwise false
.
|
inline |
Remove the first instance of an event by a delegate.
del | The delegate to search for. |
true
if the event was successfully removed, otherwise false
.
|
inline |
Remove the first instance of an event by a delegate and name.
del | The delegate to search for. |
name | The name of the delegate to search for. |
true
if the event was successfully removed, otherwise false
.
|
inline |
Remove the first instance of an event.
evt | The event to remove. |
true
if the event was successfully removed, otherwise false
.
|
inline |
Sets the event with a MonoBehaviour and method name.
target | The MonoBehaviour with the method to search for. |
methodName | The name of the method to search for. |
|
inline |
Sets the event with a GameObject and method name (Uses SendMessage).
target | The GameObject with the method to search for. |
methodName | The name of the method to search for. |
|
inline |
Sets the event with a delegate.
del | The delegate to search for. |
|
inline |
Sets the event with a delegate and an optional name.
del | The delegate to search for. |
name | The name of the delegate to search for. |
|
staticget |
Gets the current agent. This can only be used during event callbacks, for events invoked with the static Invoke method.
|
staticget |
Gets the current language. This can only be used during event callbacks, for events invoked with the static Invoke method.
|
staticget |
Gets the current letter tile. This can only be used during event callbacks, for events invoked with the static Invoke method.
|
staticget |
Gets the current player. This can only be used during event callbacks, for events invoked with the static Invoke method.
|
staticget |
Gets the current tile pool. This can only be used during event callbacks, for events invoked with the static Invoke method.
|
staticget |
Gets the current wildcard tile manager. This can only be used during event callbacks, for events invoked with the static Invoke method.
|
get |
If true, this event is a delegate. In the case of multiple events, this is based on the first added value.
|
get |
The event method name. In the case of multiple events, this is based on the first added value.
This value will be in the form of Type.Name or Type.{delegate} for delegates.
|
get |
The event raw method name, without namespace or any other qualifiers. In the case of multiple events, this is based on the first added value.
|
get |
The event target. In the case of multiple events, this is based on the first added value.
This value will be null for delegates not associated with a MonoBehaviour.
|
get |
The event target's GameObject. In the case of multiple events, this is based on the first added value.
This value will be null for delegates not associated with a Component.