This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

EventSystem Class

The EventSystem class provides an event system work.

The EventSystem class implementation can be found in the data/framework/game/event_system.h file.

EventSystem Class

Members


EventSystem ()

Constructor. Creates a new EventSystem class instance.

void createEvent (string name)

Creates an event.

Arguments

  • string name - Unique event name.

void removeEvent (string name)

Deletes an event.

Arguments

  • string name - Unique event name.

int isEvent (string name)

Returns a value indicating if an event with a specified name exists.

Arguments

  • string name - Event name.

Return value

1 if an event exists; otherwise 0.

void setEventEnabled (string name, int mode)

Sets a value indicating if an event enabled or disabled.

Arguments

  • string name - Event name.
  • int mode - 1 to enable an event; 0 to disable it.

int isEventEnabled (string name)

Returns a value indicating if an event is enabled.

Arguments

  • string name - Event name.

Return value

1 if an event is enabled; otherwise 0.

void callEvent (string name)

Calls an event.

Arguments

  • string name - Event name.

void callEvent (string name, Entity ret [])

Calls an event for the specified entities.

Arguments

  • string name - Event name.
  • Entity ret [] - Array of entities.

void subscribe (string name, variable instance, string function, variable arg0 = 0, variable arg1 = 0, variable arg2 = 0, variable arg3 = 0)

Subscribes a function to an event.

Arguments

  • string name - Event name.
  • variable instance - User class instance, for which the function is called. If the function is static, pass the NULL value.
  • string function - Name of the function that is called when the event occures.
  • variable arg0 - Function argument, optional.
  • variable arg1 - Function argument, optional.
  • variable arg2 - Function argument, optional.
  • variable arg3 - Function argument, optional.

void unsubscribe (string name, variable instance, string function, int num_args = 0)

Unsubscribes a function from an event.

Arguments

  • string name - Event name.
  • variable instance - User class instance, for which the function is called. If the function is static, pass the NULL value.
  • string function - Name of the function.
  • int num_args - Number of function arguments.

void clearGarbage ()

Releases an event system unused resources.
Last update: 2017-07-03
Build: ()