Beispiel #1
0
 public Vehicle(VehicleColor color, string licensePlateNumber, bool hasPassenger)
 {
     _random            = new Random();
     Color              = color;
     LicensePlateNumber = licensePlateNumber;
     HasPassenger       = hasPassenger;
 }
Beispiel #2
0
 private void Start()
 {
     selectedColor      = raceStarter.vehicleColor;
     selectedColorIndex = Array.IndexOf(vehicleColors, selectedColor);
     bodyImage.color    = vehicleColors[selectedColorIndex].color;
     nameText.text      = selectedColor.name;
 }
Beispiel #3
0
 public PlayerDataOld()
 {
     Name = "";
     NumberPlate = "";
     Inventory = new List<Item>();
     Weapons = new List<WeaponDefinition>();
     Skills = GM.Copy(SkillRepository.Skills);
     Quests = GM.Copy(QuestRepository.Quests);
     Money = 1000;
     CompletedContracts = 0;
     Motive = PlayerMotive.Rebel;
     Gender = Gender.Male;
     Class = PlayerClass.Time_Master;
     CarColor = VehicleColor.MetallicClassicGold;
     CarSecondaryColor = VehicleColor.MetallicClassicGold;
     SkillSlots = new[]
                 {
                     new SkillSlot {Key = Keys.T},
                     new SkillSlot {Key = Keys.Y},
                     new SkillSlot {Key = Keys.CapsLock},
                     new SkillSlot {Key = Keys.U},
                     new SkillSlot {Key = Keys.B},
                 };
     Setup = new Setup();
     Tutorial = new Tutorial();
     LastContracts = new[] { "","","", "", "" };
     ModelVariations = new Dictionary<int, int>();
 }
Beispiel #4
0
 public static void SetColorOnVehicle(string colorType, VehicleColor color)
 {
     if ("Primary".Equals(colorType))
     {
         Game.PlayerPed.CurrentVehicle.Mods.PrimaryColor = color;
     }
     else if ("Secondary".Equals(colorType))
     {
         Game.PlayerPed.CurrentVehicle.Mods.SecondaryColor = color;
     }
     else if ("Pearlescent".Equals(colorType))
     {
         Game.PlayerPed.CurrentVehicle.Mods.PearlescentColor = color;
     }
     else if ("Rim".Equals(colorType))
     {
         Game.PlayerPed.CurrentVehicle.Mods.RimColor = color;
     }
     //else if ("Neon".Equals(colorType))
     //{
     //    Game.PlayerPed.CurrentVehicle.Mods.NeonLightsColor = color;
     //}
     //else if ("Tire smoke".Equals(colorType))
     //{
     //    Game.PlayerPed.CurrentVehicle.Mods.TireSmokeColor = color;
     //}
 }
