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
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

EventSystem类

EventSystem类负责事件系统的运行。

EventSystem类的实现存放在路径下文件data/framework/game/event_system.h中。

EventSystem Class

成员


EventSystem ()

构造函数。 用来创建新EventSystem类的实例。

void createEvent (string name)

其作用是创建事件。

参数

  • string name - 指唯一的事件名称。

void removeEvent (string name)

其作用是删除事件。

参数

  • string name - 指唯一的事件名称。

int isEvent (string name)

其作用是返回一个可用来指明带有指定名称的事件是否存在的值。

参数

  • string name - 指事件名称。

返回值

如果指定事件存在就返回1;否则返回0

void setEventEnabled (string name, int mode)

其作用是设置一个可用来指明事件是否被启用或禁用的值。

参数

  • string name - 指事件名称。
  • int mode - 1,表示启用事件;0,表示禁用事件。

int isEventEnabled (string name)

其作用是返回一个可用来指明事件是否被启用的值。

参数

  • string name - 指事件名称。

返回值

如果指定事件被启用就返回1;否则返回0

void callEvent (string name)

其作用是调用事件。

参数

  • string name - 指事件名称。

void callEvent (string name, Entity ret [])

其作用是为指定实体调用事件。

参数

  • string name - 指事件名称。
  • Entity ret [] - 指实体的数组。

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

其作用是将函数订阅给事件。

参数

  • string name - 指事件名称。
  • variable instance - 指用户类的实例,也就是函数的调用方。 如果函数是静态的,那就传递NULL值。
  • string function - 指事件发生时被调用函数的名称。
  • variable arg0 - 指函数参数,可选。
  • variable arg1 - 指函数参数,可选。
  • variable arg2 - 指函数参数,可选。
  • variable arg3 - 指函数参数,可选。

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

其作用是从事件取消订阅函数。

参数

  • string name - 指事件名称。
  • variable instance - 指用户类的实例,也就是函数的调用方。 如果函数是静态的,那就传递NULL值。
  • string function - 指函数名称。
  • int num_args - 指函数参数的数量。

void clearGarbage ()

其作用是释放事件系统的未使用资源。
最新更新: 2017-07-03
Build: ()