2019-04-02 10:37:02 -07:00
|
|
|
# EventHandler
|
|
|
|
|
|
|
|
Event handlers handle events on a per-game or per-map level. This means that
|
|
|
|
they are registered when you start a new game or map, and un-register when you
|
|
|
|
finish the game or map. This is unlike `StaticEventHandler`, which registers
|
|
|
|
when the engine is started, and un-registers when it exits.
|
|
|
|
|
|
|
|
All of the virtual functions on `EventHandler` have empty implementations by
|
|
|
|
default, so you only need to override the events your event handler needs to
|
|
|
|
override.
|
|
|
|
|
|
|
|
See `StaticEventHandler` for more information on the events that can be
|
|
|
|
overridden on this type.
|
|
|
|
|
|
|
|
```
|
|
|
|
class EventHandler : StaticEventHandler
|
|
|
|
{
|
2019-08-14 03:32:51 -07:00
|
|
|
clearscope static StaticEventHandler Find(class<StaticEventHandler> type);
|
|
|
|
clearscope static void SendNetworkEvent(string name, int arg1 = 0, int arg2 = 0, int arg3 = 0);
|
2019-04-02 10:37:02 -07:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
### `Find`
|
2019-04-02 10:37:02 -07:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
Finds and returns the `StaticEventHandler` type `type` if it is registered, or
|
|
|
|
`null` if it does not exist. It should be noted that this is exactly the same
|
|
|
|
as `StaticEventHandler`'s, and does not actually check for `EventHandlers`,
|
|
|
|
although due to inheritance will return them correctly.
|
2019-04-02 10:37:02 -07:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
### `SendNetworkEvent`
|
2019-04-02 10:37:02 -07:00
|
|
|
|
2019-08-14 03:31:41 -07:00
|
|
|
Sends a network event with no activator.
|
2019-04-02 10:37:02 -07:00
|
|
|
|
|
|
|
<!-- EOF -->
|