Beispiel #5
0
        public Program()
        {
            ICommand                      _command               = new Command();
            ICheckCommand                 _checkCommand          = new CheckCommand(_command);
            ISlot                         _slot                  = new Slot();
            IParkingLotRepository         _parkingRepository     = new ParkingLotRepository();
            ICheckParkingLotCreated       checkParkingLotCreated = new CheckParkingLotCreated(_parkingRepository);
            ICommandExecutorSelector      createParkingLot       = new CreateParkingLot(_checkCommand, _slot, checkParkingLotCreated, _parkingRepository);
            IValidateVeicleDetails        _validateVeicleDetails = new ValidateVeicleDetails();
            IParkingVehicle               _parkingVehicle        = new ParkingVehicle();
            IParkSuccessMessage           _parkSuccessMessage    = new ParkSuccessMessage();
            ICommandExecutorSelector      park          = new Park(_checkCommand, _validateVeicleDetails, _parkingVehicle, _parkingRepository, _parkSuccessMessage);
            ISlotToEmpty                  _slotToEmpty  = new SlotToEmpty();
            IMaxSlotIndex                 _maxSlotIndex = new MaxSlotIndex();
            IValidateSlotNumberToEmpty    _validateSlotNumberToEmpty = new ValidateSlotNumberToEmpty(_parkingRepository, _maxSlotIndex);
            ILeaveSuccessMessage          _leaveSuccessMessage       = new LeaveSuccessMessage();
            ICommandExecutorSelector      leave           = new Leave(_checkCommand, _slotToEmpty, _validateSlotNumberToEmpty, _parkingRepository, _leaveSuccessMessage);
            IStatusOutput                 _statusOutput   = new StatusOutput();
            ICommandExecutorSelector      status          = new Status(_parkingRepository, _statusOutput);
            IVehicleColor                 _vehicleColor   = new VehicleColor();
            IVehicleByColor               _vehicleByColor = new VehicleByColor();
            IVehicleByColorSuccessMessage _vehicleByColorSuccessMessage = new VehicleByColorSuccessMessage();
            ICommandExecutorSelector      regNoByColor               = new RegistrationNumbersForCarsWithColour(_checkCommand, _vehicleColor, _parkingRepository, _vehicleByColor, _vehicleByColorSuccessMessage);
            ISlotByColor                  _slotByColor               = new SlotByColor();
            ISlotByColorMessage           _slotByColorMessage        = new SlotByColorMessage();
            ICommandExecutorSelector      slotNoByColor              = new SlotNumbersForCarsWithColour(_checkCommand, _vehicleColor, _parkingRepository, _slotByColor, _slotByColorMessage);
            IVehicleRegistrationNumber    _vehicleRegistrationNumber = new VehicleRegistrationNumber();
            ISlotByRegistrationNumber     _slotByRegistrationNumber  = new SlotByRegistrationNumber();
            ICommandExecutorSelector      slotByRegistration         = new SlotNumberForRegistrationNumber(_checkCommand, _vehicleRegistrationNumber, _parkingRepository, _slotByRegistrationNumber);

            ICommandExecutorSelector[] _selectors = { createParkingLot, park, leave, status, regNoByColor, slotNoByColor, slotByRegistration };
            _provider = new CommandExecutorProvider(_selectors);
        }
Beispiel #6
0
 public static void Command_SetVehicleColor([ConsoleCommandParameter(AutoCompleterType = typeof(ConsoleCommandAutoCompleterVehicleAliveOnly))] Vehicle vehicle,
                                            [ConsoleCommandParameter(AutoCompleterType = typeof(ConsoleCommandParameterAutoCompleterEnum))] VehiclePaint primary,
                                            [ConsoleCommandParameter(AutoCompleterType = typeof(ConsoleCommandParameterAutoCompleterEnum))] VehiclePaint secondary)
 {
     if (vehicle)
     {
         VehicleColor vehicleColor = new VehicleColor(primary, secondary);
         vehicle.SetColor(vehicleColor);
         List <string> log = new List <string>()
         {
             $"Vehicle: {vehicle.GetDisplayName()}",
             $"Manufacturer: {vehicle.GetMakeName()}",
             $"Primary Color:",
             $"     Name: {vehicleColor.PrimaryColorName}",
             $"     RGBA: {vehicleColor.PrimaryColorRGBA}",
             $"Secondary Color:",
             $"     Name: {vehicleColor.SecondaryColorName}",
             $"     RGBA: {vehicleColor.SecondaryColorRGBA}",
         };
         log.ForEach(Game.LogTrivial);
     }
     else
     {
         Game.LogTrivial("Vehicle doesn't exist");
     }
 }
