EventManager.ts 775 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { _decorator, EventTarget } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. /**
  4. * @description 本地存储管理
  5. */
  6. export class EventManager {
  7. static EventType = {
  8. Add_haert: 'Add_haert',
  9. Cut_haert: 'Cut_haert',
  10. Add_Score: 'Add_Score',
  11. Reset_Score: 'Reset_Score',
  12. Set_Add_Score_BOOL: 'Set_Add_Score_BOOL',
  13. Reset_Role: 'Reset_Role',
  14. Die_Role: 'Die_Role',
  15. OpenUIPnael: 'OpenUIPnael',
  16. }
  17. private static _instance: EventManager = null;
  18. static get instance() {
  19. if (this._instance) {
  20. return this._instance;
  21. }
  22. this._instance = new EventManager();
  23. return this._instance;
  24. }
  25. public et: EventTarget = new EventTarget();
  26. ClearAll() {
  27. this.et = null
  28. this.et = new EventTarget();
  29. }
  30. }