/// <summary> /// 移除监听事件 /// </summary> public override void RemoveListener() { HandlerMediat.RemoveAllListener(OperationCode.Login); HandlerMediat.RemoveAllListener(OperationCode.Register); }
/// <summary> /// 注册监听事件 /// </summary> public override void AddListener() { HandlerMediat.AddListener(OperationCode.Login, OnLoginReceived); HandlerMediat.AddListener(OperationCode.Register, OnRegisterReceived); }
//当我们在客户端向服务器端发起请求后,服务器端接受处理这个请求给客户端一个响应就会在这个方法里进行处理 public void OnOperationResponse(OperationResponse operationResponse) { MessageCode code = (MessageCode)operationResponse.OperationCode;//得到响应的OperationCode HandlerMediat.Dispatch(code, operationResponse); }
public override void RemoveListener() { HandlerMediat.RemoveListener(OperationCode.SyncPlayer, OnSyncPlayerReceived); }
public override void RemoveListener() { HandlerMediat.RemoveListener(MessageCode.AddPlayer, OnSyncAddPlayerReceived); }
/// <summary> /// 移除监听事件 /// </summary> public override void RemoveListener() { HandlerMediat.RemoveAllListener(MessageCode.Login); HandlerMediat.RemoveAllListener(MessageCode.Register); }