大约有 11 项符合查询结果, 库内数据总量为 31,580 项。 (搜索耗时: 0.0069 秒)
...动实体行为。 当开发者继承了 LayaAir 组件脚本类( Laya.Script )后,即可使用引擎提供的一系列生命周期方法(如 onAwake、onEnable、onUpdate 等)和事件响应方法(如 onMouseDown、onMouseClick 等)。这些内置方法作为组件脚本的逻辑执...
来源: Laya3.0_文档 发布时间: 20251010
...擎中,组件和系统的职责融合在组件脚本(即继承自 Laya.Script 的类)中体现: 组件部分:通过类中的属性字段或访问器承担组件的数据职责,通常使用 @property() 装饰器标记这些字段,将其暴露到IDE属性面板,方便开发者进行可...
来源: Laya3.0_文档 发布时间: 20251010
...roperty } = Laya; @regClass() export default class DirectMove extends Laya.Script { declare owner: Laya.Sprite3D; private characterController: Laya.CharacterController; onAwake(): void { // 获取 角色控制器 组件并赋值给 characterController this.characterController = this.owner.getCompone...
来源: Laya3.0_文档 发布时间: 20251010
...有: 3.1 2D和3D统一接口, 都可以通过事件监听方式和Laya.Script命名函数方式处理输入。例如: this.aNode.on(Laya.Event.CLICK, ()=> { console.log("clicked"); }); class MyScript extends Laya.Script { //脚本事件 onMouseClick(e:Event) { console.log("clicked"); } } aN...
来源: Laya3.0_文档 发布时间: 20251010
... 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; // 一个完整周期的秒数 private displayText: Laya.Text; // 文本显示当...
来源: Laya3.0_文档 发布时间: 20251010
...{ regClass } = Laya; @regClass() export class LightEffectDemo extends Laya.Script { declare owner: Laya.Sprite; private lightComp: Laya.FreeformLight2D; private rotateSpeed: number = 2; // 增加旋转速度 private scaleTime: number = 0; private scaleSpeed: number = 3; // 增加缩放速度 private...
来源: Laya3.0_文档 发布时间: 20251010
...击操作,IDE会弹窗提示创建UI组件脚本文件,默认是RuntimeScript.ts,开发者可以对其进行重命名,最后点击保存即可创建脚本。 (动图2-1) 可以看到,创建以后,除了生成RuntimeScript.ts之外,在项目工程中看到还多了一个 RuntimeScri...
来源: Laya3.0_文档 发布时间: 20251010
...lt; } 最后,在LayaExtInit函数中,导出初始化功能,使得JavaScript代码可以调用这些原生功能。 extern "C" { LAYAEXTAPI void LayaExtInit(jsvm_env env, jsvm_value exp) { ... // 注册Steam初始化函数 jsvm_value fnInitSteam; jsvm_create_function(env, "initializeSteam", SIZ...
来源: Laya3.0_文档 发布时间: 20251010
...** * 在节点上添加2D拖尾渲染器的示例代码 */ export class NewScript extends Laya.Script { declare owner: Laya.Sprite; private _trail2D: Laya.Trail2DRender; //从场景文件中获取到的宽度曲线数据 private _widthCurve: any[]; //从场景文件中获取到的颜色渐变数据 ...
来源: Laya3.0_文档 发布时间: 20251010
... const { regClass, property } = Laya; @regClass() export class CameraMoveScript extends Laya.Script3D { /** @private */ protected _tempVector3: Laya.Vector3 = new Laya.Vector3(); protected lastMouseX: number = 0; protected lastMouseY: number = 0; protected yawPitchRoll: Laya.Vector3 = new Laya.Vecto...
来源: Laya3.0_文档 发布时间: 20251010