Esempio n. 1
0
        public void GetData(int index)
        {
            UIntPtr tmp        = ReadUIntPtr(0xBCE920);
            UIntPtr playerBase = ReadUIntPtr(tmp + 4 * index);

            racing    = Racing(playerBase) && TimerRunning();
            available = MemoryHelper.readSuccess;
            if (!available)
            {
                speed    = 0;
                form     = 0;
                canStunt = false;
                allStar  = false;
                return;
            }

            speed      = speeds[index];
            form       = (VehicleForm)ReadInt(GetServiceAddress(playerBase + 0xC880, ServiceID.RACERTRANSFORMSERVICE) + 0x1C);
            canStunt   = ReadBoolean(GetServiceAddress(playerBase + 0xC880, ServiceID.RACERSTUNT) + 0x30);
            allStar    = ReadBoolean(GetServiceAddress(playerBase + 0xC880, ServiceID.ALLSTARPOWER) + 0x70);
            boostLevel = ReadInt(GetServiceAddress(playerBase + 0xC880, ServiceID.BOOSTSERVICE) + 0x10C);
            if (allStar)
            {
                boostLevel = Math.Min(6, boostLevel + 3);
            }
        }
Esempio n. 2
0
        private void DrawGlow(VehicleForm form, float speed)
        {
            dial.Transform = Matrix.Transformation2D(Vector2.Zero, 0, new Vector2(speedoScale, speedoScale), Vector2.Zero, 0f, speedoPos + themeConfig.Dial.GlowPosition * speedoScale);
            float tmp = Math.Max(0f, speed - GetMaxSpeed(form) * themeConfig.Dial.GlowStart_FractionOfMaxSpeed);

            themeConfig.Dial.GlowColour.A = (byte)(opacity * Math.Min(1, tmp / GetMaxSpeed(form) / (1f - themeConfig.Dial.GlowStart_FractionOfMaxSpeed)));
            dial.Draw(glowTexture, themeConfig.Dial.GlowColour);
        }
        private void vehicleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            closeAllChildForms();
            VehicleForm vehicleForm = new VehicleForm();

            vehicleForm.MdiParent = this;
            vehicleForm.Show();
        }
Esempio n. 4
0
 public static void AddVehicle(VehicleForm vehicle)
 {
     using (var context = new DiemServiceDB())
     {
         Vehicle newVehicle = vehicle.NewVehicle();
         // Is this actually necessary
         newVehicle.Location = context.LocationDbSet.Add(newVehicle.Location);
         context.VehicleDbSet.Add(newVehicle);
         context.SaveChanges();
     }
 }
Esempio n. 5
0
        public override void Run()
        {
            VehicleForm        form = new VehicleForm(vehicle);
            IVehicleRepository dao  = new NHibernateVehicleRepository();

            form.VehicleSave += delegate(object sender, VehicleEventArgs e) {
                dao.SaveOrUpdate(e.Vehicle);
                form.Close();
            };
            WorkbenchSingleton.AddChild(form, "Edit Vehicle");
        }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (var form = new VehicleForm())
            {
                form.SetDataBindings();
                var result = form.ShowDialog();

                if (result == DialogResult.OK)
                {
                    _client.Create(form.Vehicle);

                    RefreshAllData();
                }
            }
        }
Esempio n. 7
0
 private void vehiclesGridView_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex != -1)
     {
         if (vehiclesGridView.CurrentCell.ColumnIndex.Equals(1))
         {
             selectedVehicle = vehicles[e.RowIndex];
         }
         else if (vehiclesGridView.CurrentCell.ColumnIndex.Equals(2))
         {
             VehicleForm vehicleForm = new VehicleForm(vehicles[e.RowIndex]);
             vehicleForm.Init();
             vehicleForm.Show();
         }
     }
 }
Esempio n. 8
0
        private float GetMaxSpeed(VehicleForm form)
        {
            switch (form)
            {
            case VehicleForm.Car:
                return(themeConfig.Speed.CarMaxSpeed);

            case VehicleForm.Boat:
                return(themeConfig.Speed.BoatMaxSpeed);

            case VehicleForm.Plane:
                return(themeConfig.Speed.PlaneMaxSpeed);

            default:
                return(0f);
            }
        }
