|
26 | 26 | * 2.4. [Object Listener](#ObjectListener)
|
27 | 27 | * 2.5. [Unity MonoListener](#UnityMonoListener)
|
28 | 28 | * 2.6. [Event Handler](#EventHandler)
|
| 29 | + * 2.6.1. [EventHandler](#EventHandler-1) |
| 30 | + * 2.6.2. [EventHandler\<T\>](#EventHandlerT) |
29 | 31 | * 3. [Optional Attribute](#OptionalAttribute)
|
30 | 32 | * 3.1. [ EventEnumAttribute](#EventEnumAttribute)
|
31 | 33 | * 3.2. [ListenAttribute](#ListenAttribute)
|
|
82 | 84 | * For each type of event, use an enumerated type such as AppEvent, GameEvent, etc. Each event type corresponds to an event dispatcher instance.
|
83 | 85 | * It is possible to use only one event type per project, but it is not recommended.
|
84 | 86 | * Method-type listener needs to specify the binding object, while delegate-type listener does not need to specify the object.
|
85 |
| -* For the listen method of the delegate type, the parameters use the general **object[]** form, so **eventType** needs to be specified for processing, so the mandatory convention format of the delegate is **Action<T, object[]>**. |
| 87 | +* For the listen method of the delegate type, if there are parameters, the parameters use the general **object[]** form, so **eventType** may need to be specified for processing. |
86 | 88 | * It is recommended to group events through multiple event enumerations, and group monitoring methods through the **ListenGroupAttribute**.
|
87 | 89 | * When the first parameter of the method that receives the event is named **eventType**, the event type is automatically sent, and the other parameters are shifted backward in turn. It can be used to handle situations where multiple events trigger the same method.
|
88 | 90 | * **enum** / **string** type events use the **UEvent** interface, **class** / **struct** type events use the **UEvent\<T\>** interface, the interface does not do Complete type constraints, but be sure to call in accordance with the convention to avoid unexpected problems.
|
@@ -111,14 +113,24 @@ The user class implements the event mechanism by inheriting the class or initial
|
111 | 113 | Same as ObjectListener's interface,uesd for MonoBehaviour GameObject.
|
112 | 114 |
|
113 | 115 | ### 2.6. <a name='EventHandler'></a>Event Handler
|
114 |
| -* **Type** : Event type |
115 |
| -* **Group** : Listen Group |
116 |
| -* **Target** : Event target / receiver |
117 |
| -* **Priority** : Priority |
118 |
| -* **Interrupt** : Interrupt event queue |
119 |
| -* **Method** : Listen method |
120 |
| -* **Parameters** :Listen method's parameters |
121 |
| -* **Action<T, object[]>** : Listen delegate method |
| 116 | +#### 2.6.1. <a name='EventHandler-1'></a>EventHandler |
| 117 | +|Property|Description|Remarks| |
| 118 | +|-|-|-| |
| 119 | +|Type|Event definition object type|Event definition `enum/string/class/struct` and other objects Type, equivalent to `typeof(X)`| |
| 120 | +|EventType|The value of the listener event|1. For `enum/string` type events, it represents the specific enum value; 2. For `class/struct` events, it also appears as `Type` in the grouping definition of the listener, but it is actually An instance of this type is represented when the event is sent, and the content of the event can be included. | |
| 121 | +|Group|Monitor group|| |
| 122 | +|Target|Event target object|| |
| 123 | +|Priority|Priority|| |
| 124 | +|Interrupt|Whether to interrupt the event queue|| |
| 125 | +|Method|Listen method|For the non-parameter delegated listening, the delegate will be automatically converted to MehtodInfo for execution| |
| 126 | +|Parameters|Parameters of the listen method|| |
| 127 | +|Action|Listen delegate Action|| |
| 128 | +#### 2.6.2. <a name='EventHandlerT'></a>EventHandler\<T\> |
| 129 | +|Property|Description|Remarks| |
| 130 | +|-|-|-| |
| 131 | +|ActionT|Listen delegate Action\<T\>|| |
| 132 | +|ActionArgs|Listen delegate Action\<obj[]\>|| |
| 133 | +|ActionTArgs|Listen delegate Action\<T, object[]\>|| |
122 | 134 |
|
123 | 135 | ***
|
124 | 136 |
|
|
0 commit comments