悉野小楼

导航

2025年12月11日

laya列表时计算具体体子项是列表中第几个

摘要: laya列表时计算具体体子项是列表中第几个let itemIdx = this.parent.getChildIndex(this); 阅读全文

posted @ 2025-12-11 19:03 悉野 阅读(3) 评论(0) 推荐(0)

2025年12月5日

子弹射击

摘要: Bullet.ts private _lastCheckPos:Laya.Point = new Laya.Point(0, 0); // 上次检测的位置 /** * 检查两条线段是否相交 * 线段1: (x1, y1) -> (x2, y2) * 线段2: (x3, y3) -> (x4, y4) 阅读全文

posted @ 2025-12-05 21:05 悉野 阅读(3) 评论(0) 推荐(0)

laya给自己画边框

摘要: laya给自己画边框 this.graphics.drawRect(0,0,this.width,this.height, "#ccff00", "#ff0000", 2) this.graphics.strokeText(id + "", 30, 0, "", "#ff0000", 20, "") 阅读全文

posted @ 2025-12-05 19:57 悉野 阅读(4) 评论(0) 推荐(0)

2025年11月18日

查看laya已经加载的资源

摘要: Laya.Loader.loadedMap 不是Laya.loader, loadedMap是static的, 在Loader类中定义的. 阅读全文

posted @ 2025-11-18 20:16 悉野 阅读(7) 评论(0) 推荐(0)

2025年10月27日

laya spine事件

摘要: // 加载完成事件 this.spine.on(Laya.Event.READY, this, ()=>{ let skinName: string = "test"; // 更换已存在的皮肤 this.spine.showSkinByName(skinName); }); // spine触发事件 阅读全文

posted @ 2025-10-27 11:05 悉野 阅读(2) 评论(0) 推荐(0)

2025年10月11日

laya自定义滚动条

摘要: 滚动条不是纯色, 不好缩放, 可以使用蒙版自己移动图片 testBar是滚动条, 使用jdt.png, jdt$bar是个透明图片. bar2蓝色的图, 使用barMask做蒙版 const { regClass, property } = Laya; @regClass() export clas 阅读全文

posted @ 2025-10-11 20:41 悉野 阅读(9) 评论(0) 推荐(0)

2025年10月8日

laya 武器旋转砍怪判断

摘要: typescript代码: export interface IMonster extends Laya.Node { id: number; isDie:boolean; getPoint(): Laya.Point; getHitRect():Laya.Rectangle; } export c 阅读全文

posted @ 2025-10-08 16:57 悉野 阅读(12) 评论(0) 推荐(0)

2025年9月30日

laya列表连续请求例子

摘要: laya列表连续请求例子, 分页请求数据, 使用的是Laya 3.0.10版本 export class TestPanel extends TestPanelBase { private _packetData: any = []; // 列表数据 private _pageSize: numbe 阅读全文

posted @ 2025-09-30 14:17 悉野 阅读(8) 评论(0) 推荐(0)

2025年9月2日

typescript单例 例子

摘要: //例子1:GameManager.ts export default class GameManager { private static _instance: GameManager; public static get instance(): GameManager { if (!this._ 阅读全文

posted @ 2025-09-02 17:58 悉野 阅读(10) 评论(0) 推荐(0)

2025年8月25日

for..of 与 for..in 语句

摘要: 参考: for ...in 遍历key, for...of遍历值 for..of 和 for..in 语句都遍历列表;但是,迭代的值不同,for..in 返回被迭代对象的键列表,而 for..of 返回被迭代对象的数字属性的值列表。 Both for..of and for..in statemen 阅读全文

posted @ 2025-08-25 11:23 悉野 阅读(3) 评论(0) 推荐(0)