Esempio n. 9
0
        public void DrawNeedle(VehicleForm form, float speed)
        {
            float angleScale = (themeConfig.Needle.MaxAngle - themeConfig.Needle.MinAngle) / GetMaxSpeed(form);
            float rotation   = (themeConfig.Needle.MinAngle + speed * angleScale) * ANGLE_RATIO;

            if (rotation > themeConfig.Needle.MaxAngle * ANGLE_RATIO)
            {
                rotation = themeConfig.Needle.MaxAngle * ANGLE_RATIO;
                if (themeConfig.Needle.MaxSpeedWobble)
                {
                    rotation += themeConfig.Needle.WobbleAngle * (float)Math.Sin(Environment.TickCount / themeConfig.Needle.WobblePeriod * Math.PI * 2f) * ANGLE_RATIO;
                }
            }
            dial.Transform = Matrix.Transformation2D(Vector2.Zero, 0f, new Vector2(speedoScale, speedoScale),
                                                     themeConfig.Needle.PivotPosition * speedoScale, rotation, speedoPos + (themeConfig.Needle.Position - themeConfig.Needle.PivotPosition) * speedoScale);
            dial.Draw(needleTexture, baseColour);
        }
Esempio n. 10
0
        public void DrawDial(VehicleForm form)
        {
            dial.Transform = Matrix.Transformation2D(Vector2.Zero, 0f, new Vector2(speedoScale, speedoScale), Vector2.Zero, 0f, speedoPos + themeConfig.Dial.Position * speedoScale);
            switch (form)
            {
            case VehicleForm.Car:
                dial.Draw(carTexture, baseColour);
                break;

            case VehicleForm.Boat:
                dial.Draw(boatTexture, baseColour);
                break;

            case VehicleForm.Plane:
                dial.Draw(planeTexture, baseColour);
                break;
            }
        }
Esempio n. 11
0
        public void Draw(bool showSpeedo, bool dataAvailable, float speed, VehicleForm form, int boostLevel, bool canStunt)
        {
            // Fade effect for when showing/hiding the speedometer.
            newDrawTime = stopwatch.Elapsed.TotalSeconds;
            double targetOpacity = enabled && showSpeedo ? maxOpacity : 0;

            if (oldDrawTime != 0 && opacity != targetOpacity)
            {
                double opacityStep = opacityGrad * (newDrawTime - oldDrawTime);
                if (opacity > targetOpacity)
                {
                    opacity = Math.Max(0, opacity - opacityStep);
                }
                else
                {
                    opacity = Math.Min(maxOpacity, opacity + opacityStep);
                }
                baseColour.A = (byte)opacity;
            }
            oldDrawTime = newDrawTime;

            if (!loaded || opacity == 0)
            {
                return;
            }

            dial.Begin(SpriteFlags.AlphaBlend);
            if (themeConfig.Dial.Show)
            {
                if (themeConfig.Dial.ShowBackground)
                {
                    DrawBackground();
                }
                if (themeConfig.Dial.ShowGlow)
                {
                    DrawGlow(form, speed);
                }
                DrawDial(form);
            }
            if (themeConfig.Dial.ShowGlow)
            {
                DrawGlow(form, speed);
            }
            if (themeConfig.Dial.Show)
            {
                DrawDial(form);
            }
            if (themeConfig.Needle.Show)
            {
                DrawNeedle(form, speed);
            }
            if (themeConfig.StuntLight.Show && dataAvailable && canStunt)
            {
                DrawLight();
            }
            if (themeConfig.Speed.Show)
            {
                DrawText(
                    speedFontLookup,
                    speedFontTexture,
                    speedoPos + themeConfig.Speed.Position * speedoScale,
                    themeConfig.Speed.FontSpacing,
                    themeConfig.Speed.FontScale,
                    themeConfig.Speed.TextCentred,
                    string.Format(themeConfig.Speed.TextFormat, speed));
            }
            if (themeConfig.BoostLevel.Show && dataAvailable && (boostLevel > 0 || !themeConfig.BoostLevel.HideBoostLevelZero))
            {
                DrawText(
                    boostLevelFontLookup,
                    boostLevelFontTexture,
                    speedoPos + themeConfig.BoostLevel.Position * speedoScale,
                    themeConfig.BoostLevel.FontSpacing,
                    themeConfig.BoostLevel.FontScale,
                    themeConfig.BoostLevel.TextCentred,
                    string.Format(themeConfig.BoostLevel.TextFormat, boostLevel));
            }
            if (themeConfig.VehicleForm.Show && dataAvailable)
            {
                DrawText(
                    vehicleFormFontLookup,
                    vehicleFormFontTexture,
                    speedoPos + themeConfig.VehicleForm.Position * speedoScale,
                    themeConfig.VehicleForm.FontSpacing,
                    themeConfig.VehicleForm.FontScale,
                    themeConfig.VehicleForm.TextCentred,
                    string.Format(themeConfig.VehicleForm.TextFormat, form.ToString().ToUpper()));
            }
            dial.End();
        }
