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

大约有 72 项符合查询结果, 库内数据总量为 30,723 项。 (搜索耗时: 0.0036 秒)

1. 插件开发说明 · LayaAir3.0文档 · LAYABOX [ 100%]

...代码 //注意:IEditorEnv.regClass是必须的 @IEditorEnv.regClass() export class TestSceneScript { //注意:this是当前的IEditorEnv.IGameScene对象,如果不需要,也可以省略这个声明 static test(this: IEditorEnv.IGameScene, msg: string) { console.log(msg); //hello return "ok"...

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

2. 定时器 · LayaAir3.0文档 · LAYABOX [ 94%]

...import { RuntimeScriptBase } from "./RuntimeScript.generated"; @regClass() export class RuntimeScript extends RuntimeScriptBase { onAwake(): void { //60帧后,图片的透明度变为0.5 Laya.timer.frameOnce(60, this, () => { this.Image.alpha = 0.5; }) } } 1.2 定时重复执行 (基于帧率) ...

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

3. 视频节点 · LayaAir3.0文档 · LAYABOX [ 88%]

...脚本控制VideoNode: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { @property({ type: Laya.VideoNode }) public video: Laya.VideoNode; constructor() { super(); } // 组件被激活后执行,此时所有节点和组件均已创建完毕,此方法...

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

4. UI滤镜效果 · LayaAir3.0文档 · LAYABOX [ 88%]

...,示例代码如下: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { // 获得Image组件 @property({ type: Laya.Image }) public img: Laya.Image; //组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次 on...

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

5. 程序蓝图 · LayaAir3.0文档 · LAYABOX [ 87%]

...; @bpClass({ name:"TestBluePrint", canInherited: true, extends:"Script" }) export class TestBluePrint extends Laya.Script { } 需要注意的是,只有注册了构造函数,才可以在蓝图编辑器的createNew中创建这个类的实例,如图12-1所示。 const { bpClass } = BP; @bpClass({...

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

6. 资源加载 · LayaAir3.0文档 · LAYABOX [ 84%]

...的脚本示例如下: const { regClass, property } = Laya; @regClass() export class LoaderDemo extends Laya.Script { onAwake(): void { this.loadTexture("resources/image/monkey2.png", 500);//需要在resources/image放入相应的资源 this.loadTexture("https://layaair.com/3.x/demo/resources/res/...

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

7. 3D变换 · LayaAir3.0文档 · LAYABOX [ 83%]

...1,示例代码如下: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { @property({ type: Laya.Sprite3D }) public cube: Laya.Sprite3D; // 平移距离 private translate: Laya.Vector3 = new Laya.Vector3(1, 1, 1); constructor() { super(); } /** * 组件...

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

8. 开放数据域组件 · LayaAir3.0文档 · LAYABOX [ 81%]

...制OpenDataContextView: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { //declare owner : Laya.Sprite3D; @property({ type: Laya.OpenDataContextView }) public opendata: Laya.OpenDataContextView; constructor() { super(); } /** * 组件被激活后执行...

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

9. 弹窗视图组件 · LayaAir3.0文档 · LAYABOX [ 81%]

...import { RuntimeScriptBase } from "./RuntimeScript.generated"; @regClass() export class RuntimeScript extends RuntimeScriptBase { onAwake(): void { this.closeBtn.on(Laya.Event.CLICK, this, () => { this.close(); }); } } 1.3.3 关联场景 设置好弹窗之后,需要用代码将Dialog与所需...

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

10. 组件装饰器说明 · LayaAir3.0文档 · LAYABOX [ 80%]

...ass(),示例代码如下所示: const { regClass } = Laya; @regClass() export class Script extends Laya.Script { } 如动图1-1所示,只有使用了上述的这个装饰器标识,开发者自定义的组件脚本才会被IDE识别为组件,可以被节点(实体)的属性设置面板 ...

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