[0]Laya tiledmap 监听事件未响应
private tiledMap: Laya.TiledMap
/** */
private onLost() {
this.tiledMap = new Laya.TiledMap();
this.tiledMap.createMap("resource/tiledMap/isometric_grass_and_water.json", new Rectangle(0, 0, Laya.stage.width, Laya.stage.height), Handler.create(this, this.mapLoaded), null, new Point(1600, 800));
}
private mapLoaded(): void {
let _mapSprite = this.tiledMap.mapSprite();
_mapSprite.mouseEnabled = true;
_mapSprite.hitTestPrior = true;
Laya.stage.focus = _mapSprite;
let event = _mapSprite.on(Laya.Event.CLICK, this, () => {
LogUtil.w("响应点击事件")
})
}
尝试使用focus 好像也没有响应 请问大佬们能解答一下吗
/** */
private onLost() {
this.tiledMap = new Laya.TiledMap();
this.tiledMap.createMap("resource/tiledMap/isometric_grass_and_water.json", new Rectangle(0, 0, Laya.stage.width, Laya.stage.height), Handler.create(this, this.mapLoaded), null, new Point(1600, 800));
}
private mapLoaded(): void {
let _mapSprite = this.tiledMap.mapSprite();
_mapSprite.mouseEnabled = true;
_mapSprite.hitTestPrior = true;
Laya.stage.focus = _mapSprite;
let event = _mapSprite.on(Laya.Event.CLICK, this, () => {
LogUtil.w("响应点击事件")
})
}
尝试使用focus 好像也没有响应 请问大佬们能解答一下吗
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
Laya_Fred
赞同来自: 1664438121用户