public IActorHandler GetHandler(Base.Message.Message msg) { Type type = msg.GetType(); IActorHandler ret = null; mHandler.TryGetValue(type, out ret); return(ret); }
public void Awake(ActorHandlerType handlerType) { switch (handlerType) { case ActorHandlerType.Gate: ActorHandler = new GateActorHandler(); break; case ActorHandlerType.Common: ActorHandler = new CommonActorHandler(); break; } ActorMessages.Clear(); AddLocaltion(); }
public virtual async void OnMessage() { while (true) { if (mMails.Count > 0) { Base.Message.Message m = mMails.Dequeue(); await Task.Run(() => { Status = STATUS.PROCESSING; IActorHandler handler = ActorDispacher.Instance.GetHandler(m); if (null != handler) { handler.Handle(m); } }); } else { break; } } }
public void Awake() { ActorHandler = new CommonActorHandler(); ActorMessages.Clear(); AddLocaltion(); }
public void AddHandler(Type msgType, Type handlerType) { IActorHandler handler = (IActorHandler)System.Activator.CreateInstance(handlerType); mHandler[msgType] = handler; }