Beispiel #7
0
 public static void Command_GetVehicleColor([ConsoleCommandParameter(AutoCompleterType = typeof(ConsoleCommandAutoCompleterVehicleAliveOnly))] Vehicle vehicle)
 {
     if (vehicle)
     {
         VehicleColor  vehicleColor = vehicle.GetColor();
         List <string> log          = new List <string>()
         {
             $"Vehicle: {vehicle.GetDisplayName()}",
             $"Manufacturer: {vehicle.GetMakeName()}",
             $"Primary Color:",
             $"     Name: {vehicleColor.PrimaryColorName}",
             $"     RGBA: {vehicleColor.PrimaryColorRGBA}",
             $"Secondary Color:",
             $"     Name: {vehicleColor.SecondaryColorName}",
             $"     RGBA: {vehicleColor.SecondaryColorRGBA}",
         };
         log.ForEach(Game.LogTrivial);
         Game.DisplaySubtitle($"Primary: <font color=\"{System.Drawing.ColorTranslator.ToHtml(vehicleColor.PrimaryColorRGBA)}\">{vehicleColor.PrimaryColorName}</font>," +
                              $" Secondary: <font color=\"{System.Drawing.ColorTranslator.ToHtml(vehicleColor.SecondaryColorRGBA)}\">{vehicleColor.SecondaryColorName}</font>");
     }
     else
     {
         Game.LogTrivial("Vehicle doesn't exist");
     }
 }
 public static void SetColor(this Vehicle v, VehicleColor colors)
 {
     if (v != null && v.Exists())
     {
         Vehicles.SetVehicleColors(v, colors);
     }
 }
Beispiel #9
0
 public static void Command_GetAllVehicleColor()
 {
     GameFiber.StartNew(() =>
     {
         var vehicles = World.GetAllVehicles();
         foreach (Vehicle vehicle in vehicles)
         {
             if (vehicle)
             {
                 VehicleColor vehicleColor = vehicle.GetColor();
                 List <string> log         = new List <string>()
                 {
                     $"Vehicle: {vehicle.GetMakeName()} - {vehicle.GetDisplayName()}",
                     $"Primary: {vehicleColor.PrimaryColorName}",
                     $"Secondary: {vehicleColor.SecondaryColorName}",
                 };
                 Game.LogTrivial(string.Join(", ", log));
                 if (vehicleColor.PrimaryColor == VehiclePaint.Unknown || vehicleColor.SecondaryColor == VehiclePaint.Unknown)
                 {
                     Game.LogTrivial("================UNKNOWN COLOR===============");
                 }
             }
         }
     }, "GetAllVehicleColors Command Fiber");
 }
Beispiel #10
0
        public ActionResult DeleteConfirmed(int id)
        {
            VehicleColor vehicleColor = db.VehicleColors.Find(id);

            db.VehicleColors.Remove(vehicleColor);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #11
0
 private void ChangeSelectedColor()
 {
     selectedColor            = vehicleColors[selectedColorIndex];
     bodyImage.color          = vehicleColors[selectedColorIndex].color;
     raceStarter.vehicleColor = selectedColor;
     nameText.text            = selectedColor.name;
     colorChanged.Raise();
 }
 public static void SetColor(this Vehicle v, Vehicles.EPaint primColor, Vehicles.EPaint secColor)
 {
     if (v != null && v.Exists())
     {
         VehicleColor color = new VehicleColor(primColor, secColor);
         v.SetColor(color);
     }
 }
Beispiel #13
0
 /// <summary>
 /// Sets this <see cref="Vehicle"/> colors
 /// </summary>
 public static void SetColor(this Vehicle vehicle, VehicleColor vehicleColor)
 {
     if (vehicleColor.PrimaryColor == VehiclePaint.Unknown || vehicleColor.SecondaryColor == VehiclePaint.Unknown)
     {
         throw new NotSupportedException();
     }
     NativeWrappers.SetVehicleColours(vehicle, (int)vehicleColor.PrimaryColor, (int)vehicleColor.SecondaryColor);
 }
Beispiel #14
0
 public ActionResult Edit([Bind(Include = "VehicleColorID,VehicleColorDescription")] VehicleColor vehicleColor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vehicleColor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vehicleColor));
 }
