Пример #1
0
  /**
   * 游客cmd请求
   *
   * @param requestId 请求Id
   * @param cmd cmd
   * @param connectKey 游客Id
   * @param visitor 游客
   * @param param 请求参数
   */
  @SuppressWarnings("unchecked")
  public void handleVisitorRequest(
      int requestId, CmdType cmd, ConnectKey connectKey, Visitor visitor, Object param) {

    @SuppressWarnings("rawtypes")
    IRequestHandler handler = visitorCmdMapHandler.get(cmd);
    if (handler == null) {

      eventManager
          .getRequestUnknowCmdHandler()
          .visitorRequestUnknowCmd(connectKey, visitor, cmd, param);

    } else {

      visitorRequestFilter.doFilter(
          connectKey, visitor, (IRequestHandler<Visitor, Object>) handler, requestId, param);
    }
  }
Пример #2
0
  /**
   * 用户cmd请求
   *
   * @param requestId 请求Id
   * @param cmd cmd
   * @param user 用户
   * @param param 请求参数
   */
  public void handleUserRequest(int requestId, CmdType cmd, User user, Object param) {

    if (user != null) {

      @SuppressWarnings("rawtypes")
      IRequestHandler handler = userCmdMapHandler.get(cmd);
      if (handler == null) {

        eventManager
            .getRequestUnknowCmdHandler()
            .userRequestUnknowCmd(user.getUserKey(), user, cmd, param);

      } else {

        userRequestFilter.doFilter(user.getUserKey(), user, handler, requestId, param);
      }
    }
  }