大约有 8 项符合查询结果, 库内数据总量为 31,560 项。 (搜索耗时: 0.0041 秒)
...try.ts,示例代码如下: export async function main() { console.log("Hello LayaAir!"); //加载场景并打开场景 Laya.Scene.open('Scene.ls'); } 然后,我们在项目设置的脚本编译栏中,找到脚本编译选项分类下的启动脚本设置项, 通过输入框右侧的脚本...
来源: Laya3.0_文档 发布时间: 20251103
...tatic test(this: IEditorEnv.IGameScene, msg: string) { console.log(msg); //hello return "ok"; } } //下面是UI进程的代码 let ret = await Editor.scene.runScript("TestSceneScript.test", "hello"); console.log(ret); //ok 特别的用法,可以通过window对象调用eval执行脚本,用于一...
来源: Laya3.0_文档 发布时间: 20251010
... <view id="container"> <text id="testText" class="redText" value="hello canvas"></text> </view> `; // 以键值对的形式定义开放数据域的样式和布局 let style = { container: { width: 400, height: 200, backgroundColor: "#ffffff", justifyContent: "center", alignIt...
来源: Laya3.0_文档 发布时间: 20251010
...是当前时间戳。 const greetingMessage = { user: "LayaAir", message: "Hello, Server!", timestamp: Date.now() }; //调用 encode 方法,将 greetingMessage 对象编码为二进制格式(即序列化),通过.finish()返回一个 Uint8Array类型的二进制缓冲区。 const greetingBuff...
来源: Laya3.0_文档 发布时间: 20251010
... 发送字符串数据示例: // 发送字符串数据 this.socket.send("Hello, LayaAir!"); 服务器收到的数据直接为字符串,客户端接收后也直接处理即可。 接收字符串数据的完整示例: const { regClass } = Laya; @regClass() export class WebSocketDemo extends Laya...
来源: Laya3.0_文档 发布时间: 20251010
...流程 3.1 基础使用流程 开发者可以参考文档《开发流程: Hello World》了解整体的开发流程,其中包括了环境配置、创建项目、基本设置、运行调试等一些必会的操作。 3.2 UI编辑 在LayaAir中,如果是纯2D的项目,则直接删除场景中的...
来源: Laya3.0_文档 发布时间: 20251010
...s.getChild("xx"); //this.xx.on(Laya.Event.CLICK, this, this.onClick); } sayHello() { console.log("Hello from MyItem"); } } //设置列表的item的Runtime为MyItem aList.itemPool.defaultRuntime = MyItem; //设置了item的Runtime后,itemRenderer可以直接访问到MyItem的方法和属性 aList.i...
来源: Laya3.0_文档 发布时间: 20251128
...string或者是ArrayBuffer。 发送字符串格式: this.socket.send("hello world");//这是发送字符串的形式。 发送二进制格式的数据: //写入一个字节 this.byte.writeByte(1); //写入一个int16的数据 this.byte.writeInt16(20); //写入一个32位的浮点数据 this.byt...
来源: Laya3.0_文档 发布时间: 20250104