Beispiel #15
0
 public VehicleType(int bookValue, int millage, VehicleSpecs vehicleSpecs, VehicleColor vehicleColor, ServiceHistory serviceHistory, string vehicleSeries, int vehicleYearProduced)
 {
     BookValue           = bookValue;
     Millage             = millage;
     VehicleSpecs        = vehicleSpecs;
     VehicleColor        = vehicleColor;
     ServiceHistory      = serviceHistory;
     VehicleSeries       = vehicleSeries;
     VehicleYearProduced = vehicleYearProduced;
 }
Beispiel #16
0
 /// <summary>
 ///this checks if the gangs member, blip and car colors are consistent, like black, black and black.
 ///if left unassigned, the blip color is 0 and the car color is metallic black:
 ///a sign that somethings wrong, because 0 is white blip color
 /// </summary>
 public void EnforceGangColorConsistency()
 {
     ModOptions.GangColorTranslation ourColor = ModOptions.instance.GetGangColorTranslation(memberVariations[0].linkedColor);
     if ((blipColor == 0 && ourColor.baseColor != PotentialGangMember.MemberColor.white) ||
         (vehicleColor == VehicleColor.MetallicBlack && ourColor.baseColor != PotentialGangMember.MemberColor.black))
     {
         blipColor    = RandoMath.GetRandomElementFromArray(ourColor.blipColors);
         vehicleColor = RandoMath.GetRandomElementFromList(ourColor.vehicleColors);
         GangManager.instance.SaveGangData(false);
     }
 }
Beispiel #17
0
        public ActionResult Create([Bind(Include = "VehicleColorID,VehicleColorDescription")] VehicleColor vehicleColor)
        {
            if (ModelState.IsValid)
            {
                db.VehicleColors.Add(vehicleColor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vehicleColor));
        }
 public VehicleData(int handle, int hash, Vector3 rotation, Vector3 position, VehicleColor primaryColor, VehicleColor secondaryColor, int health, float engineHealth, float heading)
 {
     Handle         = handle;
     Hash           = hash;
     Rotation       = rotation;
     Position       = position;
     PrimaryColor   = primaryColor;
     SecondaryColor = secondaryColor;
     Health         = health;
     EngineHealth   = engineHealth;
     Heading        = heading;
 }
Beispiel #19
0
        public PotentialGangMember.MemberColor TranslateVehicleToMemberColor(VehicleColor vehColor)
        {
            for (int i = 0; i < similarColors.Count; i++)
            {
                if (similarColors[i].vehicleColors.Contains(vehColor))
                {
                    return(similarColors[i].baseColor);
                }
            }

            return(PotentialGangMember.MemberColor.white);
        }
Beispiel #20
0
 public VehicleData(int handle, int hash, Vector3 rotation, Vector3 position, VehicleColor primaryColor, VehicleColor secondaryColor, int health, float engineHealth, float heading)
 {
     this.Handle         = handle;
     this.Hash           = hash;
     this.Rotation       = rotation;
     this.Position       = position;
     this.PrimaryColor   = primaryColor;
     this.SecondaryColor = secondaryColor;
     this.Health         = health;
     this.EngineHealth   = engineHealth;
     this.Heading        = heading;
 }
Beispiel #21
0
        // GET: VehicleColor/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VehicleColor vehicleColor = db.VehicleColors.Find(id);

            if (vehicleColor == null)
            {
                return(HttpNotFound());
            }
            return(View(vehicleColor));
        }
Beispiel #22
0
        public static void SetVehicleColors(Vehicle pVehicle, VehicleColor pColors)
        {
            try
            {
                int primColor = (int)pColors.PrimaryColor;
                int secColor  = (int)pColors.SecondaryColor;

                NativeFunction.Natives.x4F1D4BE3A7F24601(pVehicle, primColor, secColor);
            }
            catch (Exception ex)
            {
                Game.LogVerboseDebug("Error setting vehicle colors -- " + ex.Message);
            }
        }
