ui_parent.ts 584 B

1234567891011121314151617181920
  1. import { _decorator, BlockInputEvents, Component, Node } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('ui_parent')
  4. export class ui_parent extends Component {
  5. private is_bolck:boolean = false
  6. update(deltaTime: number) {
  7. if(this.node.children.length<=0&&this.is_bolck){
  8. this.is_bolck = false
  9. this.getComponent(BlockInputEvents).enabled = false
  10. }
  11. if(this.node.children.length>0&&!this.is_bolck){
  12. this.is_bolck = true
  13. this.getComponent(BlockInputEvents).enabled = true
  14. }
  15. }
  16. }