Ejemplo n.º 1
0
        private void Initialize(Form Form, int Sub_menu_width, FontFamily Dosis_font_family)
        {
            Dictionary <string, int> menu = User_Controls.Config.simElementsMenu;
            int _sliderX = menu["sliderX"];
            int _startY  = menu["sliderStartVehicleY"];
            int _diffY   = menu["sliderDiffY"];
            int _textX   = menu["sliderTextX"];
            int _textY   = menu["startTextY"];

            List <string> _temp = VehicleController.getStringVehicleStats();


            Selection_box = new Selection_box(Form, Dosis_font_family, _temp);
            if (Form.WindowState == FormWindowState.Maximized)
            {
                Selection_box.Location = new Point(User_Controls.Config.standardSubMenu["selectionBoxMaxX"], User_Controls.Config.standardSubMenu["selectionBoxMaxY"]);
            }
            else
            {
                Selection_box.Location = new Point(User_Controls.Config.standardSubMenu["selectionBoxX"], User_Controls.Config.standardSubMenu["selectionBoxY"]);
            }

            this.Controls.Add(Selection_box);

            Dictionary <string, int> vehiclemenu = User_Controls.Config.simVehicle;


            Slider Cw = new Slider(new Point(_sliderX, _startY + 2 * _diffY), vehiclemenu["surfaceMin"], vehiclemenu["surfaceMax"]);

            this.Controls.Add(Cw);
            SliderText Cw_label = new SliderText(Dosis_font_family, new Point(_sliderX, _textY + 2 * _diffY), "Drag Co:");

            this.Controls.Add(Cw_label);
            SliderText Cw_Value = new SliderText(Dosis_font_family, new Point(_textX, _textY + 2 * _diffY), (Cw.Value / 10).ToString() + " ");

            this.Controls.Add(Cw_Value);
            Cw.ValueChanged += (object o, EventArgs EA) => { Cw_Value.Text = (((double)(Cw.Value)) / 10).ToString() + " "; };

            Slider Surface = new Slider(new Point(_sliderX, _startY + _diffY), vehiclemenu["surfaceMin"], vehiclemenu["surfaceMax"]);

            this.Controls.Add(Surface);
            SliderText Surface_label = new SliderText(Dosis_font_family, new Point(_sliderX, _textY + 1 * _diffY), "Frontal Surface:");

            this.Controls.Add(Surface_label);
            SliderText Surface_Value = new SliderText(Dosis_font_family, new Point(_textX, _textY + 1 * _diffY), (Surface.Value / 10).ToString() + " m^2");

            this.Controls.Add(Surface_Value);
            Surface.ValueChanged += (object o, EventArgs EA) => { Surface_Value.Text = (((double)(Surface.Value)) / 10).ToString() + " m^2"; };

            Slider Max_speed = new Slider(new Point(_sliderX, _startY), vehiclemenu["topSpeedMin"], vehiclemenu["topSpeedMax"]);

            this.Controls.Add(Max_speed);
            SliderText Max_speed_label = new SliderText(Dosis_font_family, new Point(_sliderX, _textY), "Topspeed:");

            this.Controls.Add(Max_speed_label);
            SliderText Max_speed_Value = new SliderText(Dosis_font_family, new Point(_textX, _textY), Max_speed.Value.ToString() + " km/h");

            this.Controls.Add(Max_speed_Value);
            Max_speed.ValueChanged += (object o, EventArgs EA) => { Max_speed_Value.Text = Max_speed.Value.ToString() + " km/h"; };

            Slider Length = new Slider(new Point(_sliderX, _startY - _diffY), vehiclemenu["lengthMin"], vehiclemenu["lengthMax"]);

            this.Controls.Add(Length);
            SliderText Length_label = new SliderText(Dosis_font_family, new Point(_sliderX, _textY - 1 * _diffY), "Length:");

            this.Controls.Add(Length_label);
            SliderText Length_Value = new SliderText(Dosis_font_family, new Point(_textX, _textY - 1 * _diffY), (Length.Value / 10).ToString() + " m");

            this.Controls.Add(Length_Value);
            Length.ValueChanged += (object o, EventArgs EA) => { Length_Value.Text = (((double)(Length.Value)) / 10).ToString() + " m"; };

            Slider HorsePower = new Slider(new Point(_sliderX, _startY - 2 * _diffY), vehiclemenu["horsepwrMin"], vehiclemenu["horsepwrMax"]);

            this.Controls.Add(HorsePower);
            SliderText HorsePower_label = new SliderText(Dosis_font_family, new Point(_sliderX, _textY - 2 * _diffY), "Horsepower:");

            this.Controls.Add(HorsePower_label);
            SliderText HorsePower_Value = new SliderText(Dosis_font_family, new Point(_textX, _textY - 2 * _diffY), HorsePower.Value.ToString() + " hp");

            this.Controls.Add(HorsePower_Value);
            HorsePower.ValueChanged += (object o, EventArgs EA) => { HorsePower_Value.Text = HorsePower.Value.ToString() + " hp"; };

            Slider Weight = new Slider(new Point(_sliderX, _startY - 3 * _diffY), vehiclemenu["weightMin"], vehiclemenu["weightMax"]);

            this.Controls.Add(Weight);
            SliderText Weight_label = new SliderText(Dosis_font_family, new Point(_sliderX, _textY - 3 * _diffY), "Weight:");

            this.Controls.Add(Weight_label);
            SliderText Weight_Value = new SliderText(Dosis_font_family, new Point(_textX, _textY - 3 * _diffY), Weight.Value.ToString() + " kg");

            this.Controls.Add(Weight_Value);
            Weight.ValueChanged += (object o, EventArgs EA) => { Weight_Value.Text = Weight.Value.ToString() + " kg"; };

            Slider Occurunce = new Slider(new Point(_sliderX, _startY - 4 * _diffY), vehiclemenu["occurenceMin"], vehiclemenu["occurenceMax"]);

            this.Controls.Add(Occurunce);
            SliderText Occurunce_label = new SliderText(Dosis_font_family, new Point(_sliderX, _textY - 4 * _diffY), "Occurunce:");

            this.Controls.Add(Occurunce_label);
            SliderText Occurunce_Value = new SliderText(Dosis_font_family, new Point(_textX, _textY - 4 * _diffY), Occurunce.Value.ToString() + " %");

            this.Controls.Add(Occurunce_Value);
            Occurunce.ValueChanged += (object o, EventArgs EA) => { Occurunce_Value.Text = Occurunce.Value.ToString() + " %"; };

            CurvedButtons Vehicles_header = new CurvedButtons(new Size(menu["headerSizeX"], menu["headerSizeY"]),
                                                              new Point(menu["headerX"], menu["headerY"]), "../../User Interface Recources/Edit_Vehicle_Header.png");

            this.Controls.Add(Vehicles_header);



            /* Slider temp1 = new Slider(new Point(_sliderX, _start + _diff * 4), 0, 100); //sliderDiffY //sliderStart:100 / sliderX:25 //headerSizeX //headerSizeY //headerX //headerY
             * this.Controls.Add(temp1);
             *
             * Slider temp2 = new Slider(new Point(_sliderX, _start + _diff * 3), 0, 100);
             * this.Controls.Add(temp2);
             *
             * Slider temp3 = new Slider(new Point(_sliderX, _start + _diff * 2), 0, 100);
             * this.Controls.Add(temp3);
             *
             * Slider temp4 = new Slider(new Point(_sliderX, _start + _diff), 0, 100);
             * this.Controls.Add(temp4);
             *
             * Slider temp5 = new Slider(new Point(_sliderX, _start), 0, 100);
             * this.Controls.Add(temp5);
             *
             * CurvedButtons Vehicles_header = new CurvedButtons(new Size(menu["headerSizeX"], menu["headerSizeY"]),
             * new Point(menu["headerX"], menu["headerY"]), "../../User Interface Recources/Edit_Vehicle_Header.png");
             * this.Controls.Add(Vehicles_header);*/
        }
