touch_chuan_tou.ts 481 B

123456789101112131415161718
  1. import { Component, _decorator } from "cc";
  2. const { ccclass, property } = _decorator;
  3. /**
  4. * 该组件将所属节点内的所有输入事件穿透到下层节点,一般用于上层 UI 的背景。
  5. * 该组件没有任何 API 接口,直接添加到场景即可生效。
  6. */
  7. @ccclass
  8. export class ThroughInputEvents extends Component{
  9. onLoad(): void {
  10. // this.node.preventSwallow
  11. // (this.node as any)._touchListener.setSwallowTouches(false);
  12. }
  13. }