Class AppEvent<T>
An abstract generic RuntimeObject which acts as an event handle. Inherit from this class to create your own event. Give your class the CreateAssetMenu attribute to serialize an instance of it.
Inheritance
Namespace: ScriptableFramework
Assembly: cs.temp.dll.dll
Syntax
public abstract class AppEvent<T> : AppEventBase
Type Parameters
| Name | Description |
|---|---|
| T | The type of the object that will will be passed when raising an event |
Fields
valueForManualTrigger
When testing your generic event in the editor, this value will be passed to each listener.
Declaration
public T valueForManualTrigger
Field Value
| Type | Description |
|---|---|
| T |
Properties
ListenerCount
Returns the count of all listeners on this event.
Declaration
public int ListenerCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
Clear()
Clear this event of all it's listeners
Declaration
public override void Clear()
Overrides
RaiseEvent(T, String, String, Int32)
Invoke every function callback that is delegated to every event listener that is listenning to this event. If there are no listeners, a warning will be given.
Declaration
public virtual bool RaiseEvent(T value, string fileName = "", string methodName = "", int callerLineNumber = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value that will be passed to all current listeners which will in turn pass the value to each delegated function in each listener. |
| System.String | fileName | Name of the .cs file the event was raised from (assigned automatically) |
| System.String | methodName | Name of the method the event was raised from (assigned automatically) |
| System.Int32 | callerLineNumber | Line number the event was raised from (assigned automatically) |
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns whether or not the event was raised successfully. |
RaiseEvent(String, String, Int32)
Invoke every function callback that is delegated to every event listener that is listenning
to this event using valueForManualTrigger or an empty instance of T depending on.
Declaration
public override bool RaiseEvent(string fileName = "", string methodName = "", int callerLineNumber = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Name of the .cs file the event was raised from (assigned automatically) |
| System.String | methodName | Name of the method the event was raised from (assigned automatically) |
| System.Int32 | callerLineNumber | Line number the event was raised from (assigned automatically) |
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns whether or not the event was raised successfully. |
Overrides
RaiseFromUI(T)
Simplified wrapper method that can be referenced by UnityEvents to allow directly calling events from UI callbacks.
Declaration
public virtual void RaiseFromUI(T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The dynamic or static value passed from the UI. |
RegisterListener(AppEventListener<T>)
If not already registered, add an app event listener to this event's list of listeners.
Declaration
public bool RegisterListener(AppEventListener<T> listener)
Parameters
| Type | Name | Description |
|---|---|---|
| AppEventListener<T> | listener | An instance of a listener component in the current scene. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns whether or not the listener was registered successfully. |
Reset()
Calls Clear ()
Declaration
public override void Reset()
Overrides
UnregisterListener(AppEventListener<T>)
If already registered, remove an app event listener from this event's list of listeners.
Declaration
public bool UnregisterListener(AppEventListener<T> listener)
Parameters
| Type | Name | Description |
|---|---|---|
| AppEventListener<T> | listener | An instance of a listener component in the current scene. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns whether or not the listener was unregistered successfully. |