Beispiel #23
0
 public void EnforceGangColorConsistency()
 {
     //this checks if the gangs member, blip and car colors are consistent, like black, black and black
     //if left unassigned, the blip color is 0 and the car color is metallic black
     //a sign that somethings wrong, because 0 is white blip color
     ModOptions.GangColorTranslation ourColor = ModOptions.instance.GetGangColorTranslation(memberVariations[0].linkedColor);
     if ((blipColor == 0 && ourColor.baseColor != PotentialGangMember.memberColor.white) ||
         (vehicleColor == VehicleColor.MetallicBlack && ourColor.baseColor != PotentialGangMember.memberColor.black))
     {
         blipColor    = RandoMath.GetRandomElementFromArray(ourColor.blipColors);
         vehicleColor = RandoMath.GetRandomElementFromList(ourColor.vehicleColors);
         GangManager.instance.SaveGangData(false);
     }
 }
Beispiel #24
0
 public VehicleInfo(Vehicle veh)
 {
     Model          = veh.Model;
     Velocity       = veh.Velocity;
     Position       = veh.Position;
     Rotation       = veh.Rotation;
     Speed          = veh.Speed;
     EngineRunning  = veh.EngineRunning;
     PrimaryColor   = veh.PrimaryColor;
     SecondaryColor = veh.SecondaryColor;
     if (veh.Driver != null)
     {
         IsStationary = false;
         Driver       = new PedInfo(veh.Driver);
     }
 }
        private static unsafe VehicleColor UnsafeGetVehicleColors(Vehicle vehicle)
        {
            int colorPrimaryInt;
            int colorSecondaryInt;

            ulong GetVehicleColorsHash = 0xa19435f193e081ac;

            NativeFunction.CallByHash <uint>(GetVehicleColorsHash, vehicle, &colorPrimaryInt, &colorSecondaryInt);

            VehicleColor colors = new VehicleColor();

            colors.PrimaryColor   = (EPaint)colorPrimaryInt;
            colors.SecondaryColor = (EPaint)colorSecondaryInt;

            return(colors);
        }
Beispiel #26
0
        public async Task <bool> Create(VehicleColor entity)
        {
            if (entity == null)
            {
                return(false);
            }

            entity.CreationDate = DateTime.Now;
            entity.UpdateDate   = DateTime.Now;
            entity.Active       = true;

            await _dbContext.AddAsync(entity);

            var result = await _dbContext.SaveChangesAsync();

            return(result > 0);
        }
 public Colors(VehicleColor primary, VehicleColor secondary, VehicleColor pearlescent)
 {
     Primary     = primary;
     Secondary   = secondary;
     Pearlescent = pearlescent;
     //CustomPrimary = default(bool);
     //CustomPrimaryR = default(int);
     //CustomPrimaryG = default(int);
     //CustomPrimaryB = default(int);
     //CustomSecondary = default(bool);
     //CustomSecondaryR = default(int);
     //CustomSecondaryG = default(int);
     //CustomSecondaryB = default(int);
     Rim       = default(VehicleColor);
     Neon      = default(Color);
     TireSmoke = default(Color);
     Trim      = default(VehicleColor);
     Dashboard = default(VehicleColor);
 }
Beispiel #28
0
        public async Task <bool> Update(VehicleColor entity)
        {
            if (entity == null)
            {
                return(false);
            }
            var entityToChange = await GetSingleById(entity.Id);

            if (entityToChange == null)
            {
                return(false);
            }
            entityToChange.Description = entity.Description;
            entityToChange.UpdateDate  = DateTime.Now;
            _dbContext.VehicleColors.Update(entityToChange);
            var result = await _dbContext.SaveChangesAsync();

            return(result > 0);
        }
Beispiel #29
0
 public VehicleData(int handle, int hash, Vector3 rotation, Vector3 position, VehicleColor primaryColor, VehicleColor secondaryColor, int health, float engineHealth, float heading, VehicleNeonLight[] neonLights, List <Tuple <VehicleMod, int> > mods, VehicleToggleMod[] toggleMods, VehicleWindowTint windowTint, VehicleWheelType wheelType, Color neonColor, int livery, bool wheels1, bool wheels2)
 {
     Handle         = handle;
     Hash           = hash;
     Rotation       = rotation;
     Position       = position;
     PrimaryColor   = primaryColor;
     SecondaryColor = secondaryColor;
     Health         = health;
     EngineHealth   = engineHealth;
     Heading        = heading;
     NeonLights     = neonLights;
     Mods           = mods;
     ToggleMods     = toggleMods;
     WindowTint     = windowTint;
     WheelType      = wheelType;
     NeonColor      = neonColor;
     Livery         = livery;
     Wheels1        = wheels1;
     Wheels2        = wheels2;
 }
