The Laya class refers to some commonly used global objects, such as Laya.stage: stage, Laya.timer: time manager, Laya.loader: loading manager. Pay attention to case when using.
Main game timer, also manages scene, animation, tween effects clock. By controlling this timer's scale, fast-forward and slow-motion effects can be achieved.
Zh
游戏主时针,同时也是管理场景,动画,缓动等效果时钟,通过控制本时针缩放,达到快进慢播效果。
方法
静态_onGlobalError
_onGlobalError(ev): void
参数
ev: PromiseRejectionEvent | ErrorEvent
The error event object.
返回 void
En
Global error callback function. Will be called when an error occurs in the engine and alertGlobalError is set to true.
Zh
全局错误回调函数,当引擎发生错误并且alertGlobalError设置为true时会被调用。
静态addAfterInitCallback
addAfterInitCallback(callback): void
参数
callback: (() => void | Promise<void>)
The initialization function of the module.
(): void | Promise<void>
返回 void | Promise<void>
返回 void
En
Execute custom logic after engine initialization. All registered callbacks are executed in the order of registration.
Execute custom logic before engine initialization.
At this time, the Stage has not been created yet, so you can modify stageConfig to implement dynamic stage configuration. All registered callbacks are executed in the order of registration.
Adds an initialization function. Various engine modules, such as physics, pathfinding, etc., can register their initialization logic here if needed.
Developers typically do not use this directly. All registered callbacks are executed in parallel.
Indicates whether to capture global errors and display a prompt. When set to true, detailed error stacks can be thrown in a pop-up window if unknown errors occur. The default is false.
返回 void
En
Pop up error information, suitable for mobile devices and other convenient debugging.
Zh
弹出错误信息,适用于移动设备等不方便调试的时候,
静态importNative
importNative(name): any
参数
name: string
The name of the library to import. e.g. test.dll
返回 any
The imported object.
En
Import a native library(e.g. dll/so/dylib). If not in the Conch environment, this function will return null.
En
Laya is the reference entry for global objects.
The Laya class refers to some commonly used global objects, such as Laya.stage: stage, Laya.timer: time manager, Laya.loader: loading manager. Pay attention to case when using.
Zh
Laya是全局对象的引用入口集。
Laya类引用了一些常用的全局对象,比如Laya.stage:舞台,Laya.timer:时间管理器,Laya.loader:加载管理器,使用时注意大小写。
Blueprintable