Exemplo n.º 1
0
 public async Task SendRequest <T>(string serviceUri, HttpRequestBase request, Action <T> callback) where T : HttpResponseBase, new()
 {
     if (typeof(T) == typeof(CreateRoomResponse))
     {
         var roomId = _createRoomDelegate(_roomProperties, _gameApplication, ((CreateRoomRequest)request).RoomId);
         callback(new CreateRoomResponse(roomId) as T);
     }
     else
     if (typeof(T) == typeof(GetServerInfoListResponse))
     {
         callback(FakeSender.CreateGetServerInfoListResponse <T>() as T);
     }
     else
     if (typeof(T) == typeof(ValidateSessionIdResponse))
     {
         callback(new ValidateSessionIdResponse()
         {
             ResultCode = ResultCode.OK
         } as T);
     }
     else
     {
         callback(new T());
     }
 }
Exemplo n.º 2
0
        public async Task <T> SendRequest <T>(string serviceUri, HttpRequestBase request) where T : HttpResponseBase, new()
        {
            if (typeof(T) == typeof(CreateRoomResponse))
            {
                var roomId = _createRoomDelegate(_roomProperties, _gameApplication, ((CreateRoomRequest)request).RoomId);
                return(new CreateRoomResponse(roomId) as T);
            }
            if (typeof(T) == typeof(UpdateRoomResponse))
            {
                var req = request as UpdateRoomRequest;
                _updateRoomDelegate(req.RoomId, _gameApplication);
                return(new UpdateRoomResponse() as T);
            }

            if (typeof(T) == typeof(GetServerInfoListResponse))
            {
                return(FakeSender.CreateGetServerInfoListResponse <T>() as T);
            }
            ;

            return(new T());
        }