BasePanel.ts 668 B

12345678910111213141516171819202122232425262728
  1. import { _decorator, Button, Component, Node } from 'cc';
  2. import { UIManager } from './UIManager';
  3. import ch_audio from '../../ch/audio/audio';
  4. const { ccclass, property } = _decorator;
  5. //面板基础类
  6. @ccclass('BasePanel')
  7. export class BasePanel extends Component {
  8. private CloseBtn: Button;//关闭按钮
  9. onLoad() {
  10. this.CloseBtn = this.node.getChildByName('Close_Btn').getComponent(Button);
  11. this.CloseBtn.node.on(Button.EventType.CLICK,this.onClose,this);
  12. }
  13. onClose(callback){
  14. ch_audio.getInstance().playOneShot('Click');
  15. UIManager.Instance.hideUI(callback);
  16. }
  17. onEnter(){
  18. }
  19. onExit(){
  20. }
  21. }