EventManager.ts 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. //道具种类
  2. export enum PropEffecf{NONE,DOUBLE,HAMMER,UP,CLEARLAST,CLEARTWO }
  3. //舞台状态
  4. export enum StageMode{ReStart,Start,Lose,Win,Clone,Over,Revive,Refresh,Check};
  5. export class EventManager{
  6. private static Instance:Laya.EventDispatcher = new Laya.EventDispatcher();
  7. public static PropState:PropEffecf = PropEffecf.NONE;
  8. static EventOn(_mode:PropEffecf,caller:any,fun:Function,args = [])
  9. {
  10. EventManager.Instance.on(PropEffecf[_mode],caller,fun,args);
  11. }
  12. static EventOff(_mode:PropEffecf,caller:any,fun:Function,args = [])
  13. {
  14. EventManager.Instance.off(PropEffecf[_mode],caller,fun);
  15. }
  16. static EventTrigger(_mode:PropEffecf,args = [])
  17. {
  18. EventManager.Instance.event(PropEffecf[_mode],args);
  19. EventManager.PropState = _mode;
  20. }
  21. static StageOn(_mode:StageMode,caller:any,fun:Function,args = []){
  22. EventManager.Instance.on(StageMode[_mode],caller,fun,args);
  23. }
  24. static StageOff(_mode:StageMode,caller:any,fun:Function,args = []){
  25. EventManager.Instance.off(StageMode[_mode],caller,fun);
  26. }
  27. static StageTrigger(_mode:StageMode,args = []){
  28. EventManager.Instance.event(StageMode[_mode],args);
  29. }
  30. }