想实现某个节点显示的时候 此节点外部的其他节点均不可点击互动,请问该如何实现?
搞新手引导?
愿意讲讲吗
你要的应该是block input Events组件
反向矩形遮罩Mask+block input Events
把这个节点的id(或其它)存到全局,在canvas上注册点击事件,判断节点id是否一致,不一致直接拦截,最简单有效的方法了
你这个逻辑得在底层派发事件时拦截了,监听事件中不能拿到触摸节点的信息。这个跟冒泡机制有关系
!#zh 封装了触摸相关的信息。 */
export class Touch {
/**
!#en Returns the current touch location in OpenGL coordinates.、
!#zh 获取当前触点位置。
*/
getLocation(): Vec2;
/**
!#en Returns X axis location value.
!#zh 获取当前触点 X 轴位置。
*/
getLocationX(): number;
/**
!#en Returns Y axis location value.
!#zh 获取当前触点 Y 轴位置。
*/
getLocationY(): number;
/**
!#en Returns the previous touch location in OpenGL coordinates.
!#zh 获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
*/
getPreviousLocation(): Vec2;
/**
!#en Returns the start touch location in OpenGL coordinates.
!#zh 获取触点落下时的位置对象,对象包含 x 和 y 属性。
*/
getStartLocation(): Vec2;
/**
!#en Returns the delta distance from the previous touche to the current one in screen coordinates.
!#zh 获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
*/
getDelta(): Vec2;
/**
!#en Returns the current touch location in screen coordinates.
!#zh 获取当前事件在游戏窗口内的坐标位置对象,对象包含 x 和 y 属性。
*/
getLocationInView(): Vec2;
/**
!#en Returns the previous touch location in screen coordinates.
!#zh 获取触点在上一次事件时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
*/
getPreviousLocationInView(): Vec2;
/**
!#en Returns the start touch location in screen coordinates.
!#zh 获取触点落下时在游戏窗口中的位置对象,对象包含 x 和 y 属性。
*/
getStartLocationInView(): Vec2;
/**
!#en Returns the id of cc.Touch.
!#zh 触点的标识 ID,可以用来在多点触摸中跟踪触点。
*/
getID(): number;
/**
!#en Sets information to touch.
!#zh 设置触摸相关的信息。用于监控触摸事件。
@param id id
@param x x
@param y y
*/
setTouchInfo(id: number, x: number, y: number): void;
}
你是在回复我么?event.target就可以拿到