大约有 148 项符合查询结果, 库内数据总量为 31,671 项。 (搜索耗时: 0.0035 秒)
...启用等)自动执行相应的方法。 使用示例如下: const { regClass } = Laya; @regClass() export class NewScript extends Laya.Script { //被添加到节点后调用,和Awake不同的是即使节点未激活onAdded也会调用 onAdded(): void { console.log("Game onAdded"); } //组件...
来源: Laya3.0_文档 发布时间: 20251010
...=Laya.Dialog; import Scene=Laya.Scene; var REG: Function = Laya.ClassUtils.regClass; export module ui.test { export class TestSceneUI extends Laya.Scene { public scoreLbl:Laya.Label; public tipLbll:Laya.Label; constructor(){ super()} createChildren():void { super.crea...
来源: Laya_社区 发布时间: 20190402
...开发者自行在脚本里调用重绘API。 示例代码如下:const { regClass } = Laya; interface AnimatorPlayScriptInfo { animator: Laya.Animator2D; layerindex: number; playState: Laya.AnimatorState2D; } /** * 继承自AnimatorStateScript(动画状态脚本) */ @regClass() export class Animat...
来源: Laya_社区 发布时间: 20251010
...其暴露的属性入口中。需要添加如下的示例代码: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { @property({ type: Laya.ViewStack }) public viewstack: Laya.ViewStack; @property({ type: Laya.Tab }) public tab: Laya.Tab; //组件被激活...
来源: Laya3.0_文档 发布时间: 20251010
... (动图8) 3、代码创建Dialog组件 代码运行结果: const { regClass, property } = Laya; @regClass() export class UI_Dialog extends Laya.Script { private DIALOG_WIDTH: number = 220; private DIALOG_HEIGHT: number = 275; private CLOSE_BTN_WIDTH: number = 43; private CLOSE_BTN_PADDING: nu...
来源: Laya3.0_文档 发布时间: 20230303
...性入口中,在代码里给 Tree 对象赋值的示例如下: const { regClass, property } = Laya; @regClass() export class NewScript extends Laya.Script { @property({ type: Laya.Tree }) public tree: Laya.Tree; //组件被激活后执行,此时所有节点和组件均已创建完毕,此方...
来源: Laya3.0_文档 发布时间: 20251010
... import Event = Laya.Event; import HttpRequest = Laya.HttpRequest; const { regClass } = Laya; @regClass() export class Network_GET extends Laya.Script { private hr: HttpRequest; private logger: Laya.TextArea; private text: Laya.Label = new Laya.Label(); onAwake(): void { this.initUI(); this.connect(...
来源: Laya3.0_文档 发布时间: 20251010
..., Laya.Handler.create(this, this.onLoaded)) onLoaded(){ // Laya.ClassUtils.regClass('ui.TestPUI', ui.TestPUI) var efc = new ui.TestPUI(); Laya.stage.addChild(efc); } 按照官方文档,运行后报错 Main.js:61 Uncaught ReferenceError: ui is not defined 之前有人提过这个问题,但是一...
来源: Laya_社区 发布时间: 20210111
[LayaAir3]Pool对象池获取继承对象时会返回基类对象 const { regClass, property } = Laya; @regClass() export class Main extends Laya.Script { onStart() { let item1 = Laya.Pool.createByClass(TestClass); console.log('item1:', item1.type); Laya.Pool.recoverByClass(item1); let item2 = Laya...
来源: Laya_社区 发布时间: 20250819
...实现一个简单的昼夜更替效果。 示例代码如下: 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; // 一个完整周...
来源: Laya3.0_文档 发布时间: 20251010