예제 #1
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;
 }
        public void SaveVehicle(Vehicle vehicle)
        {
            if (this._vehicleCollection == null)
            {
                this.Deserialize();
            }
            VehicleData vehicleData = this._vehicleCollection.ToList <VehicleData>().Find((Predicate <VehicleData>)(v => v.Handle == ((Entity)vehicle).get_Handle()));

            if (vehicleData != null)
            {
                PlayerVehicles.UpdateDataSpecific(vehicleData, vehicle);
                this.Serialize(true);
            }
            else
            {
                // ISSUE: method pointer
                VehicleNeonLight[] array1            = ((IEnumerable <VehicleNeonLight>)Enumerable.Where <VehicleNeonLight>((IEnumerable <M0>)Enum.GetValues(typeof(VehicleNeonLight)), (Func <M0, bool>) new Func <VehicleNeonLight, bool>((object)vehicle, __methodptr(IsNeonLightsOn)))).ToArray <VehicleNeonLight>();
                VehicleMod[]       values            = (VehicleMod[])Enum.GetValues(typeof(VehicleMod));
                List <Tuple <VehicleMod, int> > mods = new List <Tuple <VehicleMod, int> >();
                ((IEnumerable <VehicleMod>)values).ToList <VehicleMod>().ForEach((Action <VehicleMod>)(h =>
                {
                    int mod = vehicle.GetMod(h);
                    if (mod == -1)
                    {
                        return;
                    }
                    mods.Add(new Tuple <VehicleMod, int>(h, mod));
                }));
                // ISSUE: method pointer
                VehicleToggleMod[] array2             = ((IEnumerable <VehicleToggleMod>)Enumerable.Where <VehicleToggleMod>((IEnumerable <M0>)Enum.GetValues(typeof(VehicleToggleMod)), (Func <M0, bool>) new Func <VehicleToggleMod, bool>((object)vehicle, __methodptr(IsToggleModOn)))).ToArray <VehicleToggleMod>();
                int                handle             = ((Entity)vehicle).get_Handle();
                Model              model              = ((Entity)vehicle).get_Model();
                int                hash               = ((Model) ref model).get_Hash();
                Vector3            rotation           = ((Entity)vehicle).get_Rotation();
                Vector3            position           = ((Entity)vehicle).get_Position();
                VehicleColor       primaryColor       = vehicle.get_PrimaryColor();
                VehicleColor       secondaryColor     = vehicle.get_SecondaryColor();
                int                health             = ((Entity)vehicle).get_Health();
                double             engineHealth       = (double)vehicle.get_EngineHealth();
                double             heading            = (double)((Entity)vehicle).get_Heading();
                VehicleNeonLight[] neonLights         = array1;
                List <Tuple <VehicleMod, int> > mods1 = mods;
                VehicleToggleMod[] toggleMods         = array2;
                VehicleWindowTint  windowTint         = vehicle.get_WindowTint();
                VehicleWheelType   wheelType          = vehicle.get_WheelType();
                Color neonLightsColor = vehicle.get_NeonLightsColor();
                M0    m0_1            = Function.Call <int>((Hash)3150587921134411402L, new InputArgument[1]
                {
                    InputArgument.op_Implicit(((Entity)vehicle).get_Handle())
                });
                M0 m0_2 = Function.Call <bool>((Hash) - 5507252750051666468L, new InputArgument[2]
                {
                    InputArgument.op_Implicit(((Entity)vehicle).get_Handle()),
                    InputArgument.op_Implicit(23)
                });
                M0 m0_3 = Function.Call <bool>((Hash) - 5507252750051666468L, new InputArgument[2]
                {
                    InputArgument.op_Implicit(((Entity)vehicle).get_Handle()),
                    InputArgument.op_Implicit(24)
                });
                this._vehicleCollection.Add(new VehicleData(handle, hash, rotation, position, primaryColor, secondaryColor, health, (float)engineHealth, (float)heading, neonLights, mods1, toggleMods, windowTint, wheelType, neonLightsColor, (int)m0_1, (bool)m0_2, (bool)m0_3));
                this._vehicles.Add(vehicle);
                ((Entity)vehicle).set_IsPersistent(true);
                new EntityEventWrapper((Entity)vehicle).Died += new EntityEventWrapper.OnDeathEvent(this.WrapperOnDied);
                PlayerVehicles.AddBlipToVehicle(vehicle);
            }
        }