大约有 148 项符合查询结果, 库内数据总量为 31,671 项。 (搜索耗时: 0.0036 秒)
...也直接处理即可。 接收字符串数据的完整示例: const { regClass } = Laya; @regClass() export class WebSocketDemo extends Laya.Script { private socket: Laya.Socket; //组件被启用后执行,例如节点被添加到舞台后 onEnable(): void { this.socket = new Laya.Socket(); // ...
来源: Laya3.0_文档 发布时间: 20251010
...,讲解生命周期方法,以下是此脚本文件的代码: const { regClass, property } = Laya; /** * 子弹脚本,实现子弹飞行逻辑及对象池回收机制 */ @regClass() export default class Bullet extends Laya.Script { constructor() { super(); } onEnable(): void { //设置初始...
来源: Laya3.0_文档 发布时间: 20251010
...ort Loader = Laya.Loader; import SpineTemplet = Laya.SpineTemplet; const { regClass, property } = Laya; @regClass() export class Main extends Laya.Script { private skeleton: SpineSkeleton; private index: number = -1; public pageWidth: number; public pageHeight: number; onStart() { console.log("Game ...
来源: Laya_社区 发布时间: 20230703
...载Spine动画资源,然后添加spine组件。 代码示例: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { @property({ type: Laya.Sprite }) public sprite: Laya.Sprite; private spine: Laya.Spine2DRenderNode; private index: number = -1; //组件被...
来源: Laya3.0_文档 发布时间: 20250104
...Joystick } from "./Joystick"; import { Player } from "./Player"; const { regClass, property } = Laya; @regClass() export class Main extends Laya.Script { @property({ type: Laya.Sprite }) public player: Laya.Sprite; @property({ type: Laya.Sprite }) public joystick: Laya....
来源: Laya_社区 发布时间: 20251125
...源的运行时库版本。 代码动态添加的示例如下: const { regClass, property } = Laya; @regClass() export class Demo extends Laya.Script { spine: Laya.Spine2DRenderNode; //组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次 onAwake(): vo...
来源: Laya3.0_文档 发布时间: 20251128
...引用的类,Laya.Templet 是用于处理资源 代码示例: const { regClass, property } = Laya; @regClass() export class Main extends Laya.Script { private mCurrIndex: number = 0; private mArmature: Laya.Skeleton; onStart() { console.log("Game start"); //加载内置骨骼动画资源 Laya.lo...
来源: Laya3.0_文档 发布时间: 20251010
...加类型注册,如 import {ui} from "./ui/layaMaxUI"; Laya.ClassUtils.regClass("ui.effectUI",ui.effectUI);但是感觉是生成的bug,这个应该自动生成在GameConfig里,求修复。。。现在太影响美术的协作效率了。 2018-12-13 1 1 分享 微博 QZONE 微信 董成 赞同...
来源: Laya_社区 发布时间: 20181213
...点后,加入下述代码,实现一个2D聚光灯的效果: const { regClass, property } = Laya; @regClass() export class SpotLight extends Laya.Script { @property({ type: Laya.Sprite }) private spotLight: Laya.Sprite; //组件被启用后执行,例如节点被添加到舞台后 onEnable(): ...
来源: Laya3.0_文档 发布时间: 20251010
...钮时,完成初始化。 import { extendLib } from "./extlib"; const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { @property({type: Laya.Button}) public initBtn: Laya.Button; onEnable(): void { this.initBtn.on(Laya.Event.CLICK, this.onInit); } onInit() { ...
来源: Laya3.0_文档 发布时间: 20251010