Beispiel #30
0
 public PlayerData()
 {
     Name               = "";
     NumberPlate        = "";
     Inventory          = new List <Item>();
     Weapons            = new List <WeaponDefinition>();
     Skills             = GM.Copy(SkillRepository.Skills);
     Quests             = GM.Copy(QuestRepository.Quests);
     Money              = 1000;
     CompletedContracts = 0;
     Motive             = PlayerMotive.Rebel;
     Gender             = Gender.Male;
     Class              = PlayerClass.Time_Master;
     CarColor           = VehicleColor.MetallicClassicGold;
     CarSecondaryColor  = VehicleColor.MetallicClassicGold;
     SkillSlots         = new[]
     {
         new SkillSlot {
             Key = Keys.T
         },
         new SkillSlot {
             Key = Keys.Y
         },
         new SkillSlot {
             Key = Keys.CapsLock
         },
         new SkillSlot {
             Key = Keys.U
         },
         new SkillSlot {
             Key = Keys.B
         },
     };
     Setup           = new Setup();
     Tutorial        = new Tutorial();
     LastContracts   = new[] { "", "", "", "", "" };
     ModelVariations = new Dictionary <int, int>();
 }
Beispiel #31
0
    private void Start()
    {
        if (Home == null)
        {
            Home = SpawnController.SpawnPoints[Randoms.Next(0, SpawnController.SpawnPoints.Length)];
        }

        if (Home.IsBlocked)
        {
            Kill();
        }

        if (Destination == null)
        {
            Destination = SpawnController.DestinationPoints[Randoms.Next(0, SpawnController.SpawnPoints.Length)];
        }

        gameObject.transform.position = Home.transform.position;
        gameObject.transform.rotation = Home.transform.rotation;
        Routes        = GenerateRoutes(Home, Destination);
        SelectedRoute = GameConfig.UseDijkstra ? Routes.OrderBy(i => i.Weight).FirstOrDefault() : Routes.OrderBy(i => i.NodeCount).LastOrDefault();
        if (SelectedRoute == null)
        {
            Kill();
        }
        NextDestination = SelectedRoute.First();
        RunPath         = true;
        name            = VehicleColor.ToString();
        foreach (var r in gameObject.GetComponentsInChildren <MeshRenderer>())
        {
            r.material.shader = Shader.Find("_Color");
            r.material.SetColor("_Color", VehicleColor);
            r.material.shader = Shader.Find("Specular");
            r.material.SetColor("_SpecColor", VehicleColor);
        }

        SpawnController.Log += this + "\n";
    }
Beispiel #32
0
 public static int GetVehicleColorInt(VehicleColor metallicBlackRed)
 {
     var vehColors = VehicleColors;
     var index = Array.IndexOf(vehColors, metallicBlackRed);
     return index;
 }
Beispiel #33
0
 private void changecolor(Vehicle veh, VehicleColor vehcolor)
 {
     veh.PrimaryColor = vehcolor;
     veh.SecondaryColor = vehcolor;
 }
Beispiel #34
0
 private void changepearlescent(Vehicle veh, VehicleColor vehcolor)
 {
     veh.PearlescentColor = vehcolor;
 }
Beispiel #35
0
 public void ChangeColor(VehicleColor color)
 {
     Vehicle veh = Game.Player.Character.CurrentVehicle;
     veh.PrimaryColor = color;
     veh.SecondaryColor = color;
     UI.Notify("Change Color to " + color.ToString());
 }