btn_hui.ts 747 B

1234567891011121314151617181920212223242526272829
  1. import { _decorator, Component, Node, Button, EventHandler, NodeEventType } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('btn_hui')
  4. export class btn_hui extends Component {
  5. @property(Node) btn_an_xia_hui:Node = null;
  6. start() {
  7. this.node.on(NodeEventType.MOUSE_DOWN, ()=>{
  8. this.btn_an_xia_hui.active = true;
  9. }, this);
  10. this.btn_an_xia_hui.active = false;
  11. }
  12. update(deltaTime: number) {
  13. if(this.node.scale.x===1){
  14. if(this.btn_an_xia_hui.active){
  15. this.btn_an_xia_hui.active = false;
  16. }
  17. }else{
  18. if(!this.btn_an_xia_hui.active){
  19. this.btn_an_xia_hui.active = true;
  20. }
  21. }
  22. }
  23. }