本文整理汇总了C#中Vehicle.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Vehicle.GetHashCode方法的具体用法?C# Vehicle.GetHashCode怎么用?C# Vehicle.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle.GetHashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveCarToFile
private void SaveCarToFile(Vehicle veh, string name)
{
if (!Directory.Exists("scripts//yolonetvehiclefiles//"))
{
Directory.CreateDirectory("scripts//yolonetvehiclefiles//");
//if it doesn't exist, make it
}
if (File.Exists("scripts//yolonetvehiclefiles//" + name))
{
if (name.EndsWith(")"))
{
string oldnumber = name.Substring(name.IndexOf("("), (name.IndexOf(")") - name.IndexOf("(")));
SaveCarToFile(veh, (name + "(" + (int.Parse(oldnumber) + 1) + ")"));
//this is just me showing my dev skills, if it was already marked as (2), next will be (3), then (4), and going on.
}
else
{
SaveCarToFile(veh, (name + "(2)"));
}
}
else
{
string tosave = "";
tosave += veh.GetHashCode() + Environment.NewLine;
tosave += veh.BodyHealth + Environment.NewLine;
tosave += veh.CanTiresBurst + Environment.NewLine;
tosave += veh.IsPrimaryColorCustom + Environment.NewLine;
tosave += veh.CustomPrimaryColor + Environment.NewLine;
tosave += veh.IsSecondaryColorCustom + Environment.NewLine;
tosave += veh.CustomSecondaryColor + Environment.NewLine;
tosave += veh.EngineHealth + Environment.NewLine;
tosave += veh.Health + Environment.NewLine;
tosave += veh.LightsOn + Environment.NewLine;
tosave += veh.Livery + Environment.NewLine;
tosave += veh.NeonLightsColor + Environment.NewLine;
tosave += veh.PearlescentColor + Environment.NewLine;
tosave += veh.PetrolTankHealth + Environment.NewLine;
tosave += veh.PrimaryColor + Environment.NewLine;
tosave += veh.RimColor + Environment.NewLine;
tosave += veh.RoofState + Environment.NewLine;
tosave += veh.SearchLightOn + Environment.NewLine;
tosave += veh.SecondaryColor + Environment.NewLine;
tosave += veh.SirenActive + Environment.NewLine;
tosave += veh.TaxiLightOn + Environment.NewLine;
tosave += veh.TireSmokeColor + Environment.NewLine;
tosave += veh.WheelType + Environment.NewLine;
tosave += veh.WindowTint + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Armor) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.BackWheels) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Brakes) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Engine) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Exhaust) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Fender) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Frame) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.FrontBumper) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.FrontWheels) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Grille) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Hood) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Horns) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.RearBumper) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.RightFender) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Roof) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.SideSkirt) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Spoilers) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Suspension) + Environment.NewLine;
tosave += veh.GetMod(VehicleMod.Transmission) + Environment.NewLine;
tosave += veh.IsToggleModOn(VehicleToggleMod.TireSmoke) + Environment.NewLine;
tosave += veh.IsToggleModOn(VehicleToggleMod.Turbo) + Environment.NewLine;
tosave += veh.IsToggleModOn(VehicleToggleMod.XenonHeadlights) + Environment.NewLine;
File.Create("scripts//yolonetvehiclefiles//" + name).Close();
File.WriteAllText(("scripts//yolonetvehiclefiles//" + name), tosave);
//TODO: Add objects to object and peds to ped list by aiming. object.GetHashCode().
}
}