Ejemplo n.º 2
0
        private void Initialize(Form Form, int Sub_menu_width, FontFamily Dosis_font_family)
        {
            Dictionary <string, int> menu = User_Controls.Config.simElementsMenu;
            int _sliderX   = menu["sliderX"];
            int _start     = menu["sliderStartDriver"];
            int _diff      = menu["sliderDiffY"];
            int _text      = menu["textX"];
            int _textstart = menu["textStartDriver"];



            List <string>            _temp      = AIController.getStringDriverStats();
            Dictionary <string, int> DriverMenu = User_Controls.Config.simDriver;

            Selection_box = new Selection_box(Form, Dosis_font_family, _temp);
            if (Form.WindowState == FormWindowState.Maximized)
            {
                Selection_box.Location = new Point(User_Controls.Config.standardSubMenu["selectionBoxMaxX"], User_Controls.Config.standardSubMenu["selectionBoxMaxY"]);
            }
            else
            {
                Selection_box.Location = new Point(User_Controls.Config.standardSubMenu["selectionBoxX"], User_Controls.Config.standardSubMenu["selectionBoxY"]);
            }
            this.Controls.Add(Selection_box);

            Slider Reaction_time = new Slider(new Point(_sliderX, _start + _diff * 4), DriverMenu["reactionTimeMin"], DriverMenu["reactionTimeMax"]);

            this.Controls.Add(Reaction_time);
            SliderText Reaction_time_label = new SliderText(Dosis_font_family, new Point(_sliderX, _textstart + _diff * 4), "Reaction time:");

            this.Controls.Add(Reaction_time_label);
            SliderText Reaction_time_Value = new SliderText(Dosis_font_family, new Point(_text, _textstart + _diff * 4), (Reaction_time.Value / 10).ToString() + " s");

            this.Controls.Add(Reaction_time_Value);
            Reaction_time.ValueChanged += (object o, EventArgs EA) => { Reaction_time_Value.Text = (((Reaction_time.Value)) / 10).ToString() + " s"; };

            Slider Follow_interval = new Slider(new Point(_sliderX, _start + _diff * 3), DriverMenu["followIntervalMin"], DriverMenu["followIntervalMax"]);

            this.Controls.Add(Follow_interval);
            SliderText Follow_interval_label = new SliderText(Dosis_font_family, new Point(_sliderX, _textstart + _diff * 3), "Follow interval:");

            this.Controls.Add(Follow_interval_label);
            SliderText Follow_interval_Value = new SliderText(Dosis_font_family, new Point(_text, _textstart + _diff * 3), (Follow_interval.Value / 10).ToString() + " s");

            this.Controls.Add(Follow_interval_Value);
            Follow_interval.ValueChanged += (object o, EventArgs EA) => { Follow_interval_Value.Text = (((double)(Follow_interval.Value)) / 10).ToString() + " s"; };

            Slider Speeding = new Slider(new Point(_sliderX, _start + _diff * 2), DriverMenu["speedingMin"], DriverMenu["speedingMax"]);

            this.Controls.Add(Speeding);
            SliderText Speeding_label = new SliderText(Dosis_font_family, new Point(_sliderX, _textstart + _diff * 2), "Speeding:");

            this.Controls.Add(Speeding_label);
            SliderText Speeding_Value = new SliderText(Dosis_font_family, new Point(_text, _textstart + _diff * 2), Speeding.Value.ToString() + " km/h");

            this.Controls.Add(Speeding_Value);
            Speeding.ValueChanged += (object o, EventArgs EA) => { Speeding_Value.Text = Speeding.Value.ToString() + " km/h"; };

            Slider Rulebreaking = new Slider(new Point(_sliderX, _start + _diff), DriverMenu["ruleBreakingMin"], DriverMenu["ruleBreakingMax"]);

            this.Controls.Add(Rulebreaking);
            SliderText Rulebreaking_label = new SliderText(Dosis_font_family, new Point(_sliderX, _textstart + _diff), "Rulebreaking:");

            this.Controls.Add(Rulebreaking_label);
            SliderText Rulebreaking_Value = new SliderText(Dosis_font_family, new Point(_text, _textstart + _diff), Rulebreaking.Value.ToString() + " %");

            this.Controls.Add(Rulebreaking_Value);
            Rulebreaking.ValueChanged += (object o, EventArgs EA) => { Rulebreaking_Value.Text = Rulebreaking.Value.ToString() + " %"; };

            Slider Occurunce = new Slider(new Point(_sliderX, _start), DriverMenu["occurenceMin"], DriverMenu["occurenceMax"]);

            this.Controls.Add(Occurunce);
            SliderText Occurunce_label = new SliderText(Dosis_font_family, new Point(_sliderX, _textstart), "Occurunce:");

            this.Controls.Add(Occurunce_label);
            SliderText Occurunce_Value = new SliderText(Dosis_font_family, new Point(_text, _textstart), Occurunce.Value.ToString() + " %");

            this.Controls.Add(Occurunce_Value);
            Occurunce.ValueChanged += (object o, EventArgs EA) => { Occurunce_Value.Text = Occurunce.Value.ToString() + " %"; };

            //----------------------------------------------

            CurvedButtons Edit_Driver_Header = new CurvedButtons(new Size(menu["headerSizeX"], menu["headerSizeY"]),
                                                                 new Point(menu["headerX"], menu["headerY"]), "../../User Interface Recources/Edit_Driver_Header.png");

            this.Controls.Add(Edit_Driver_Header);
        }