大约有 8 项符合查询结果, 库内数据总量为 31,560 项。 (搜索耗时: 0.0038 秒)
...脚本,而后添加的代码如下所示: const { regClass } = Laya; import { RuntimeScriptBase } from "./RuntimeScript.generated"; @regClass() export class RuntimeScript extends RuntimeScriptBase { onAwake(): void { // Button添加鼠标事件,让Image不显示 this.Button.on( Laya.Event.MOUS...
来源: Laya3.0_文档 发布时间: 20251010
...p,glob,pinyin, @svgdotjs/svg.js等。引用node内置模块可以使用import xx from "xx"的方式,所有IDE内置cjs模块都可以通过IEditor.require或者IEditorEnv.require去引用。 //可以通过import导入node内置模块 import fs from "fs"; import path from "path"; //也可以通...
来源: Laya3.0_文档 发布时间: 20251010
...ufDemo.ts // 引入生成的 protobuf 模块,路径相对于当前文件 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示例脚本 引入了protob...
来源: Laya3.0_文档 发布时间: 20251010
...1表示成功,0表示失败 } export const extendLib: IExtendLib = Laya.importNative("steam_demo.dll"); 然后在Scene2D上新建一个组件脚本,当点击按钮时,完成初始化。 import { extendLib } from "./extlib"; const { regClass, property } = Laya; @regClass() export class NewScrip...
来源: Laya3.0_文档 发布时间: 20251010
...Add(a: number, b: number): number; } export const testLib: ITestLib = Laya.importNative("LayaExt.dll"); 接着在组件脚本Main.ts中添加代码: import { testLib } from "./TestLib"; const { regClass, property } = Laya; @regClass() export class Main extends Laya.Script { onStart() { alert(testL...
来源: Laya3.0_文档 发布时间: 20251010
...,在RuntimeScript.ts中添加如下代码: const { regClass } = Laya; import { RuntimeScriptBase } from "./RuntimeScript.generated"; @regClass() export class RuntimeScript extends RuntimeScriptBase { onAwake(): void { this.closeBtn.on(Laya.Event.CLICK, this, () => { this.close(); }); } } 1.3....
来源: Laya3.0_文档 发布时间: 20251024
...面这两个TS代码: //MyScript.ts const { regClass, property } = Laya; import Animal from "./Animal"; @regClass() export class MyScript extends Laya.Script { @property({ type : Animal }) animal : Animal; } //Animal.ts const { regClass, property } = Laya; @regClass() export default class Animal {...
来源: Laya3.0_文档 发布时间: 20251010
...法的使用,示例代码如下: const { regClass, property } = Laya; import PhysicsGameMainRT from "../scence/physicsDemo/PhysicsGameMainRT"; /** * 掉落盒子脚本,实现盒子碰撞及回收流程 */ @regClass() export default class DropBox extends Laya.Script { /**盒子爆炸动画的...
来源: Laya3.0_文档 发布时间: 20251010