大约有 12 项符合查询结果, 库内数据总量为 30,900 项。 (搜索耗时: 0.0062 秒)
... ```typescript //单模块 declare module '*.glsl' { const value: string; export default value; } declare module CANNON { //在声名的模块里定义类型 export class Demo { constructor( options: Object ); addScene( title: string, initfunc: Function ): void; restartCurrentScene(): void; } } //...
来源: Laya2.0_文档 发布时间: 20210715
...ass(),示例代码如下所示: const { regClass } = Laya; @regClass() export class Script extends Laya.Script { } 如动图1-1所示,只有使用了上述的这个装饰器标识,开发者自定义的组件脚本才会被IDE识别为组件,可以被节点(实体)的属性设置面板 ...
来源: Laya3.0_文档 发布时间: 20250103
...脚本,实现子弹飞行逻辑及对象池回收机制 */ @regClass() export default class Bullet extends Laya.Script { constructor() { super(); } onEnable(): void { //设置初始速度 let rig: Laya.RigidBody = this.owner.getComponent(Laya.RigidBody); rig.setVelocity({ x: 0, y: -10 }); } onTrig...
来源: Laya3.0_文档 发布时间: 20250103
...2.0的版本开始,我用ts编写的相关内容,都要使用import和export吗? 【带附件】 使用Laya2.0.0beta5.1 发布官方示例 真机报错 window is not defined 求高人分享使用protobuff框架的游戏demo(TS版本或AS版本的) 如何通过命令行工具构建和发布...
来源: Laya_社区 发布时间: 20201223
...代码 //注意:IEditorEnv.regClass是必须的 @IEditorEnv.regClass() export class TestSceneScript { //注意:this是当前的IEditorEnv.IGameScene对象,如果不需要,也可以省略这个声明 static test(this: IEditorEnv.IGameScene, msg: string) { console.log(msg); //hello return "ok"...
来源: Laya3.0_文档 发布时间: 20250214
...2.0的版本开始,我用ts编写的相关内容,都要使用import和export吗? 关于Laya实现Matter.js官方案例凹多边形的问题 laya2的Scene默认是文件模式,不会生成场景类了,此时该如何获得场景内的元素 Laya2.6.0beta 物理引擎 刚体碰撞点位置...
来源: Laya_社区 发布时间: 20170822
...b.ts代码如下所示: ```javascript /** * 分包 */ module subpackage{ export class b{ private GameMain:any; private ui:any; constructor(){ //监听按钮btnA的点击事件,触发后处理 this.GameMain.newUI.btnA.on(Laya.Event.CLICK, this, this.showB); } //显示B页 private showB():void { t...
来源: Laya2.0_文档 发布时间: 20210715
...载代码示例如下: const { regClass, property } = Laya; @regClass() export class Script extends Laya.Script { //declare owner : Laya.Sprite3D; @property({ type: Laya.Scene3D }) scene3d: Laya.Scene3D; constructor() { super(); } /** * 组件被激活后执行,此时所有节点和组件均已...
来源: Laya3.0_文档 发布时间: 20250103
... 3.2.2 创建地图示例 const { regClass, property } = Laya; @regClass() export class Main extends Laya.Script { private tMap:Laya.TiledMap; onEnable() { //创建地图对象 this.tMap = new Laya.TiledMap(); //创建Rectangle实例,视口区域 var viewRect:Laya.Rectangle = new Laya.Rectangle(0,...
来源: Laya3.0_文档 发布时间: 20240910
...载代码示例如下: const { regClass, property } = Laya; @regClass() export class Script extends Laya.Script { //declare owner : Laya.Sprite3D; @property({ type: Laya.Scene3D }) scene3d: Laya.Scene3D; constructor() { super(); } /** * 组件被激活后执行,此时所有节点和组件均已...
来源: Laya3.0_文档 发布时间: 20250103