예제 #1
0
        /// <summary>
        /// Возвращает данные о транспорте салона и игрока
        /// </summary>
        private Task <Tuple <string, string> > SerializeVehicles(Client player, ShowroomType type)
        {
            var showroomVehiclesData = JsonConvert.SerializeObject(ShowroomsGetter.GetVehicles(type));
            var playerVehicles       = new List <ShowroomVehicle>();

            foreach (var vehicle in _playerInfoManager.GetInfo(player).Vehicles.Values)
            {
                var price = ShowroomsGetter.GetSellPrice(vehicle.Hash);
                if (Validator.IsValid(price))
                {
                    playerVehicles.Add(new ShowroomVehicle {
                        Id = (int)vehicle.Id, Hash = vehicle.Hash, Price = price
                    });
                }
            }
            var playerVehiclesData = JsonConvert.SerializeObject(playerVehicles);

            return(Task.FromResult(new Tuple <string, string>(showroomVehiclesData, playerVehiclesData)));
        }
예제 #2
0
 /// <summary>
 /// Возвращает продаваемый в салоне транспорт
 /// </summary>
 internal static IEnumerable <ShowroomVehicle> GetVehicles(ShowroomType type)
 {
     return(type == ShowroomType.Cheap ? CheapVehicles : ExpensiveVehicles);
 }