• 首页
  • 动态
  • 案例
  • 引擎社区
  • API
  • 文档
  • 示例
  • 引擎下载

大约有 94 项符合查询结果, 库内数据总量为 31,671 项。 (搜索耗时: 0.0034 秒)

1. 原生语言与JS通信 · LayaAir3.3 · 引擎文档 · LAYABOX [ 100%]

...syncMessageCb); CONCH_EXPORT void CONCH_CDECL conchSendHandleMessageResult(const char *eventName, const char *result); 消息处理 int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) { conchSetHandleMessageCallback( [](const char *eventName, const char ...

来源: Laya3.0_文档 发布时间: 20251010

2. 2D方向光 · LayaAir3.3 · 引擎文档 · LAYABOX [ 95%]

...就可以实现一个简单的昼夜更替效果。 示例代码如下: const { regClass } = Laya; @regClass() export class DayNight extends Laya.Script { declare owner: Laya.Sprite; private lightComp: Laya.DirectionLight2D; private dayTime: number = 0; private dayDuration: number = 24; // 一个...

来源: Laya3.0_文档 发布时间: 20251010

3. ProtocolBuffer通信 · LayaAir3.3 · 引擎文档 · LAYABOX [ 92%]

...对于当前文件 import * as protobuf from "./libs/protobuf/protobuf"; const { regClass } = Laya; @regClass() export class ProtobufDemo extends Laya.Script { onEnable() { console.log("Game start"); } } 2.2 Protobuf示例脚本 引入了protobuf模块就可以直接在项目中使用了,这里我...

来源: Laya3.0_文档 发布时间: 20251010

4. 定时器 · LayaAir3.3 · 引擎文档 · LAYABOX [ 87%]

... false, delay, caller, method, args, coverBefore); } 使用示例如下: const { regClass } = Laya; import { RuntimeScriptBase } from "./RuntimeScript.generated"; @regClass() export class RuntimeScript extends RuntimeScriptBase { onAwake(): void { //60帧后,图片的透明度变为0.5 Laya.time...

来源: Laya3.0_文档 发布时间: 20251010

5. 2D精灵光 · LayaAir3.3 · 引擎文档 · LAYABOX [ 87%]

...cene2D节点后,加入下述代码,实现一个2D精灵光的效果: const { regClass, property } = Laya; @regClass() export class SpriteLight extends Laya.Script { @property({type: Laya.Sprite}) private spriteLight: Laya.Sprite; @property({type: Laya.Sprite}) private directLight: Laya.Sprite;...

来源: Laya3.0_文档 发布时间: 20251010

6. 2D网格渲染器 · LayaAir3.3 · 引擎文档 · LAYABOX [ 85%]

...节点后,加入下述代码,实现一个2D网格渲染器的效果: const { regClass, property } = Laya; @regClass() export class Mesh2DRender extends Laya.Script { @property({type: Laya.Sprite}) private layaMonkey: Laya.Sprite; //组件被启用后执行,例如节点被添加到舞台后 o...

来源: Laya3.0_文档 发布时间: 20251120

7. 开放数据域组件 · LayaAir3.3 · 引擎文档 · LAYABOX [ 82%]

...Scene2D节点上添加一个自定义组件脚本,脚本内容如下: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { //declare owner : Laya.Sprite3D; constructor() { super(); } /** * 组件被激活后执行,此时所有节点和组件均已创建...

来源: Laya3.0_文档 发布时间: 20251010

8. 滤镜效果 · LayaAir3.3 · 引擎文档 · LAYABOX [ 81%]

...种: 1、使用ColorFilter类直接创建滤镜,示例代码如下: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { // 获得Image组件 @property({ type: Laya.Image }) public img: Laya.Image; //组件被激活后执行,此时所有节点和组...

来源: Laya3.0_文档 发布时间: 20250826

9. 资源加载 · LayaAir3.3 · 引擎文档 · LAYABOX [ 81%]

... 不带类型,用于常规的资源 */}); 完整的脚本示例如下: const { regClass, property } = Laya; @regClass() export class LoaderDemo extends Laya.Script { onAwake(): void { this.loadTexture("resources/image/monkey2.png", 500);//需要在resources/image放入相应的资源 this.loadTe...

来源: Laya3.0_文档 发布时间: 20251010

10. 2D光遮挡器与阴影 · LayaAir3.3 · 引擎文档 · LAYABOX [ 81%]

...ene2D节点后,加入下述代码,实现一个光遮挡器的效果: const { regClass, property } = Laya; @regClass() export class LightOccluder extends Laya.Script { private spotLight: Laya.Sprite = new Laya.Sprite(); private background: Laya.Sprite = new Laya.Sprite(); private lightOccluder:...

来源: Laya3.0_文档 发布时间: 20251010