Esempio n. 1
0
        public void When_VehicleManager_Operation_To_Given_Coordinates_Then_It_Should_Proceed(string area, string position, string commands, string output)
        {
            IVehicleManager maneManager = VehicleManager.Create(area, position, commands);
            var             result      = maneManager.Operation();

            result.Should().Be(output);
        }
Esempio n. 2
0
        private static void Main(string[] args)
        {
            bool loopInterupt = false;

            while (!loopInterupt)
            {
                Console.WriteLine("Enter Grid Area:");
                var gridarea = Console.ReadLine();

                Console.WriteLine("Enter Position:");
                var position = Console.ReadLine();

                Console.WriteLine("Enter Command:");
                var command = Console.ReadLine();

                IVehicleManager vehicleManager = VehicleManager.Create(gridarea, position, command);
                var             result         = vehicleManager.Operation();

                Console.WriteLine(result);

                Console.WriteLine("For Exit 'X'");
                var key = Console.ReadKey();
                loopInterupt = key.Key == ConsoleKey.X;
            }
        }
Esempio n. 3
0
        public void When_Given_Coordinates_Are_Out_Of_Area_Then_It_Should_Throw_Exception(string area, string position, string commands, string output)
        {
            IVehicleManager maneManager = VehicleManager.Create(area, position, commands);

            Action action = () => maneManager.Operation();

            action.Should().Throw <ArgumentOutOfRangeException>();
        }
        // POST api/<controller>
        public Vehicle Post([FromBody] string value)
        {
            var vehicle = JsonConvert.DeserializeObject <Vehicle>(value);

            using (var manager = new VehicleManager())
            {
                return(manager.Create(vehicle));
            }
        }
Esempio n. 5
0
        public static void RemoteEvent_carroomBuy(Client player, string vName, string color)
        {
            try
            {
                Business biz = BusinessManager.BizList[player.GetData("CARROOMID")];
                NAPI.Entity.SetEntityPosition(player, new Vector3(biz.EnterPoint.X, biz.EnterPoint.Y, biz.EnterPoint.Z + 1.5));
                player.FreezePosition = false;

                Main.Players[player].ExteriorPos = new Vector3();
                Trigger.ClientEvent(player, "destroyCamera");
                NAPI.Entity.SetEntityDimension(player, 0);
                Dimensions.DismissPrivateDimension(player);

                var house = Houses.HouseManager.GetHouse(player, true);
                if (house == null && Main.Players[player].HotelID == -1)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас нет личного дома", 3000);
                    return;
                }



                if (house.GarageID == 0)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас нет гаража", 3000);
                    return;
                }
                var garage = Houses.GarageManager.Garages[house.GarageID];
                if (VehicleManager.getAllPlayerVehicles(player.Name).Count >= Houses.GarageManager.GarageTypes[garage.Type].MaxCars)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас максимальное кол-во машин", 3000);
                    return;
                }

                var prod = biz.Products.FirstOrDefault(p => p.Name == vName);
                if (Main.Players[player].Money < prod.Price)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Недостаточно средств", 3000);
                    return;
                }
                if (!BusinessManager.takeProd(biz.ID, 1, vName, prod.Price))
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Машин этой модели больше нет на складе", 3000);
                    return;
                }
                MoneySystem.Wallet.Change(player, -prod.Price);
                GameLog.Money($"player({Main.Players[player].UUID})", $"biz({biz.ID})", prod.Price, $"buyCar({vName})");

                var vNumber = VehicleManager.Create(player.Name, vName, carColors[color], carColors[color]);
                garage.SpawnCar(vNumber);
                Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"Вы купили {vName} с номером {vNumber}", 3000);
                Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"В скором времени она будет доставлена в Ваш гараж", 5000);
            }
            catch (Exception e) { Log.Write("CarroomBuy: " + e.Message, nLog.Type.Error); }
        }