Esempio n. 12
0
 public HttpResponseMessage AddVehicle([FromBody] VehicleForm vehicleForm)
 {
     VehicleDbManager.AddVehicle(vehicleForm);
     return(Request.CreateResponse(System.Net.HttpStatusCode.OK));
 }
Esempio n. 13
0
 public AddOrUpdateVehicleForm(VehicleForm form)
 {
     InitializeComponent();
     vForm = form;
 }
Esempio n. 14
0
        private void btnRegisterUser_Click(object sender, EventArgs e)
        {
            VehicleForm vehicleForm = new VehicleForm();
            Vehicle     vehicle     = new Vehicle();

            if (validateField())
            {
                if (!WorkVehicle.getVehiculeByEnrollment(textEnrollment.Text))
                {
                    if (isEdit == false)
                    {
                        var result = MessageBox.Show("¿Desea registrar el vehiculo?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                        if (result == DialogResult.Yes)
                        {
                            vehicle.Enrollment     = textEnrollment.Text;
                            vehicle.Brand          = comboBoxBrands.Text;
                            vehicle.VehicleLine    = comboBoxLine.Text;
                            vehicle.Model          = int.Parse(textBoxModel.Text);
                            vehicle.Colour         = textBoxColor.Text;
                            vehicle.NumberOfDoors  = int.Parse(comboBoxDoors.Text);
                            vehicle.Gps            = radioButton1.Checked;
                            vehicle.idType         = Convert.ToInt32(comboBoxType.SelectedValue);
                            vehicle.idClassVehicle = Convert.ToInt32(comboBoxClass.SelectedValue);
                            vehicle.Price          = decimal.Parse(textBoxPrice.Text);

                            //WorkVehicle.addVehicle(vehicle);
                            WorkVehicle.addVehicleSP(vehicle);
                            MessageBox.Show("MATRICULA: " + vehicle.Enrollment + "  MARCA: " + vehicle.Brand + "LINEA: " + vehicle.VehicleLine +
                                            " MODELO: " + vehicle.Model + " COLOR: " + vehicle.Colour + " PUERTAS: " + vehicle.NumberOfDoors +
                                            " GPS: " + vehicle.showGps() + " TIPO: " + vehicle.Type + " CLASE: " + vehicle.ClassVehicle
                                            + " PRECIO: " + vehicle.Price, "Datos del Vehiculo cargados", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                            //loadVehicles();
                            vehicleForm.loadVehiclesSP();
                            cleanFields();
                        }
                    }
                    //update Vehicle
                    if (isEdit == true)
                    {
                        var result = MessageBox.Show("¿Desea guardar los cambios?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                        if (result == DialogResult.Yes)
                        {
                            vehicle.Id             = Convert.ToInt32(idVehicle);
                            vehicle.Enrollment     = textEnrollment.Text;
                            vehicle.Brand          = comboBoxBrands.Text;
                            vehicle.VehicleLine    = comboBoxLine.Text;
                            vehicle.Model          = int.Parse(textBoxModel.Text);
                            vehicle.Colour         = textBoxColor.Text;
                            vehicle.NumberOfDoors  = int.Parse(comboBoxDoors.Text);
                            vehicle.Gps            = radioButton1.Checked;
                            vehicle.idType         = Convert.ToInt32(comboBoxType.SelectedValue);
                            vehicle.idClassVehicle = Convert.ToInt32(comboBoxClass.SelectedValue);
                            vehicle.Price          = decimal.Parse(textBoxPrice.Text);

                            //WorkVehicle.updateVehicle(vehicle);
                            WorkVehicle.updateVehicleSP(vehicle);

                            //loadVehicles();
                            vehicleForm.loadVehiclesSP();
                            cleanFields();
                            isEdit = false;
                            MessageBox.Show("Se actualizo correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    vForm.loadVehiclesSP();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("La matricula: " + textEnrollment.Text + " ya está registrada, intente otra matricula");
                }
            }
            else
            {
                MessageBox.Show("Campos en Blancos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }