import { GameState } from "./GameManager";

 export enum EventType{ScoreChange,MoneyChange,GetMoney,InputState,Hover,extraspeedtime,speed,flytime,OnLand,OutLand,ChangeStage,GetRoadPoint,EnterStage,CompleteStage,crownchange,PlayerRank}

export class EventManager
{
    static mDispatcher:Laya.EventDispatcher = new Laya.EventDispatcher();
    public static EventOn(_type:EventType,caller:any,_listance:Function)
    {
        this.mDispatcher.on(EventType[_type],caller,_listance);
    }

    public static EventOff(_type:EventType,caller:any,_listance:Function)
    {
        this.mDispatcher.off(EventType[_type],caller,_listance);
    }

    public static EventTrigger(_type:EventType,data = null)
    {
        this.mDispatcher.event(EventType[_type],data);
    }

    public static GameStateEventOn(_type:GameState,caller:any,_listance:Function)
    {
        this.mDispatcher.on(GameState[_type],caller,_listance);
    }

    public static GameStateEventOff(_type:GameState,caller:any,_listance:Function)
    {
        this.mDispatcher.off(GameState[_type],caller,_listance);
    }

    public static GameStateEventTrigger(_type:GameState,data = null)
    {
        this.mDispatcher.event(GameState[_type],data);
    }
}
