Esempio n. 1
0
        public void Display(object data, bool isRowOdd)
        {
            m_options = data as VehicleOptions;

            if (m_icon == null || m_options == null)
            {
                return;
            }

            m_icon.spriteName = UIMainPanel.vehicleIconList[(int)m_options.category];
            m_icon.size       = m_icon.spriteInfo.pixelSize;
            UIUtils.ResizeIcon(m_icon, new Vector2(32, 32));
            m_icon.relativePosition = new Vector3(10, Mathf.Floor((height - m_icon.height) / 2));

            m_name.text = m_options.localizedName;

            m_disabled.isVisible = !options.enabled;
            m_name.textColor     = options.enabled ? new Color32(255, 255, 255, 255) : new Color32(128, 128, 128, 255);

            m_steamIcon.tooltip   = m_options.steamID;
            m_steamIcon.isVisible = m_options.steamID != null;

            if (isRowOdd)
            {
                background.backgroundSprite = "UnlockingItemBackground";
                background.color            = new Color32(0, 0, 0, 128);
            }
            else
            {
                background.backgroundSprite = null;
            }
        }
        protected void OnCheckChanged(UIComponent component, bool state)
        {
            if (!m_initialized || m_options == null)
            {
                return;
            }
            m_initialized = false;

            if (component == m_enabled)
            {
                if (m_options.isTrailer)
                {
                    VehicleOptions engine = m_options.engine;

                    if (engine.enabled != state)
                    {
                        engine.enabled = state;
                        VehicleOptions.UpdateTransfertVehicles();
                        eventEnableCheckChanged(this, state);
                    }
                }
                else
                {
                    if (m_options.enabled != state)
                    {
                        m_options.enabled = state;
                        VehicleOptions.UpdateTransfertVehicles();
                        eventEnableCheckChanged(this, state);
                    }
                }

                if (!state && !AdvancedVehicleOptionsUID.CheckServiceValidity(m_options.category))
                {
                    GUI.UIWarningModal.instance.message = UIMainPanel.categoryList[(int)m_options.category + 1] + " may not work correctly because no vehicles are allowed to spawn.";
                    UIView.PushModal(GUI.UIWarningModal.instance);
                    GUI.UIWarningModal.instance.Show(true);
                }
            }
            else if (component == m_addBackEngine && m_options.addBackEngine != state)
            {
                m_options.addBackEngine = state;
                if (m_options.addBackEngine == state)
                {
                    VehicleOptions.prefabUpdateEngine = m_options.prefab;
                    new EnumerableActionThread(VehicleOptions.UpdateBackEngines);
                }
            }
            else if (component == m_useColors && m_options.useColorVariations != state)
            {
                m_options.useColorVariations = state;
                (parent as UIMainPanel).ChangePreviewColor(m_color0.selectedColor);
            }
            else if (component == m_isLargeVehicle)
            {
                m_options.isLargeVehicle = state;
            }

            m_initialized = true;
        }
Esempio n. 3
0
        protected void OnCheckChanged(UIComponent component, bool state)
        {
            if (!m_initialized || m_options == null)
            {
                return;
            }
            m_initialized = false;

            if (component == m_enabled)
            {
                if (m_options.isTrailer)
                {
                    VehicleOptions engine = m_options.engine;

                    if (engine.enabled != state)
                    {
                        engine.enabled = state;
                        VehicleOptions.UpdateTransfertVehicles();
                        eventEnableCheckChanged(this, state);
                    }
                }
                else
                {
                    if (m_options.enabled != state)
                    {
                        m_options.enabled = state;
                        VehicleOptions.UpdateTransfertVehicles();
                        eventEnableCheckChanged(this, state);
                    }
                }

                if (!state && !AdvancedVehicleOptions.CheckServiceValidity(m_options.category))
                {
                    GUI.UIWarningModal.instance.message = UIMainPanel.categoryList[(int)m_options.category + 1] + Translations.Translate("AVO_MOD_OP42");
                    UIView.PushModal(GUI.UIWarningModal.instance);
                    GUI.UIWarningModal.instance.Show(true);
                }
            }
            else if (component == m_addBackEngine && m_options.addBackEngine != state)
            {
                m_options.addBackEngine = state;
                if (m_options.addBackEngine == state)
                {
                    VehicleOptions.prefabUpdateEngine = m_options.prefab;
                    SimulationManager.instance.AddAction(VehicleOptions.UpdateBackEngines);
                }
            }
            else if (component == m_useColors && m_options.useColorVariations != state)
            {
                m_options.useColorVariations = state;
                (parent as UIMainPanel).ChangePreviewColor(m_color0.selectedColor);
            }
            else if (component == m_isLargeVehicle)
            {
                m_options.isLargeVehicle = state;
            }
            AdvancedVehicleOptions.ExportVehicleDataConfig(m_initialized);
            m_initialized = true;
        }
Esempio n. 4
0
        /// <summary>
        /// Convert the Option Codes into a VehicleOptions instance
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="objectType"></param>
        /// <param name="existingValue"></param>
        /// <param name="serializer"></param>
        /// <returns></returns>
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            string encoded = serializer.Deserialize <string>(reader);

            VehicleOptions options = new VehicleOptions(encoded);

            return(options);
        }
        public void Show(VehicleOptions options)
        {
            m_initialized = false;

            m_options = options;

            if (m_color0 == null)
            {
                return;
            }

            m_color0.relativePosition = new Vector3(13, 140 - 2);
            m_color1.relativePosition = new Vector3(13, 165 - 2);
            m_color2.relativePosition = new Vector3(158, 140 - 2);
            m_color3.relativePosition = new Vector3(158, 165 - 2);

            m_maxSpeed.text        = Mathf.RoundToInt(options.maxSpeed * maxSpeedToKmhConversionFactor).ToString();
            m_acceleration.text    = options.acceleration.ToString();
            m_braking.text         = options.braking.ToString();
            m_turning.text         = options.turning.ToString();
            m_springs.text         = options.springs.ToString();
            m_dampers.text         = options.dampers.ToString();
            m_leanMultiplier.text  = options.leanMultiplier.ToString();
            m_nodMultiplier.text   = options.nodMultiplier.ToString();
            m_useColors.isChecked  = options.useColorVariations;
            m_color0.selectedColor = options.color0;
            m_color1.selectedColor = options.color1;
            m_color2.selectedColor = options.color2;
            m_color3.selectedColor = options.color3;
            m_color0_hex.text      = options.color0.ToString();
            m_color1_hex.text      = options.color1.ToString();
            m_color2_hex.text      = options.color2.ToString();
            m_color3_hex.text      = options.color3.ToString();
            m_enabled.isChecked    = options.enabled;
            //m_enabled.isVisible = !options.isTrailer;
            m_addBackEngine.isChecked = options.addBackEngine;
            m_addBackEngine.isVisible = options.isTrain;

            m_capacity.text             = options.capacity.ToString();
            m_capacity.parent.isVisible = options.hasCapacity;

            string name = options.localizedName;

            if (name.Length > 20)
            {
                name = name.Substring(0, 20) + "...";
            }
            m_removeLabel.text = "Remove vehicles (" + name + "):";

            (parent as UIMainPanel).ChangePreviewColor(m_color0.selectedColor);

            m_initialized = true;
        }
        public override void Start()
        {
            base.Start();
            canFocus      = true;
            isInteractive = true;
            width         = 315;
            height        = 330;

            SetupControls();

            m_options = new VehicleOptions();
        }
Esempio n. 7
0
        public override void Start()
        {
            base.Start();
            canFocus      = true;
            isInteractive = true;
            width         = 390;
            height        = 370;

            SetupControls();
            OldCapacityTooltip        = m_capacity.tooltip;
            OldMaxSpeedTooltip        = m_maxSpeed.tooltip;
            OldSpecialCapacityTooltip = m_specialcapacity.tooltip;
            OldColorTextField         = m_capacity.color;
            OldColorText = m_capacity.textColor;

            m_options = new VehicleOptions();
        }
Esempio n. 8
0
        public void Display(object data, bool isRowOdd)
        {
            m_options = data as VehicleOptions;

            if (m_icon == null || m_options == null)
            {
                return;
            }

            m_icon.spriteName = UIMainPanel.vehicleIconList[(int)m_options.category];
            m_icon.size       = m_icon.spriteInfo.pixelSize;
            UIUtils.ResizeIcon(m_icon, new Vector2(32, 32));
            m_icon.relativePosition = new Vector3(10, Mathf.Floor((height - m_icon.height) / 2));

            m_name.text = m_options.localizedName;

            m_disabled.isVisible = !options.enabled;

            //Verify if the vehicle is a Game Controlled Spawn Public Transport vehicle, where the game controls spawning; if disabled/deactivated set to enabled
            if (options.isPublicTransportGame == true)             // && AdvancedVehicleOptionsUID.SpawnControl == true)  && options.isUncontrolledPublicTransport == false)
            {
                if (options.enabled == false)
                {
                    options.enabled = true;
                }
            }

            m_disabled.isVisible = !options.enabled;

            m_name.textColor = options.enabled ? new Color32(255, 255, 255, 255) : new Color32(128, 128, 128, 255);

            m_steamIcon.tooltip   = m_options.steamID;
            m_steamIcon.isVisible = m_options.steamID != null;

            if (isRowOdd)
            {
                background.backgroundSprite = "UnlockingItemBackground";
                background.color            = new Color32(0, 0, 0, 128);
            }
            else
            {
                background.backgroundSprite = null;
            }
        }
Esempio n. 9
0
        private void FollowNextVehicle()
        {
            Array16 <Vehicle> vehicles = VehicleManager.instance.m_vehicles;
            VehicleOptions    options  = m_optionPanel.m_options;

            for (uint i = (m_seekStart + 1) % vehicles.m_size; i != m_seekStart; i = (i + 1) % vehicles.m_size)
            {
                if (vehicles.m_buffer[i].Info == m_optionPanel.m_options.prefab)
                {
                    bool isSpawned = (vehicles.m_buffer[i].m_flags & Vehicle.Flags.Spawned) == Vehicle.Flags.Spawned;

                    InstanceID instanceID = default(InstanceID);
                    instanceID.Vehicle = (ushort)i;

                    if (!isSpawned || instanceID.IsEmpty || !InstanceManager.IsValid(instanceID))
                    {
                        continue;
                    }

                    Vector3    targetPosition;
                    Quaternion quaternion;
                    Vector3    vector;

                    if (!InstanceManager.GetPosition(instanceID, out targetPosition, out quaternion, out vector))
                    {
                        continue;
                    }

                    Vector3 pos = targetPosition;
                    GameAreaManager.instance.ClampPoint(ref targetPosition);
                    if (targetPosition != pos)
                    {
                        continue;
                    }

                    m_cameraController.SetTarget(instanceID, ToolsModifierControl.cameraController.transform.position, false);

                    m_seekStart = (i + 1) % vehicles.m_size;
                    return;
                }
            }
            m_seekStart = 0;
        }
Esempio n. 10
0
        protected void OnSelectedItemChanged(UIComponent component, int i)
        {
            m_seekStart = 0;

            VehicleOptions options = m_fastList.rowsData[i] as VehicleOptions;

            m_optionPanel.Show(options);
            m_followVehicle.isVisible = m_preview.parent.isVisible = true;

            m_previewColor   = options.color0;
            m_previewColor.a = 0;                   // Fixes the wrong lighting on one half of the vehicle
            m_previewRenderer.cameraRotation = -60; // 120f;
            m_previewRenderer.zoom           = 3f;
            if (options.useColorVariations)
            {
                m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab, m_previewColor);
            }
            else
            {
                m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Creates all the submenus depending on the permissions of the user.
        /// </summary>
        private void CreateSubmenus()
        {
            // Add the player options menu.
            if (IsAllowed(Permission.POMenu))
            {
                PlayerOptionsMenu = new PlayerOptions();
                Menu     menu   = PlayerOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Персонаж", "Настройки вашего персонажа.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add the vehicle options Menu.
            if (IsAllowed(Permission.VOMenu))
            {
                VehicleOptionsMenu = new VehicleOptions();
                Menu     menu   = VehicleOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Автомобиль", "Настройки вашего автомобиля.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add the vehicle spawner menu.
            if (IsAllowed(Permission.VSMenu))
            {
                VehicleSpawnerMenu = new VehicleSpawner();
                Menu     menu   = VehicleSpawnerMenu.GetMenu();
                MenuItem button = new MenuItem("Заспавнить автомобиль", "Меню спавна автомобилей.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add Saved Vehicles menu.
            if (IsAllowed(Permission.SVMenu))
            {
                SavedVehiclesMenu = new SavedVehicles();
                Menu     menu   = SavedVehiclesMenu.GetMenu();
                MenuItem button = new MenuItem("Сохраненные автомобили", "Меню спавна/удаления и сохранения автомобилей.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        SavedVehiclesMenu.UpdateMenuAvailableCategories();
                    }
                };
            }

            // Add the Personal Vehicle menu.
            if (IsAllowed(Permission.PVMenu))
            {
                PersonalVehicleMenu = new PersonalVehicle();
                Menu     menu   = PersonalVehicleMenu.GetMenu();
                MenuItem button = new MenuItem("Персональный автомобиль", "Меню настроек личного автомобиля.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add the player appearance menu.
            if (IsAllowed(Permission.PAMenu))
            {
                PlayerAppearanceMenu = new PlayerAppearance();
                Menu     menu   = PlayerAppearanceMenu.GetMenu();
                MenuItem button = new MenuItem("Внешний вид персонажа", "Меню выбора и кастомизации NPC/AI-персонажей.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);

                MpPedCustomizationMenu = new MpPedCustomization();
                Menu     menu2   = MpPedCustomizationMenu.GetMenu();
                MenuItem button2 = new MenuItem("Внешний вид MP-персонажа", "Меню создания и модификации MP персонажей.")
                {
                    Label = "→→→"
                };
                AddMenu(menu2, button2);
            }

            // Add the time options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (IsAllowed(Permission.TOMenu) && GetSettingsBool(Setting.vmenu_enable_time_sync))
            {
                TimeOptionsMenu = new TimeOptions();
                Menu     menu   = TimeOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Time Options", "Change the time, and edit other time related options.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add the weather options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (IsAllowed(Permission.WOMenu) && GetSettingsBool(Setting.vmenu_enable_weather_sync))
            {
                WeatherOptionsMenu = new WeatherOptions();
                Menu     menu   = WeatherOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Weather Options", "Change all weather related options here.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add the weapons menu.
            if (IsAllowed(Permission.WPMenu))
            {
                WeaponOptionsMenu = new WeaponOptions();
                Menu     menu   = WeaponOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Оружие", "Меню добавления и редактирования оружия.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add Weapon Loadouts menu.
            if (IsAllowed(Permission.WLMenu))
            {
                WeaponLoadoutsMenu = new WeaponLoadouts();
                Menu     menu   = WeaponLoadoutsMenu.GetMenu();
                MenuItem button = new MenuItem("Боезапасы", "Меню создания и редактирования боезапасов.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add Voice Chat Menu.
            if (IsAllowed(Permission.VCMenu))
            {
                VoiceChatSettingsMenu = new VoiceChat();
                Menu     menu   = VoiceChatSettingsMenu.GetMenu();
                MenuItem button = new MenuItem("Голосовой чат", "Меню настроек голосового чата.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add the online players menu.
            if (IsAllowed(Permission.OPMenu))
            {
                OnlinePlayersMenu = new OnlinePlayers();
                Menu     menu   = OnlinePlayersMenu.GetMenu();
                MenuItem button = new MenuItem("Игроки онлайн", "Все подключенные игроки.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        OnlinePlayersMenu.UpdatePlayerlist();
                        menu.RefreshIndex();
                        //menu.UpdateScaleform();
                    }
                };
            }
            if (IsAllowed(Permission.OPUnban) || IsAllowed(Permission.OPViewBannedPlayers))
            {
                BannedPlayersMenu = new BannedPlayers();
                Menu     menu   = BannedPlayersMenu.GetMenu();
                MenuItem button = new MenuItem("Заблокированные игроки", "Посмотреть всех заблокированных игроков.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        TriggerServerEvent("vMenu:RequestBanList", Game.Player.Handle);
                        menu.RefreshIndex();
                        //menu.UpdateScaleform();
                    }
                };
            }

            // Add misc settings menu.
            //if (CommonFunctions.IsAllowed(Permission.MSMenu))
            // removed the permissions check, because the misc menu should've never been restricted in the first place.
            // not sure why I even added this before... saving of preferences and similar functions should always be allowed.
            // no matter what.
            {
                MiscSettingsMenu = new MiscSettings();
                Menu     menu   = MiscSettingsMenu.GetMenu();
                MenuItem button = new MenuItem("Прочие настройки", "Дополнительные опции и настройки меню сервера.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add About Menu.
            AboutMenu = new About();
            Menu     sub = AboutMenu.GetMenu();
            MenuItem btn = new MenuItem("О Меню", "Информация о меню.")
            {
                Label = "→→→"
            };

            AddMenu(sub, btn);

            {
                RecordingMenu = new Recording();
                Menu     menu   = RecordingMenu.GetMenu();
                MenuItem button = new MenuItem("Редактор ~y~R*", "Запись и редактирование клипов в игре.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Refresh everything.
            MenuController.Menus.ForEach((m) => m.RefreshIndex());

            if (!GetSettingsBool(Setting.vmenu_use_permissions))
            {
                Notify.Alert("vMenu is set up to ignore permissions, default permissions will be used.");
            }
        }
Esempio n. 12
0
        public void Show(VehicleOptions options)
        {
            m_initialized = false;

            m_options = options;

            if (m_color0 == null)
            {
                return;
            }

            m_color0.relativePosition = new Vector3(35, 135);
            m_color1.relativePosition = new Vector3(35, 160);
            m_color2.relativePosition = new Vector3(182, 135);
            m_color3.relativePosition = new Vector3(182, 160);

            if (!AdvancedVehicleOptions.SpeedUnitOption)
            {
                m_maxSpeed.text = Mathf.RoundToInt(options.maxSpeed * maxSpeedToKmhConversionFactor).ToString();
                kmhLabel.text   = Translations.Translate("AVO_MOD_OP01");
            }
            else
            {
                m_maxSpeed.text = Mathf.RoundToInt((options.maxSpeed / mphFactor) * maxSpeedToKmhConversionFactor).ToString();
                kmhLabel.text   = Translations.Translate("AVO_MOD_OP02");
            }

            m_acceleration.text        = options.acceleration.ToString();
            m_braking.text             = options.braking.ToString();
            m_turning.text             = options.turning.ToString();
            m_springs.text             = options.springs.ToString();
            m_dampers.text             = options.dampers.ToString();
            m_leanMultiplier.text      = options.leanMultiplier.ToString();
            m_nodMultiplier.text       = options.nodMultiplier.ToString();
            m_useColors.isChecked      = options.useColorVariations;
            m_color0.selectedColor     = options.color0;
            m_color1.selectedColor     = options.color1;
            m_color2.selectedColor     = options.color2;
            m_color3.selectedColor     = options.color3;
            m_color0_hex.text          = options.color0.ToString();
            m_color1_hex.text          = options.color1.ToString();
            m_color2_hex.text          = options.color2.ToString();
            m_color3_hex.text          = options.color3.ToString();
            m_isLargeVehicle.isChecked = options.isLargeVehicle;

            m_enabled.isChecked = options.enabled;
            m_enabled.Show();
            m_enabled.isVisible = !options.isTrailer;

            m_addBackEngine.isChecked = options.addBackEngine;
            m_addBackEngine.isVisible = options.isTrain;
            m_maxSpeed.isInteractive  = true;

            m_lineoverview.Hide();
            m_isLargeVehicle.Hide();
            m_useColorsLabel.Hide();

            m_capacity.parent.isVisible = true;
            m_capacity.isInteractive    = true;
            m_capacity.text             = options.capacity.ToString();
            m_capacity.isVisible        = options.hasCapacity;
            capacityLabel.isVisible     = options.hasCapacity;
            bustrailerLabel.isVisible   = false;

            m_specialcapacity.text               = options.specialcapacity.ToString();
            m_specialcapacity.isVisible          = options.hasSpecialCapacity;
            specialcapacityLabel.isVisible       = options.hasSpecialCapacity;
            m_userguidespecialcapacity.isVisible = options.hasSpecialCapacity;

            m_capacity.color          = OldColorTextField;
            m_capacity.textColor      = OldColorText;
            m_capacity.tooltip        = OldCapacityTooltip;
            m_specialcapacity.tooltip = OldSpecialCapacityTooltip;
            m_maxSpeed.color          = OldColorTextField;
            m_maxSpeed.textColor      = OldColorText;
            m_maxSpeed.tooltip        = OldMaxSpeedTooltip;

            //Only display Cargo Capacity or Passenger Capacity - not any other values
            if (options.isNonPaxCargo == true && options.hasCapacity == true && AdvancedVehicleOptions.ShowMoreVehicleOptions == true)
            {
                m_capacity.parent.isVisible = true;
            }
            else
            if (options.isNonPaxCargo == true && options.hasCapacity == true && AdvancedVehicleOptions.ShowMoreVehicleOptions == false)
            {
                m_capacity.parent.isVisible = false;
            }

            //Compatibility Patch for Vehicle Color Expander - hide all controls, if mod is active. Not relating to PublicTransport only, but all vehicles
            if (VCXCompatibilityPatch.IsVCXActive())
            {
                m_useColors.enabled = false;
                m_color0.Hide();
                m_color0_hex.Hide();
                m_color1.Hide();
                m_color1_hex.Hide();
                m_color2.Hide();
                m_color2_hex.Hide();
                m_color3.Hide();
                m_color3_hex.Hide();
                m_useColorsLabel.Show();
            }

            // Compatibility Patch for IPT, TLM and Cities Skylines Vehicle Spawning, Vehicle values. Instead of Spawn Allowed buttons for the Vehicles the Line Overview Window will be shown.
            if (options.isPublicTransportGame == true)
            {
                m_enabled.Hide();
                m_lineoverview.Show();
                m_userguidespawn.Show();
                LineOverviewType = options.ReturnLineOverviewType;
            }
            else
            {
                if (options.ValidateIsBusTrailer)
                {
                    m_enabled.Hide();
                    bustrailerLabel.isVisible = true;
                }
                else
                {
                    m_enabled.Show();
                    bustrailerLabel.isVisible = false;
                }
                m_lineoverview.Hide();
                m_userguidespawn.Hide();
            }

            if (AdvancedVehicleOptions.OverrideCompatibilityWarnings == true && options.isPublicTransport == true && !options.isNotPublicTransportMod == true)
            {
                if (IPTCompatibilityPatch.IsIPTActive() == true)
                {
                    m_maxSpeed.color            = new Color32(240, 130, 130, 255);
                    m_capacity.color            = new Color32(240, 130, 130, 255);
                    m_specialcapacity.color     = new Color32(240, 130, 130, 255);
                    m_maxSpeed.textColor        = new Color32(255, 230, 130, 255);
                    m_capacity.textColor        = new Color32(255, 230, 130, 255);
                    m_specialcapacity.textColor = new Color32(255, 230, 130, 255);
                    m_maxSpeed.tooltip          = m_maxSpeed.tooltip + Translations.Translate("AVO_MOD_OP03");
                    m_capacity.tooltip          = m_capacity.tooltip + Translations.Translate("AVO_MOD_OP03");
                    m_specialcapacity.tooltip   = m_specialcapacity.tooltip + Translations.Translate("AVO_MOD_OP03");
                }
                if (TLMCompatibilityPatch.IsTLMActive() == true)
                {
                    m_capacity.color     = new Color32(240, 130, 130, 255);
                    m_capacity.textColor = new Color32(255, 230, 130, 255);
                    m_capacity.tooltip   = m_capacity.tooltip + Translations.Translate("AVO_MOD_OP04");
                }
            }

            if (NoBigTruckCompatibilityPatch.IsNBTActive() == true && AdvancedVehicleOptions.ControlTruckDelivery == true && options.isDelivery == true && options.hasTrailer == true)
            {
                m_isLargeVehicle.Show();

                Logging.Message("Vehicle " + options.localizedName + " is flagged as Large Vehicle.");
            }

            // Compatibility Patch section ends


            // Flight Stand Info introduced in Airports DLC

            if ((options.prefab.m_vehicleType == VehicleInfo.VehicleType.Plane && options.prefab.m_class.m_level != ItemClass.Level.Level5))
            {
                if (options.prefab.m_class.m_level == ItemClass.Level.Level1)
                {
                    m_planesize.text = Translations.Translate("AVO_MOD_OP43") + " " + Translations.Translate("AVO_MOD_OP45");
                }
                if (options.prefab.m_class.m_level == ItemClass.Level.Level2)
                {
                    m_planesize.text = Translations.Translate("AVO_MOD_OP43") + " " + Translations.Translate("AVO_MOD_OP46");
                }
                if (options.prefab.m_class.m_level == ItemClass.Level.Level3)
                {
                    m_planesize.text = Translations.Translate("AVO_MOD_OP43") + " " + Translations.Translate("AVO_MOD_OP44");;
                }
                if (options.prefab.m_class.m_level == ItemClass.Level.Level4)
                {
                    m_planesize.text = Translations.Translate("AVO_MOD_OP43") + " " + Translations.Translate("AVO_MOD_OP47");;
                }
                m_planesize.isVisible = true;
            }
            else
            {
                m_planesize.isVisible = false;
            }

            string name = options.localizedName;

            if (name.Length > 40)
            {
                name = name.Substring(0, 38) + "...";
            }
            m_removeLabel.text = Translations.Translate("AVO_MOD_OP05") + name;

            (parent as UIMainPanel).ChangePreviewColor(m_color0.selectedColor);

            capacityLabel.text        = options.CapacityString;
            specialcapacityLabel.text = options.SpecialCapacityString;

            m_initialized = true;
        }
        public void Show(VehicleOptions options)
        {
            m_initialized = false;

            m_options = options;

            if (m_color0 == null)
            {
                return;
            }

            m_color0.relativePosition = new Vector3(35, 135);
            m_color1.relativePosition = new Vector3(35, 160);
            m_color2.relativePosition = new Vector3(182, 135);
            m_color3.relativePosition = new Vector3(182, 160);

            if (!AdvancedVehicleOptionsUID.SpeedUnitOption)
            {
                m_maxSpeed.text = Mathf.RoundToInt(options.maxSpeed * maxSpeedToKmhConversionFactor).ToString();
                kmhLabel.text   = "km/h";
            }
            else
            {
                m_maxSpeed.text = Mathf.RoundToInt((options.maxSpeed / mphFactor) * maxSpeedToKmhConversionFactor).ToString();
                kmhLabel.text   = "mph";
            }

            m_acceleration.text        = options.acceleration.ToString();//m_capacity
            m_braking.text             = options.braking.ToString();
            m_turning.text             = options.turning.ToString();
            m_springs.text             = options.springs.ToString();
            m_dampers.text             = options.dampers.ToString();
            m_leanMultiplier.text      = options.leanMultiplier.ToString();
            m_nodMultiplier.text       = options.nodMultiplier.ToString();
            m_useColors.isChecked      = options.useColorVariations;
            m_color0.selectedColor     = options.color0;
            m_color1.selectedColor     = options.color1;
            m_color2.selectedColor     = options.color2;
            m_color3.selectedColor     = options.color3;
            m_color0_hex.text          = options.color0.ToString();
            m_color1_hex.text          = options.color1.ToString();
            m_color2_hex.text          = options.color2.ToString();
            m_color3_hex.text          = options.color3.ToString();
            m_isLargeVehicle.isChecked = options.isLargeVehicle;

            m_enabled.isChecked = options.enabled;
            m_enabled.Show();
            m_enabled.isVisible = !options.isTrailer;

            m_addBackEngine.isChecked = options.addBackEngine;
            m_addBackEngine.isVisible = options.isTrain;
            m_maxSpeed.isInteractive  = true;

            m_lineoverview.Hide();
            m_isLargeVehicle.Hide();
            m_useColorsLabel.Hide();

            m_capacity.parent.isVisible = true;
            m_capacity.isInteractive    = true;
            m_capacity.text             = options.capacity.ToString();
            m_capacity.isVisible        = options.hasCapacity;
            capacityLabel.isVisible     = options.hasCapacity;
            bustrailerLabel.isVisible   = false;

            m_specialcapacity.text               = options.specialcapacity.ToString();
            m_specialcapacity.isVisible          = options.hasSpecialCapacity;
            specialcapacityLabel.isVisible       = options.hasSpecialCapacity;
            m_userguidespecialcapacity.isVisible = options.hasSpecialCapacity;

            m_capacity.color          = OldColorTextField;
            m_capacity.textColor      = OldColorText;
            m_capacity.tooltip        = OldCapacityTooltip;
            m_specialcapacity.tooltip = OldSpecialCapacityTooltip;
            m_maxSpeed.color          = OldColorTextField;
            m_maxSpeed.textColor      = OldColorText;
            m_maxSpeed.tooltip        = OldMaxSpeedTooltip;

            //DebugUtils.Log("GameBalanceOptionsptions " + AdvancedVehicleOptionsUID.GameBalanceOptions);
            //DebugUtils.Log("NonPaxCargo - Do Not Show Capacity " + options.isNonPaxCargo);
            //DebugUtils.Log("Capacity - Do Not Show Capacity " + options.hasCapacity);

            //Only display Cargo Capacity or Passenger Capacity - not any other values
            if (options.isNonPaxCargo == true && options.hasCapacity == true && AdvancedVehicleOptionsUID.GameBalanceOptions == true)
            {
                m_capacity.parent.isVisible = true;
            }
            else
            if (options.isNonPaxCargo == true && options.hasCapacity == true && AdvancedVehicleOptionsUID.GameBalanceOptions == false)
            {
                m_capacity.parent.isVisible = false;
            }

            //Compatibility Patch for Vehicle Color Expander - hide all controls, if mod is active. Not relating to PublicTransport only, but all vehicles
            if (VCXCompatibilityPatch.IsVCXActive())
            {
                m_useColors.enabled = false;
                m_color0.Hide();
                m_color0_hex.Hide();
                m_color1.Hide();
                m_color1_hex.Hide();
                m_color2.Hide();
                m_color2_hex.Hide();
                m_color3.Hide();
                m_color3_hex.Hide();
                m_useColorsLabel.Show();
            }

            //DebugUtils.Log("IsIPTActive " + IPTCompatibilityPatch.IsIPTActive());
            //DebugUtils.Log("OverrideIPT " + AdvancedVehicleOptionsUID.OverrideIPT);
            //DebugUtils.Log("IsPublicTransport " + options.isPublicTransport);

            // Compatibility Patch for IPT, TLM and Cities Skylines Vehicle Spawning, Vehicle values. For Spawning Vehicles the Line Overview Window will be shown.

            if ((options.isPublicTransportGame == true) && AdvancedVehicleOptionsUID.SpawnControl == true)
            {
                m_enabled.Hide();
                m_lineoverview.Show();
                m_userguidespawn.Show();
                LineOverviewType = options.ReturnLineOverviewType;
            }
            else
            {
                if (options.ValidateIsBusTrailer)
                {
                    m_enabled.Hide();
                    bustrailerLabel.isVisible = true;
                }
                else
                {
                    m_enabled.Show();
                    bustrailerLabel.isVisible = false;
                }
                m_lineoverview.Hide();
                m_userguidespawn.Hide();
            }

            if (AdvancedVehicleOptionsUID.OverrideCompatibilityWarnings == true && options.isPublicTransport == true && !options.isNotPublicTransportMod == true)
            {
                if (IPTCompatibilityPatch.IsIPTActive() == true)
                {
                    m_maxSpeed.color            = new Color32(240, 130, 130, 255);
                    m_capacity.color            = new Color32(240, 130, 130, 255);
                    m_specialcapacity.color     = new Color32(240, 130, 130, 255);
                    m_maxSpeed.textColor        = new Color32(255, 230, 130, 255);
                    m_capacity.textColor        = new Color32(255, 230, 130, 255);
                    m_specialcapacity.textColor = new Color32(255, 230, 130, 255);
                    m_maxSpeed.tooltip          = m_maxSpeed.tooltip + "\n\nWarning: Improved Public Transport is active\nand may override this setting.";
                    m_capacity.tooltip          = m_capacity.tooltip + "\n\nWarning: Improved Public Transport is active\nand may override this setting.";
                    m_specialcapacity.tooltip   = m_specialcapacity.tooltip + "\n\nWarning: Improved Public Transport is active\nand may override this setting.";
                }
                if (TLMCompatibilityPatch.IsTLMActive() == true)
                {
                    m_capacity.color     = new Color32(240, 130, 130, 255);
                    m_capacity.textColor = new Color32(255, 230, 130, 255);
                    m_capacity.tooltip   = m_capacity.tooltip + "\n\nWarning: Transport Lines Manager is active\nand may override this setting.";
                }
            }

            if (NoBigTruckCompatibilityPatch.IsNBTActive() == true && AdvancedVehicleOptionsUID.ControlTruckDelivery == true && options.isDelivery == true && options.hasTrailer == true)
            {
                m_isLargeVehicle.Show();
                //DebugUtils.Log("AVO IsLargeVehicle");
            }

            // Compatibility Patch section ends

            string name = options.localizedName;

            if (name.Length > 40)
            {
                name = name.Substring(0, 38) + "...";
            }
            m_removeLabel.text = "Actions for: " + name;

            (parent as UIMainPanel).ChangePreviewColor(m_color0.selectedColor);

            capacityLabel.text        = options.CapacityString;
            specialcapacityLabel.text = options.SpecialCapacityString;

            m_initialized = true;
        }
Esempio n. 14
0
        /// <summary>
        /// Creates all the submenus depending on the permissions of the user.
        /// </summary>
        private void CreateSubmenus()
        {
            // Add the online players menu.
            if (IsAllowed(Permission.OPMenu))
            {
                OnlinePlayersMenu = new OnlinePlayers();
                Menu     menu   = OnlinePlayersMenu.GetMenu();
                MenuItem button = new MenuItem("線上玩家列表", "當前在伺服器的所有玩家")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        OnlinePlayersMenu.UpdatePlayerlist();
                        menu.RefreshIndex();
                    }
                };
            }
            if (IsAllowed(Permission.OPUnban) || IsAllowed(Permission.OPViewBannedPlayers))
            {
                BannedPlayersMenu = new BannedPlayers();
                Menu     menu   = BannedPlayersMenu.GetMenu();
                MenuItem button = new MenuItem("封鎖玩家列表", "當前在伺服器被封鎖的玩家名單")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        TriggerServerEvent("vMenu:RequestBanList", Game.Player.Handle);
                        menu.RefreshIndex();
                    }
                };
            }

            MenuItem playerSubmenuBtn = new MenuItem("玩家相關選項", "查看與玩家相關的功能")
            {
                Label = "→→→"
            };

            Menu.AddMenuItem(playerSubmenuBtn);

            // Add the player options menu.
            if (IsAllowed(Permission.POMenu))
            {
                PlayerOptionsMenu = new PlayerOptions();
                Menu     menu   = PlayerOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("玩家選項", "可以查看常見的玩家功能.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);
            }

            MenuItem vehicleSubmenuBtn = new MenuItem("載具相關選項", "打開此子選單以獲取與載具相關的子類別.")
            {
                Label = "→→→"
            };

            Menu.AddMenuItem(vehicleSubmenuBtn);
            // Add the vehicle options Menu.
            if (IsAllowed(Permission.VOMenu))
            {
                VehicleOptionsMenu = new VehicleOptions();
                Menu     menu   = VehicleOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("載具相關選項", "您可以更改常用的載具選項,以及調整和样式化您的載具.")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
            }

            // Add the vehicle spawner menu.
            if (IsAllowed(Permission.VSMenu))
            {
                VehicleSpawnerMenu = new VehicleSpawner();
                Menu     menu   = VehicleSpawnerMenu.GetMenu();
                MenuItem button = new MenuItem("載具召喚", "召喚出任何一台載具.")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
            }

            // Add Saved Vehicles menu.
            if (IsAllowed(Permission.SVMenu))
            {
                SavedVehiclesMenu = new SavedVehicles();
                Menu     menu   = SavedVehiclesMenu.GetMenu();
                MenuItem button = new MenuItem("載具管理", "可以用來管你的載具.")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
                VehicleSubmenu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        SavedVehiclesMenu.UpdateMenuAvailableCategories();
                    }
                };
            }

            // Add the Personal Vehicle menu.
            if (IsAllowed(Permission.PVMenu))
            {
                PersonalVehicleMenu = new PersonalVehicle();
                Menu     menu   = PersonalVehicleMenu.GetMenu();
                MenuItem button = new MenuItem("私人車輛", "將一輛車設置為私人車輛,不再室內時還可以對該車輛進行某些操作.")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
            }

            // Add the player appearance menu.
            if (IsAllowed(Permission.PAMenu))
            {
                PlayerAppearanceMenu = new PlayerAppearance();
                Menu     menu   = PlayerAppearanceMenu.GetMenu();
                MenuItem button = new MenuItem("玩家容貌", "選擇一個PED模型,對其進行自定義,儲存加載角色.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);

                MpPedCustomizationMenu = new MpPedCustomization();
                Menu     menu2   = MpPedCustomizationMenu.GetMenu();
                MenuItem button2 = new MenuItem("人物外觀選項", "創建、編輯、保存和加載外觀。 ~r~注意,您只能保存在此子選單中創建的外觀。 vMenu無法檢測到在此子選單之外創建的外觀。完全是由於GTA限制.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu2, button2);
            }

            MenuItem worldSubmenuBtn = new MenuItem("世界相關選項", "打開與世界相關的子類別的子選單.")
            {
                Label = "→→→"
            };

            Menu.AddMenuItem(worldSubmenuBtn);

            // Add the time options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (IsAllowed(Permission.TOMenu) && GetSettingsBool(Setting.vmenu_enable_time_sync))
            {
                TimeOptionsMenu = new TimeOptions();
                Menu     menu   = TimeOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("時間選項", "更改時間,並編輯其他與時間相關的選項.")
                {
                    Label = "→→→"
                };
                AddMenu(WorldSubmenu, menu, button);
            }

            // Add the weather options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (IsAllowed(Permission.WOMenu) && GetSettingsBool(Setting.vmenu_enable_weather_sync))
            {
                WeatherOptionsMenu = new WeatherOptions();
                Menu     menu   = WeatherOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("天氣選項", "在此處更改所有與天氣相關的選項.")
                {
                    Label = "→→→"
                };
                AddMenu(WorldSubmenu, menu, button);
            }

            // Add the weapons menu.
            if (IsAllowed(Permission.WPMenu))
            {
                WeaponOptionsMenu = new WeaponOptions();
                Menu     menu   = WeaponOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("武器選項", "添加/刪除武器,修改武器並設置彈藥選項.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);
            }

            // Add Weapon Loadouts menu.
            if (IsAllowed(Permission.WLMenu))
            {
                WeaponLoadoutsMenu = new WeaponLoadouts();
                Menu     menu   = WeaponLoadoutsMenu.GetMenu();
                MenuItem button = new MenuItem("武器裝載量", "管理,並生成節省的武器裝載.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);
            }

            if (IsAllowed(Permission.NoClip))
            {
                MenuItem toggleNoclip = new MenuItem("切換 NoClip", "切換 NoClip 啟用或停用.");
                PlayerSubmenu.AddMenuItem(toggleNoclip);
                PlayerSubmenu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == toggleNoclip)
                    {
                        NoClipEnabled = !NoClipEnabled;
                    }
                };
            }

            // Add Voice Chat Menu.
            if (IsAllowed(Permission.VCMenu))
            {
                VoiceChatSettingsMenu = new VoiceChat();
                Menu     menu   = VoiceChatSettingsMenu.GetMenu();
                MenuItem button = new MenuItem("語音聊天設置", "在此處更改語音聊天選項.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
            }

            {
                RecordingMenu = new Recording();
                Menu     menu   = RecordingMenu.GetMenu();
                MenuItem button = new MenuItem("錄影選項", "遊戲中的錄製選項.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
            }

            // Add misc settings menu.
            {
                MiscSettingsMenu = new MiscSettings();
                Menu     menu   = MiscSettingsMenu.GetMenu();
                MenuItem button = new MenuItem("其他設定", "可以在此處配置其他vMenu選項/設置。您也可以在此選單中保存設置.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
            }

            // Add About Menu.
            AboutMenu = new About();
            Menu     sub = AboutMenu.GetMenu();
            MenuItem btn = new MenuItem("關於vMenu", "介紹 vMenu.")
            {
                Label = "→→→"
            };

            AddMenu(Menu, sub, btn);

            // Refresh everything.
            MenuController.Menus.ForEach((m) => m.RefreshIndex());

            if (!GetSettingsBool(Setting.vmenu_use_permissions))
            {
                Notify.Alert("vMenu設置為忽略權限,將使用預設權限.");
            }

            if (PlayerSubmenu.Size > 0)
            {
                MenuController.BindMenuItem(Menu, PlayerSubmenu, playerSubmenuBtn);
            }
            else
            {
                Menu.RemoveMenuItem(playerSubmenuBtn);
            }

            if (VehicleSubmenu.Size > 0)
            {
                MenuController.BindMenuItem(Menu, VehicleSubmenu, vehicleSubmenuBtn);
            }
            else
            {
                Menu.RemoveMenuItem(vehicleSubmenuBtn);
            }

            if (WorldSubmenu.Size > 0)
            {
                MenuController.BindMenuItem(Menu, WorldSubmenu, worldSubmenuBtn);
            }
            else
            {
                Menu.RemoveMenuItem(worldSubmenuBtn);
            }

            if (MiscSettingsMenu != null)
            {
                MenuController.EnableMenuToggleKeyOnController = !MiscSettingsMenu.MiscDisableControllerSupport;
            }
        }
Esempio n. 15
0
        private void SetupControls()
        {
            UIPanel panel = AddUIComponent <UIPanel>();

            panel.gameObject.AddComponent <UICustomControl>();

            panel.backgroundSprite = "UnlockingPanel";
            panel.width            = width - 10;
            panel.height           = height - 75;
            panel.relativePosition = new Vector3(5, 0);

            // Max Speed
            UILabel maxSpeedLabel = panel.AddUIComponent <UILabel>();

            maxSpeedLabel.text             = Translations.Translate("AVO_MOD_OP06");
            maxSpeedLabel.textScale        = 0.8f;
            maxSpeedLabel.relativePosition = new Vector3(15, 14);

            m_maxSpeed = UIUtils.CreateTextField(panel);
            m_maxSpeed.numericalOnly    = true;
            m_maxSpeed.width            = 75;
            m_maxSpeed.tooltip          = Translations.Translate("AVO_MOD_OP07");
            m_maxSpeed.relativePosition = new Vector3(15, 33);

            kmhLabel                  = panel.AddUIComponent <UILabel>();
            kmhLabel.text             = "km/h";
            kmhLabel.textScale        = 0.8f;
            kmhLabel.relativePosition = new Vector3(95, 38);

            // Acceleration
            UILabel accelerationLabel = panel.AddUIComponent <UILabel>();

            accelerationLabel.text             = Translations.Translate("AVO_MOD_OP08");
            accelerationLabel.textScale        = 0.8f;
            accelerationLabel.relativePosition = new Vector3(160, 13);

            m_acceleration = UIUtils.CreateTextField(panel);
            m_acceleration.numericalOnly    = true;
            m_acceleration.allowFloats      = true;
            m_acceleration.width            = 60;
            m_acceleration.tooltip          = Translations.Translate("AVO_MOD_OP09");
            m_acceleration.relativePosition = new Vector3(160, 33);

            // Braking
            m_braking = UIUtils.CreateTextField(panel);
            m_braking.numericalOnly    = true;
            m_braking.allowFloats      = true;
            m_braking.width            = 60;
            m_braking.tooltip          = Translations.Translate("AVO_MOD_OP10");
            m_braking.relativePosition = new Vector3(230, 33);

            // Turning
            m_turning = UIUtils.CreateTextField(panel);
            m_turning.numericalOnly    = true;
            m_turning.allowFloats      = true;
            m_turning.width            = 60;
            m_turning.tooltip          = Translations.Translate("AVO_MOD_OP11");
            m_turning.relativePosition = new Vector3(300, 33);

            // Springs
            UILabel springsLabel = panel.AddUIComponent <UILabel>();

            springsLabel.text             = Translations.Translate("AVO_MOD_OP12");
            springsLabel.textScale        = 0.8f;
            springsLabel.relativePosition = new Vector3(15, 66);

            m_springs = UIUtils.CreateTextField(panel);
            m_springs.numericalOnly    = true;
            m_springs.allowFloats      = true;
            m_springs.width            = 60;
            m_springs.tooltip          = Translations.Translate("AVO_MOD_OP13");
            m_springs.relativePosition = new Vector3(15, 85);

            // Dampers
            m_dampers = UIUtils.CreateTextField(panel);
            m_dampers.numericalOnly    = true;
            m_dampers.allowFloats      = true;
            m_dampers.width            = 60;
            m_dampers.tooltip          = Translations.Translate("AVO_MOD_OP14");
            m_dampers.relativePosition = new Vector3(85, 85);

            // LeanMultiplier
            UILabel leanMultiplierLabel = panel.AddUIComponent <UILabel>();

            leanMultiplierLabel.text             = Translations.Translate("AVO_MOD_OP15");
            leanMultiplierLabel.textScale        = 0.8f;
            leanMultiplierLabel.relativePosition = new Vector3(160, 66);

            m_leanMultiplier = UIUtils.CreateTextField(panel);
            m_leanMultiplier.numericalOnly    = true;
            m_leanMultiplier.allowFloats      = true;
            m_leanMultiplier.width            = 60;
            m_leanMultiplier.tooltip          = Translations.Translate("AVO_MOD_OP16");
            m_leanMultiplier.relativePosition = new Vector3(160, 85);

            // NodMultiplier
            m_nodMultiplier = UIUtils.CreateTextField(panel);
            m_nodMultiplier.numericalOnly    = true;
            m_nodMultiplier.allowFloats      = true;
            m_nodMultiplier.width            = 60;
            m_nodMultiplier.tooltip          = Translations.Translate("AVO_MOD_OP17");
            m_nodMultiplier.relativePosition = new Vector3(230, 85);

            // Colors
            m_useColors                  = UIUtils.CreateCheckBox(panel);
            m_useColors.text             = Translations.Translate("AVO_MOD_OP18");
            m_useColors.isChecked        = true;
            m_useColors.width            = width - 40;
            m_useColors.tooltip          = Translations.Translate("AVO_MOD_OP19");
            m_useColors.relativePosition = new Vector3(15, 116);

            m_color0                      = UIUtils.CreateColorField(panel);
            m_color0.name                 = "AVO-color0";
            m_color0.popupTopmostRoot     = false;
            m_color0.relativePosition     = new Vector3(35, 135);
            m_color0_hex                  = UIUtils.CreateTextField(panel);
            m_color0_hex.maxLength        = 6;
            m_color0_hex.relativePosition = new Vector3(80, 137);

            m_color1                      = UIUtils.CreateColorField(panel);
            m_color1.name                 = "AVO-color1";
            m_color1.popupTopmostRoot     = false;
            m_color1.relativePosition     = new Vector3(35, 160);
            m_color1_hex                  = UIUtils.CreateTextField(panel);
            m_color1_hex.maxLength        = 6;
            m_color1_hex.relativePosition = new Vector3(80, 162);

            m_color2                      = UIUtils.CreateColorField(panel);
            m_color2.name                 = "AVO-color2";
            m_color2.popupTopmostRoot     = false;
            m_color2.relativePosition     = new Vector3(182, 135);
            m_color2_hex                  = UIUtils.CreateTextField(panel);
            m_color2_hex.maxLength        = 6;
            m_color2_hex.relativePosition = new Vector3(225, 137);

            m_color3                      = UIUtils.CreateColorField(panel);
            m_color3.name                 = "AVO-color3";
            m_color3.popupTopmostRoot     = false;
            m_color3.relativePosition     = new Vector3(182, 160);
            m_color3_hex                  = UIUtils.CreateTextField(panel);
            m_color3_hex.maxLength        = 6;
            m_color3_hex.relativePosition = new Vector3(225, 162);

            m_useColorsLabel = panel.AddUIComponent <UILabel>();
            m_useColorsLabel.Hide();
            m_useColorsLabel.textScale        = 0.8f;
            m_useColorsLabel.text             = Translations.Translate("AVO_MOD_OP20");
            m_useColorsLabel.relativePosition = new Vector3(15, 116);

            // Enable & BackEngine
            m_enabled                  = UIUtils.CreateCheckBox(panel);
            m_enabled.text             = Translations.Translate("AVO_MOD_OP21");
            m_enabled.isChecked        = true;
            m_enabled.width            = width - 40;
            m_enabled.tooltip          = Translations.Translate("AVO_MOD_OP22");
            m_enabled.relativePosition = new Vector3(15, 195);

            m_addBackEngine                  = UIUtils.CreateCheckBox(panel);
            m_addBackEngine.text             = Translations.Translate("AVO_MOD_OP23");
            m_addBackEngine.isChecked        = false;
            m_addBackEngine.width            = width - 40;
            m_addBackEngine.tooltip          = Translations.Translate("AVO_MOD_OP24");
            m_addBackEngine.relativePosition = new Vector3(15, 215);

            // LargeVehicle Setting for NoBigTruck Delivery Mod
            m_isLargeVehicle                  = UIUtils.CreateCheckBox(panel);
            m_isLargeVehicle.text             = Translations.Translate("AVO_MOD_OP25");
            m_isLargeVehicle.width            = width - 40;
            m_isLargeVehicle.tooltip          = Translations.Translate("AVO_MOD_OP26");
            m_isLargeVehicle.relativePosition = new Vector3(15, 215);

            // Capacity
            UIPanel capacityPanel = panel.AddUIComponent <UIPanel>();

            capacityPanel.size             = Vector2.zero;
            capacityPanel.relativePosition = new Vector3(15, 240);

            capacityLabel                  = capacityPanel.AddUIComponent <UILabel>();
            capacityLabel.text             = Translations.Translate("AVO_MOD_CAPA");
            capacityLabel.textScale        = 0.8f;
            capacityLabel.relativePosition = new Vector3(0, 2);

            m_capacity = UIUtils.CreateTextField(capacityPanel);
            m_capacity.numericalOnly    = true;
            m_capacity.maxLength        = 8;
            m_capacity.width            = 100;
            m_capacity.tooltip          = Translations.Translate("AVO_MOD_OP27");
            m_capacity.relativePosition = new Vector3(0, 21);

            m_planesize                  = capacityPanel.AddUIComponent <UILabel>();
            m_planesize.textScale        = 0.8f;
            m_planesize.relativePosition = new Vector3(170, 2);

            // Special Capacity
            specialcapacityLabel = capacityPanel.AddUIComponent <UILabel>();
            specialcapacityLabel.Hide();
            specialcapacityLabel.text             = Translations.Translate("AVO_MOD_OP28");
            specialcapacityLabel.textScale        = 0.8f;
            specialcapacityLabel.relativePosition = new Vector3(160, 2);

            m_specialcapacity = UIUtils.CreateTextField(capacityPanel);
            m_specialcapacity.Hide();
            m_specialcapacity.numericalOnly    = true;
            m_specialcapacity.maxLength        = 8;
            m_specialcapacity.width            = 100;
            m_specialcapacity.tooltip          = Translations.Translate("AVO_MOD_OP29");
            m_specialcapacity.relativePosition = new Vector3(160, 21);

            // Userguide Special Capacity Button
            m_userguidespecialcapacity = UIUtils.CreateButton(capacityPanel);
            m_userguidespecialcapacity.Hide();
            m_userguidespecialcapacity.normalBgSprite   = "EconomyMoreInfo";
            m_userguidespecialcapacity.hoveredBgSprite  = "EconomyMoreInfoHovered";
            m_userguidespecialcapacity.size             = new Vector2(14f, 14f);
            m_userguidespecialcapacity.tooltip          = Translations.Translate("AVO_MOD_OP30");
            m_userguidespecialcapacity.relativePosition = new Vector3(265, 24);

            // Transport Line Overview Button
            m_lineoverview = UIUtils.CreateButton(panel);
            m_lineoverview.Hide();
            m_lineoverview.textScale             = 0.8f;
            m_lineoverview.height                = 18;
            m_lineoverview.textVerticalAlignment = UIVerticalAlignment.Bottom;
            m_lineoverview.text             = Translations.Translate("AVO_MOD_OP31");
            m_lineoverview.width            = 335;
            m_lineoverview.tooltip          = Translations.Translate("AVO_MOD_OP32");
            m_lineoverview.relativePosition = new Vector3(15, 194);

            // Userguide Spawn Button
            m_userguidespawn = UIUtils.CreateButton(panel);
            m_userguidespawn.Hide();
            m_userguidespawn.normalBgSprite   = "EconomyMoreInfo";
            m_userguidespawn.hoveredBgSprite  = "EconomyMoreInfoHovered";
            m_userguidespawn.size             = new Vector2(14f, 14f);
            m_userguidespawn.tooltip          = Translations.Translate("AVO_MOD_OP33");
            m_userguidespawn.relativePosition = new Vector3(355, 195);

            // Buslabel
            bustrailerLabel                  = panel.AddUIComponent <UILabel>();
            bustrailerLabel.textScale        = 0.8f;
            bustrailerLabel.text             = Translations.Translate("AVO_MOD_OP34");
            bustrailerLabel.relativePosition = new Vector3(15, 194);

            // Restore default
            m_restore                  = UIUtils.CreateButton(panel);
            m_restore.text             = Translations.Translate("AVO_MOD_OP35");
            m_restore.width            = 120;
            m_restore.tooltip          = Translations.Translate("AVO_MOD_OP36");
            m_restore.relativePosition = new Vector3(250, height - 45);

            // Remove Vehicles
            m_removeLabel                  = this.AddUIComponent <UILabel>();
            m_removeLabel.text             = Translations.Translate("AVO_MOD_OP37");
            m_removeLabel.textScale        = 0.8f;
            m_removeLabel.relativePosition = new Vector3(10, height - 65);

            m_clearVehicles                  = UIUtils.CreateButton(this);
            m_clearVehicles.text             = Translations.Translate("AVO_MOD_OP38");
            m_clearVehicles.width            = 120;
            m_clearVehicles.tooltip          = Translations.Translate("AVO_MOD_OP39");
            m_clearVehicles.relativePosition = new Vector3(5, height - 45);

            m_clearParked                  = UIUtils.CreateButton(this);
            m_clearParked.text             = Translations.Translate("AVO_MOD_OP40");
            m_clearParked.width            = 120;
            m_clearParked.tooltip          = Translations.Translate("AVO_MOD_OP41");
            m_clearParked.relativePosition = new Vector3(130, height - 45);

            panel.BringToFront();

            // Event handlers
            m_maxSpeed.eventTextSubmitted       += OnMaxSpeedSubmitted;
            m_acceleration.eventTextSubmitted   += OnAccelerationSubmitted;
            m_braking.eventTextSubmitted        += OnBrakingSubmitted;
            m_turning.eventTextSubmitted        += OnTurningSubmitted;
            m_springs.eventTextSubmitted        += OnSpringsSubmitted;
            m_dampers.eventTextSubmitted        += OnDampersSubmitted;
            m_leanMultiplier.eventTextSubmitted += OnleanMultiplierSubmitted;
            m_nodMultiplier.eventTextSubmitted  += OnnodMultiplierSubmitted;

            m_useColors.eventCheckChanged += OnCheckChanged;

            MouseEventHandler mousehandler = (c, p) => { if (m_initialized)
                                                         {
                                                             (parent as UIMainPanel).ChangePreviewColor((c as UIColorField).selectedColor);
                                                         }
            };

            m_color0.eventMouseEnter += mousehandler;
            m_color1.eventMouseEnter += mousehandler;
            m_color2.eventMouseEnter += mousehandler;
            m_color3.eventMouseEnter += mousehandler;

            m_color0_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color0.selectedColor);
                                                        }
            };
            m_color1_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color1.selectedColor);
                                                        }
            };
            m_color2_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color2.selectedColor);
                                                        }
            };
            m_color3_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color3.selectedColor);
                                                        }
            };

            m_color0.eventSelectedColorChanged += OnColorChanged;
            m_color1.eventSelectedColorChanged += OnColorChanged;
            m_color2.eventSelectedColorChanged += OnColorChanged;
            m_color3.eventSelectedColorChanged += OnColorChanged;

            m_color0_hex.eventTextSubmitted += OnColorHexSubmitted;
            m_color1_hex.eventTextSubmitted += OnColorHexSubmitted;
            m_color2_hex.eventTextSubmitted += OnColorHexSubmitted;
            m_color3_hex.eventTextSubmitted += OnColorHexSubmitted;

            m_enabled.eventCheckChanged        += OnCheckChanged;
            m_addBackEngine.eventCheckChanged  += OnCheckChanged;
            m_isLargeVehicle.eventCheckChanged += OnCheckChanged;

            m_capacity.eventTextSubmitted        += OnCapacitySubmitted;
            m_specialcapacity.eventTextSubmitted += OnSpecialCapacitySubmitted;

            m_restore.eventClick += (c, p) =>
            {
                m_initialized = false;
                bool isEnabled = m_options.enabled;
                DefaultOptions.Restore(m_options.prefab);
                VehicleOptions.UpdateTransfertVehicles();

                VehicleOptions.prefabUpdateEngine = m_options.prefab;
                VehicleOptions.prefabUpdateUnits  = m_options.prefab;
                SimulationManager.instance.AddAction(VehicleOptions.UpdateBackEngines);
                SimulationManager.instance.AddAction(VehicleOptions.UpdateCapacityUnits);

                Show(m_options);

                if (m_options.enabled != isEnabled)
                {
                    eventEnableCheckChanged(this, m_options.enabled);
                }
            };

            m_clearVehicles.eventClick            += OnClearVehicleClicked;
            m_clearParked.eventClick              += OnClearVehicleClicked;
            m_lineoverview.eventClick             += OnlineoverviewClicked;
            m_userguidespawn.eventClick           += OnUserGuideSpawnClicked;
            m_userguidespecialcapacity.eventClick += OnUserGuideSpecialCapacityClicked;
        }
Esempio n. 16
0
        /// <summary>
        /// Creates all the submenus depending on the permissions of the user.
        /// </summary>
        private void CreateSubmenus()
        {
            // Add the online players menu.
            if (Cf.IsAllowed(Permission.OPMenu))
            {
                OnlinePlayersMenu = new OnlinePlayers();
                UIMenu     menu   = OnlinePlayersMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Online Players", "All currently connected players.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        OnlinePlayersMenu.UpdatePlayerlist();
                        menu.RefreshIndex();
                        menu.UpdateScaleform();
                    }
                };
            }
            if (Cf.IsAllowed(Permission.OPUnban))
            {
                //TriggerServerEvent("vMenu:RequestBanList", PlayerId());
                BannedPlayersMenu = new BannedPlayers();
                UIMenu     menu   = BannedPlayersMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Banned Players", "View and manage all banned players in this menu.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        TriggerServerEvent("vMenu:RequestBanList", PlayerId());
                        menu.RefreshIndex();
                        menu.UpdateScaleform();
                    }
                };
            }

            // Add the player options menu.
            if (Cf.IsAllowed(Permission.POMenu))
            {
                PlayerOptionsMenu = new PlayerOptions();
                UIMenu     menu   = PlayerOptionsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Player Options", "Common player options can be accessed here.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add the vehicle options Menu.
            if (Cf.IsAllowed(Permission.VOMenu))
            {
                VehicleOptionsMenu = new VehicleOptions();
                UIMenu     menu   = VehicleOptionsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Vehicle Options", "Here you can change common vehicle options, as well as tune & style your vehicle.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            var vl = new Vehicles().VehicleClasses;

            // Add the vehicle spawner menu.
            if (Cf.IsAllowed(Permission.VSMenu))
            {
                VehicleSpawnerMenu = new VehicleSpawner();
                UIMenu     menu   = VehicleSpawnerMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Vehicle Spawner", "Spawn a vehicle by name or choose one from a specific category.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add Saved Vehicles menu.
            if (Cf.IsAllowed(Permission.SVMenu))
            {
                SavedVehiclesMenu = new SavedVehicles();
                UIMenu     menu   = SavedVehiclesMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Saved Vehicles", "Save new vehicles, or spawn or delete already saved vehicles.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add the player appearance menu.
            if (Cf.IsAllowed(Permission.PAMenu))
            {
                PlayerAppearanceMenu = new PlayerAppearance();
                UIMenu     menu   = PlayerAppearanceMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Player Appearance", "Choose a ped model, customize it and save & load your customized characters.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add the time options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (Cf.IsAllowed(Permission.TOMenu) && GetSettingsBool(Setting.vmenu_enable_time_sync))
            {
                TimeOptionsMenu = new TimeOptions();
                UIMenu     menu   = TimeOptionsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Time Options", "Change the time, and edit other time related options.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add the weather options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (Cf.IsAllowed(Permission.WOMenu) && GetSettingsBool(Setting.vmenu_enable_weather_sync))
            {
                WeatherOptionsMenu = new WeatherOptions();
                UIMenu     menu   = WeatherOptionsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Weather Options", "Change all weather related options here.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add the weapons menu.
            if (Cf.IsAllowed(Permission.WPMenu))
            {
                WeaponOptionsMenu = new WeaponOptions();
                UIMenu     menu   = WeaponOptionsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Weapon Options", "Add/remove weapons, modify weapons and set ammo options.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add Voice Chat Menu.
            if (Cf.IsAllowed(Permission.VCMenu))
            {
                VoiceChatSettingsMenu = new VoiceChat();
                UIMenu     menu   = VoiceChatSettingsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Voice Chat Settings", "Change Voice Chat options here.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            {
                RecordingMenu = new Recording();
                UIMenu     menu   = RecordingMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Recording Options", "In-game recording options.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add misc settings menu.
            //if (Cf.IsAllowed(Permission.MSMenu))
            // removed the permissions check, because the misc menu should've never been restricted in the first place.
            // not sure why I even added this before... saving of preferences and similar functions should always be allowed.
            // no matter what.
            {
                MiscSettingsMenu = new MiscSettings();
                UIMenu     menu   = MiscSettingsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Misc Settings", "Miscellaneous vMenu options/settings can be configured here. You can also save your settings in this menu.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }



            // Add About Menu.
            AboutMenu = new About();
            UIMenu     sub = AboutMenu.GetMenu();
            UIMenuItem btn = new UIMenuItem("About vMenu", "Information about vMenu.");

            btn.SetRightLabel("→→→");
            AddMenu(sub, btn);

            // Refresh everything.
            Mp.RefreshIndex();
            Menu.UpdateScaleform();

            // Globally disable the native ui controls disabling.
            Mp.ControlDisablingEnabled = false;
            // Globally disable the "mouse edge" feature.
            Mp.MouseEdgeEnabled = false;

            if (!GetSettingsBool(Setting.vmenu_use_permissions))
            {
                Notify.Info("vMenu is set up to ignore permissions.");
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Creates all the submenus depending on the permissions of the user.
        /// </summary>
        private void CreateSubmenus()
        {
            // Add the online players menu.
            if (IsAllowed(Permission.OPMenu))
            {
                OnlinePlayersMenu = new OnlinePlayers();
                Menu     menu   = OnlinePlayersMenu.GetMenu();
                MenuItem button = new MenuItem("Online Players", "All currently connected players.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
                Menu.OnItemSelect += async(sender, item, index) =>
                {
                    if (item == button)
                    {
                        PlayersList.RequestPlayerList();

                        await OnlinePlayersMenu.UpdatePlayerlist();

                        menu.RefreshIndex();
                    }
                };
            }
            if (IsAllowed(Permission.OPUnban) || IsAllowed(Permission.OPViewBannedPlayers))
            {
                BannedPlayersMenu = new BannedPlayers();
                Menu     menu   = BannedPlayersMenu.GetMenu();
                MenuItem button = new MenuItem("Banned Players", "View and manage all banned players in this menu.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        TriggerServerEvent("vMenu:RequestBanList", Game.Player.Handle);
                        menu.RefreshIndex();
                    }
                };
            }

            MenuItem playerSubmenuBtn = new MenuItem("Player Related Options", "Open this submenu for player related subcategories.")
            {
                Label = "→→→"
            };

            Menu.AddMenuItem(playerSubmenuBtn);

            // Add the player options menu.
            if (IsAllowed(Permission.POMenu))
            {
                PlayerOptionsMenu = new PlayerOptions();
                Menu     menu   = PlayerOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Player Options", "Common player options can be accessed here.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);
            }

            MenuItem vehicleSubmenuBtn = new MenuItem("Vehicle Related Options", "Open this submenu for vehicle related subcategories.")
            {
                Label = "→→→"
            };

            Menu.AddMenuItem(vehicleSubmenuBtn);
            // Add the vehicle options Menu.
            if (IsAllowed(Permission.VOMenu))
            {
                VehicleOptionsMenu = new VehicleOptions();
                Menu     menu   = VehicleOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Vehicle Options", "Here you can change common vehicle options, as well as tune & style your vehicle.")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
            }

            // Add the vehicle spawner menu.
            if (IsAllowed(Permission.VSMenu))
            {
                VehicleSpawnerMenu = new VehicleSpawner();
                Menu     menu   = VehicleSpawnerMenu.GetMenu();
                MenuItem button = new MenuItem("Vehicle Spawner", "Spawn a vehicle by name or choose one from a specific category.")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
            }

            // Add Saved Vehicles menu.
            if (IsAllowed(Permission.SVMenu))
            {
                SavedVehiclesMenu = new SavedVehicles();
                Menu     menu   = SavedVehiclesMenu.GetMenu();
                MenuItem button = new MenuItem("Saved Vehicles", "Save new vehicles, or spawn or delete already saved vehicles.")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
                VehicleSubmenu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        SavedVehiclesMenu.UpdateMenuAvailableCategories();
                    }
                };
            }

            // Add the Personal Vehicle menu.
            if (IsAllowed(Permission.PVMenu))
            {
                PersonalVehicleMenu = new PersonalVehicle();
                Menu     menu   = PersonalVehicleMenu.GetMenu();
                MenuItem button = new MenuItem("Personal Vehicle", "Set a vehicle as your personal vehicle, and control some things about that vehicle when you're not inside.")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
            }

            // Add the player appearance menu.
            if (IsAllowed(Permission.PAMenu))
            {
                PlayerAppearanceMenu = new PlayerAppearance();
                Menu     menu   = PlayerAppearanceMenu.GetMenu();
                MenuItem button = new MenuItem("Player Appearance", "Choose a ped model, customize it and save & load your customized characters.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);

                MpPedCustomizationMenu = new MpPedCustomization();
                Menu     menu2   = MpPedCustomizationMenu.GetMenu();
                MenuItem button2 = new MenuItem("MP Ped Customization", "Create, edit, save and load multiplayer peds. ~r~Note, you can only save peds created in this submenu. vMenu can NOT detect peds created outside of this submenu. Simply due to GTA limitations.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu2, button2);
            }

            MenuItem worldSubmenuBtn = new MenuItem("World Related Options", "Open this submenu for world related subcategories.")
            {
                Label = "→→→"
            };

            Menu.AddMenuItem(worldSubmenuBtn);

            // Add the time options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (IsAllowed(Permission.TOMenu) && GetSettingsBool(Setting.vmenu_enable_time_sync))
            {
                TimeOptionsMenu = new TimeOptions();
                Menu     menu   = TimeOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Time Options", "Change the time, and edit other time related options.")
                {
                    Label = "→→→"
                };
                AddMenu(WorldSubmenu, menu, button);
            }

            // Add the weather options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (IsAllowed(Permission.WOMenu) && GetSettingsBool(Setting.vmenu_enable_weather_sync))
            {
                WeatherOptionsMenu = new WeatherOptions();
                Menu     menu   = WeatherOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Weather Options", "Change all weather related options here.")
                {
                    Label = "→→→"
                };
                AddMenu(WorldSubmenu, menu, button);
            }

            // Add the weapons menu.
            if (IsAllowed(Permission.WPMenu))
            {
                WeaponOptionsMenu = new WeaponOptions();
                Menu     menu   = WeaponOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Weapon Options", "Add/remove weapons, modify weapons and set ammo options.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);
            }

            // Add Weapon Loadouts menu.
            if (IsAllowed(Permission.WLMenu))
            {
                WeaponLoadoutsMenu = new WeaponLoadouts();
                Menu     menu   = WeaponLoadoutsMenu.GetMenu();
                MenuItem button = new MenuItem("Weapon Loadouts", "Mange, and spawn saved weapon loadouts.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);
            }

            if (IsAllowed(Permission.NoClip))
            {
                MenuItem toggleNoclip = new MenuItem("Toggle NoClip", "Toggle NoClip on or off.");
                PlayerSubmenu.AddMenuItem(toggleNoclip);
                PlayerSubmenu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == toggleNoclip)
                    {
                        NoClipEnabled = !NoClipEnabled;
                    }
                };
            }

            // Add Voice Chat Menu.
            if (IsAllowed(Permission.VCMenu))
            {
                VoiceChatSettingsMenu = new VoiceChat();
                Menu     menu   = VoiceChatSettingsMenu.GetMenu();
                MenuItem button = new MenuItem("Voice Chat Settings", "Change Voice Chat options here.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
            }

            {
                RecordingMenu = new Recording();
                Menu     menu   = RecordingMenu.GetMenu();
                MenuItem button = new MenuItem("Recording Options", "In-game recording options.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
            }

            // Add misc settings menu.
            {
                MiscSettingsMenu = new MiscSettings();
                Menu     menu   = MiscSettingsMenu.GetMenu();
                MenuItem button = new MenuItem("Misc Settings", "Miscellaneous vMenu options/settings can be configured here. You can also save your settings in this menu.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
            }

            // Add About Menu.
            AboutMenu = new About();
            Menu     sub = AboutMenu.GetMenu();
            MenuItem btn = new MenuItem("About vMenu", "Information about vMenu.")
            {
                Label = "→→→"
            };

            AddMenu(Menu, sub, btn);

            // Refresh everything.
            MenuController.Menus.ForEach((m) => m.RefreshIndex());

            if (!GetSettingsBool(Setting.vmenu_use_permissions))
            {
                Notify.Alert("vMenu is set up to ignore permissions, default permissions will be used.");
            }

            if (PlayerSubmenu.Size > 0)
            {
                MenuController.BindMenuItem(Menu, PlayerSubmenu, playerSubmenuBtn);
            }
            else
            {
                Menu.RemoveMenuItem(playerSubmenuBtn);
            }

            if (VehicleSubmenu.Size > 0)
            {
                MenuController.BindMenuItem(Menu, VehicleSubmenu, vehicleSubmenuBtn);
            }
            else
            {
                Menu.RemoveMenuItem(vehicleSubmenuBtn);
            }

            if (WorldSubmenu.Size > 0)
            {
                MenuController.BindMenuItem(Menu, WorldSubmenu, worldSubmenuBtn);
            }
            else
            {
                Menu.RemoveMenuItem(worldSubmenuBtn);
            }

            if (MiscSettingsMenu != null)
            {
                MenuController.EnableMenuToggleKeyOnController = !MiscSettingsMenu.MiscDisableControllerSupport;
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Creates all the submenus depending on the permissions of the user.
        /// </summary>
        private void CreateSubmenus()
        {
            // Add the online players menu.
            if (IsAllowed(Permission.OPMenu))
            {
                OnlinePlayersMenu = new OnlinePlayers();
                Menu     menu   = OnlinePlayersMenu.GetMenu();
                MenuItem button = new MenuItem("Joueurs en ligne", "")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        OnlinePlayersMenu.UpdatePlayerlist();
                        menu.RefreshIndex();
                    }
                };
            }
            if (IsAllowed(Permission.OPUnban) || IsAllowed(Permission.OPViewBannedPlayers))
            {
                BannedPlayersMenu = new BannedPlayers();
                Menu     menu   = BannedPlayersMenu.GetMenu();
                MenuItem button = new MenuItem("Joueurs bannis", "")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        TriggerServerEvent("vMenu:RequestBanList", Game.Player.Handle);
                        menu.RefreshIndex();
                    }
                };
            }

            MenuItem playerSubmenuBtn = new MenuItem("Options du joueur", "")
            {
                Label = "→→→"
            };

            Menu.AddMenuItem(playerSubmenuBtn);

            // Add the player options menu.
            if (IsAllowed(Permission.POMenu))
            {
                PlayerOptionsMenu = new PlayerOptions();
                Menu     menu   = PlayerOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Outils", "")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);
            }

            MenuItem vehicleSubmenuBtn = new MenuItem("Options du véhicule", "")
            {
                Label = "→→→"
            };

            Menu.AddMenuItem(vehicleSubmenuBtn);
            // Add the vehicle options Menu.
            if (IsAllowed(Permission.VOMenu))
            {
                VehicleOptionsMenu = new VehicleOptions();
                Menu     menu   = VehicleOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Outils", "")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
            }

            // Add the vehicle spawner menu.
            if (IsAllowed(Permission.VSMenu))
            {
                VehicleSpawnerMenu = new VehicleSpawner();
                Menu     menu   = VehicleSpawnerMenu.GetMenu();
                MenuItem button = new MenuItem("Spawner", "")
                {
                    Label = "→→→"
                };
                AddMenu(VehicleSubmenu, menu, button);
            }

            // Add Saved Vehicles menu.

            /*if (IsAllowed(Permission.SVMenu))
             * {
             *  SavedVehiclesMenu = new SavedVehicles();
             *  Menu menu = SavedVehiclesMenu.GetMenu();
             *  MenuItem button = new MenuItem("Saved Vehicles", "Save new vehicles, or spawn or delete already saved vehicles.")
             *  {
             *      Label = "→→→"
             *  };
             *  AddMenu(VehicleSubmenu, menu, button);
             *  VehicleSubmenu.OnItemSelect += (sender, item, index) =>
             *  {
             *      if (item == button)
             *      {
             *          SavedVehiclesMenu.UpdateMenuAvailableCategories();
             *      }
             *  };
             * }
             *
             * // Add the Personal Vehicle menu.
             * if (IsAllowed(Permission.PVMenu))
             * {
             *  PersonalVehicleMenu = new PersonalVehicle();
             *  Menu menu = PersonalVehicleMenu.GetMenu();
             *  MenuItem button = new MenuItem("Personal Vehicle", "Set a vehicle as your personal vehicle, and control some things about that vehicle when you're not inside.")
             *  {
             *      Label = "→→→"
             *  };
             *  AddMenu(VehicleSubmenu, menu, button);
             * } */

            // Add the player appearance menu.
            if (IsAllowed(Permission.PAMenu))
            {
                PlayerAppearanceMenu = new PlayerAppearance();
                Menu     menu   = PlayerAppearanceMenu.GetMenu();
                MenuItem button = new MenuItem("Player Appearance", "Choose a ped model, customize it and save & load your customized characters.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);

                MpPedCustomizationMenu = new MpPedCustomization();
                Menu     menu2   = MpPedCustomizationMenu.GetMenu();
                MenuItem button2 = new MenuItem("MP Ped Customization", "Create, edit, save and load multiplayer peds. ~r~Note, you can only save peds created in this submenu. vMenu can NOT detect peds created outside of this submenu. Simply due to GTA limitations.")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu2, button2);
            }

            MenuItem worldSubmenuBtn = new MenuItem("Options Météo-Heure", "")
            {
                Label = "→→→"
            };

            Menu.AddMenuItem(worldSubmenuBtn);

            // Add the time options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (IsAllowed(Permission.TOMenu) && GetSettingsBool(Setting.vmenu_enable_time_sync))
            {
                TimeOptionsMenu = new TimeOptions();
                Menu     menu   = TimeOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Heure du jeu", "")
                {
                    Label = "→→→"
                };
                AddMenu(WorldSubmenu, menu, button);
            }

            // Add the weather options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (IsAllowed(Permission.WOMenu) && GetSettingsBool(Setting.vmenu_enable_weather_sync))
            {
                WeatherOptionsMenu = new WeatherOptions();
                Menu     menu   = WeatherOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Météo", "")
                {
                    Label = "→→→"
                };
                AddMenu(WorldSubmenu, menu, button);
            }

            // Add the weapons menu.
            if (IsAllowed(Permission.WPMenu))
            {
                WeaponOptionsMenu = new WeaponOptions();
                Menu     menu   = WeaponOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Options des Armes", "")
                {
                    Label = "→→→"
                };
                AddMenu(PlayerSubmenu, menu, button);
            }

            // Add Weapon Loadouts menu.

            /* if (IsAllowed(Permission.WLMenu))
             * {
             *   WeaponLoadoutsMenu = new WeaponLoadouts();
             *   Menu menu = WeaponLoadoutsMenu.GetMenu();
             *   MenuItem button = new MenuItem("Weapon Loadouts", "Mange, and spawn saved weapon loadouts.")
             *   {
             *       Label = "→→→"
             *   };
             *   AddMenu(PlayerSubmenu, menu, button);
             * }*/

            if (IsAllowed(Permission.NoClip))
            {
                MenuItem toggleNoclip = new MenuItem("Toggle NoClip", "Toggle NoClip on or off.");
                PlayerSubmenu.AddMenuItem(toggleNoclip);
                PlayerSubmenu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == toggleNoclip)
                    {
                        NoClipEnabled = !NoClipEnabled;
                    }
                };
            }

            {
                RecordingMenu = new Recording();
                Menu     menu   = RecordingMenu.GetMenu();
                MenuItem button = new MenuItem("Recording Options", "In-game recording options.")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
            }

            // Add misc settings menu.
            {
                MiscSettingsMenu = new MiscSettings();
                Menu     menu   = MiscSettingsMenu.GetMenu();
                MenuItem button = new MenuItem("Divers", "")
                {
                    Label = "→→→"
                };
                AddMenu(Menu, menu, button);
            }

            // Add About Menu.

            /*
             * AboutMenu = new About();
             * Menu sub = AboutMenu.GetMenu();
             * MenuItem btn = new MenuItem("About vMenu", "Information about vMenu.")
             * {
             *  Label = "→→→"
             * };
             * AddMenu(Menu, sub, btn);
             */

            // Refresh everything.
            MenuController.Menus.ForEach((m) => m.RefreshIndex());

            if (!GetSettingsBool(Setting.vmenu_use_permissions))
            {
                Notify.Alert("vMenu is set up to ignore permissions, default permissions will be used.");
            }

            if (PlayerSubmenu.Size > 0)
            {
                MenuController.BindMenuItem(Menu, PlayerSubmenu, playerSubmenuBtn);
            }
            else
            {
                Menu.RemoveMenuItem(playerSubmenuBtn);
            }

            if (VehicleSubmenu.Size > 0)
            {
                MenuController.BindMenuItem(Menu, VehicleSubmenu, vehicleSubmenuBtn);
            }
            else
            {
                Menu.RemoveMenuItem(vehicleSubmenuBtn);
            }

            if (WorldSubmenu.Size > 0)
            {
                MenuController.BindMenuItem(Menu, WorldSubmenu, worldSubmenuBtn);
            }
            else
            {
                Menu.RemoveMenuItem(worldSubmenuBtn);
            }

            if (MiscSettingsMenu != null)
            {
                MenuController.EnableMenuToggleKeyOnController = !MiscSettingsMenu.MiscDisableControllerSupport;
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Creates all the submenus depending on the permissions of the user.
        /// </summary>
        private void CreateSubmenus()
        {
            // Add the online players menu.
            if (Cf.IsAllowed(Permission.OPMenu))
            {
                OnlinePlayersMenu = new OnlinePlayers();
                UIMenu     menu   = OnlinePlayersMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Online Players", "All currently connected players.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        OnlinePlayersMenu.UpdatePlayerlist();
                        menu.RefreshIndex();
                        menu.UpdateScaleform();
                    }
                };
            }

            // Add the player options menu.
            if (Cf.IsAllowed(Permission.POMenu))
            {
                PlayerOptionsMenu = new PlayerOptions();
                UIMenu     menu   = PlayerOptionsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Player Options", "Common player options can be accessed here.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add the vehicle options Menu.
            if (Cf.IsAllowed(Permission.VOMenu))
            {
                VehicleOptionsMenu = new VehicleOptions();
                UIMenu     menu   = VehicleOptionsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Vehicle Options", "Here you can change common vehicle options, as well as tune & style your vehicle.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            var vl = new Vehicles().VehicleClasses;

            // Add the vehicle spawner menu.
            if (Cf.IsAllowed(Permission.VSMenu))
            {
                VehicleSpawnerMenu = new VehicleSpawner();
                UIMenu     menu   = VehicleSpawnerMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Vehicle Spawner", "Spawn a vehicle by name or choose one from a specific category.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add Saved Vehicles menu.
            if (Cf.IsAllowed(Permission.SVMenu))
            {
                SavedVehiclesMenu = new SavedVehicles();
                UIMenu     menu   = SavedVehiclesMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Saved Vehicles", "Save new vehicles, or spawn or delete already saved vehicles.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add the player appearance menu.
            if (Cf.IsAllowed(Permission.PAMenu))
            {
                PlayerAppearanceMenu = new PlayerAppearance();
                UIMenu     menu   = PlayerAppearanceMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Player Appearance", "Choose a ped model, customize it and save & load your customized characters.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add the time options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (Cf.IsAllowed(Permission.TOMenu) && MenuOptions["disableSync"] != "true")
            {
                TimeOptionsMenu = new TimeOptions();
                UIMenu     menu   = TimeOptionsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Time Options", "Change the time, and edit other time related options.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add the weather options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (Cf.IsAllowed(Permission.WOMenu) && MenuOptions["disableSync"] != "true")
            {
                WeatherOptionsMenu = new WeatherOptions();
                UIMenu     menu   = WeatherOptionsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Weather Options", "Change all weather related options here.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add the weapons menu.
            if (Cf.IsAllowed(Permission.WPMenu))
            {
                WeaponOptionsMenu = new WeaponOptions();
                UIMenu     menu   = WeaponOptionsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Weapon Options", "Add/remove weapons, modify weapons and set ammo options.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add misc settings menu.
            if (Cf.IsAllowed(Permission.MSMenu))
            {
                MiscSettingsMenu = new MiscSettings();
                UIMenu     menu   = MiscSettingsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Misc Settings", "Change general settings.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add Voice Chat Menu.
            if (Cf.IsAllowed(Permission.VCMenu))
            {
                VoiceChatSettingsMenu = new VoiceChat();
                UIMenu     menu   = VoiceChatSettingsMenu.GetMenu();
                UIMenuItem button = new UIMenuItem("Voice Chat Settings", "Change Voice Chat options here.");
                button.SetRightLabel("→→→");
                AddMenu(menu, button);
            }

            // Add About Menu.
            AboutMenu = new About();
            UIMenu     sub = AboutMenu.GetMenu();
            UIMenuItem btn = new UIMenuItem("About vMenu", "Information about this menu and it's creators.");

            btn.SetRightLabel("→→→");
            AddMenu(sub, btn);

            // Refresh everything.
            Mp.RefreshIndex();
            Menu.UpdateScaleform();

            // Globally disable the native ui controls disabling.
            Mp.ControlDisablingEnabled = false;
            // Globally disable the "mouse edge" feature.
            Mp.MouseEdgeEnabled = false;
        }
        private void SetupControls()
        {
            UIPanel panel = AddUIComponent <UIPanel>();

            panel.gameObject.AddComponent <UICustomControl>();

            panel.backgroundSprite = "UnlockingPanel";
            panel.width            = width - 10;
            panel.height           = height - 75;
            panel.relativePosition = new Vector3(5, 0);

            // Max Speed
            UILabel maxSpeedLabel = panel.AddUIComponent <UILabel>();

            maxSpeedLabel.text             = "Maximum speed:";
            maxSpeedLabel.textScale        = 0.8f;
            maxSpeedLabel.relativePosition = new Vector3(15, 15);

            m_maxSpeed = UIUtils.CreateTextField(panel);
            m_maxSpeed.numericalOnly    = true;
            m_maxSpeed.width            = 75;
            m_maxSpeed.tooltip          = "Change the maximum speed of the vehicle\nPlease note that vehicles do not go beyond speed limits";
            m_maxSpeed.relativePosition = new Vector3(15, 35);

            UILabel kmh = panel.AddUIComponent <UILabel>();

            kmh.text             = "km/h";
            kmh.textScale        = 0.8f;
            kmh.relativePosition = new Vector3(95, 40);

            // Acceleration
            UILabel accelerationLabel = panel.AddUIComponent <UILabel>();

            accelerationLabel.text             = "Acceleration/Brake:";
            accelerationLabel.textScale        = 0.8f;
            accelerationLabel.relativePosition = new Vector3(160, 15);

            m_acceleration = UIUtils.CreateTextField(panel);
            m_acceleration.numericalOnly    = true;
            m_acceleration.allowFloats      = true;
            m_acceleration.width            = 60;
            m_acceleration.tooltip          = "Change the vehicle acceleration factor";
            m_acceleration.relativePosition = new Vector3(160, 35);

            // Braking
            m_braking = UIUtils.CreateTextField(panel);
            m_braking.numericalOnly    = true;
            m_braking.allowFloats      = true;
            m_braking.width            = 60;
            m_braking.tooltip          = "Change the vehicle braking factor";
            m_braking.relativePosition = new Vector3(230, 35);

            // Colors
            m_useColors                  = UIUtils.CreateCheckBox(panel);
            m_useColors.text             = "Color variations:";
            m_useColors.isChecked        = true;
            m_useColors.width            = width - 40;
            m_useColors.tooltip          = "Enable color variations\nA random color is chosen between the four following colors";
            m_useColors.relativePosition = new Vector3(15, 70);

            m_color0                      = UIUtils.CreateColorField(panel);
            m_color0.name                 = "AVO-color0";
            m_color0.popupTopmostRoot     = false;
            m_color0.relativePosition     = new Vector3(13, 95 - 2);
            m_color0_hex                  = UIUtils.CreateTextField(panel);
            m_color0_hex.maxLength        = 6;
            m_color0_hex.relativePosition = new Vector3(55, 95);

            m_color1                      = UIUtils.CreateColorField(panel);
            m_color1.name                 = "AVO-color1";
            m_color1.popupTopmostRoot     = false;
            m_color1.relativePosition     = new Vector3(13, 120 - 2);
            m_color1_hex                  = UIUtils.CreateTextField(panel);
            m_color1_hex.maxLength        = 6;
            m_color1_hex.relativePosition = new Vector3(55, 120);

            m_color2                      = UIUtils.CreateColorField(panel);
            m_color2.name                 = "AVO-color2";
            m_color2.popupTopmostRoot     = false;
            m_color2.relativePosition     = new Vector3(158, 95 - 2);
            m_color2_hex                  = UIUtils.CreateTextField(panel);
            m_color2_hex.maxLength        = 6;
            m_color2_hex.relativePosition = new Vector3(200, 95);

            m_color3                      = UIUtils.CreateColorField(panel);
            m_color3.name                 = "AVO-color3";
            m_color3.popupTopmostRoot     = false;
            m_color3.relativePosition     = new Vector3(158, 120 - 2);
            m_color3_hex                  = UIUtils.CreateTextField(panel);
            m_color3_hex.maxLength        = 6;
            m_color3_hex.relativePosition = new Vector3(200, 120);

            // Enable & BackEngine
            m_enabled                  = UIUtils.CreateCheckBox(panel);
            m_enabled.text             = "Allow this vehicle to spawn";
            m_enabled.isChecked        = true;
            m_enabled.width            = width - 40;
            m_enabled.tooltip          = "Make sure you have at least one vehicle allowed to spawn for that category";
            m_enabled.relativePosition = new Vector3(15, 155);;

            m_addBackEngine                  = UIUtils.CreateCheckBox(panel);
            m_addBackEngine.text             = "Replace last car with engine";
            m_addBackEngine.isChecked        = false;
            m_addBackEngine.width            = width - 40;
            m_addBackEngine.tooltip          = "Make the last car of this train be an engine";
            m_addBackEngine.relativePosition = new Vector3(15, 175);

            // Capacity
            UIPanel capacityPanel = panel.AddUIComponent <UIPanel>();

            capacityPanel.size             = Vector2.zero;
            capacityPanel.relativePosition = new Vector3(15, 200);

            UILabel capacityLabel = capacityPanel.AddUIComponent <UILabel>();

            capacityLabel.text             = "Capacity:";
            capacityLabel.textScale        = 0.8f;
            capacityLabel.relativePosition = Vector3.zero;

            m_capacity = UIUtils.CreateTextField(capacityPanel);
            m_capacity.numericalOnly    = true;
            m_capacity.width            = 110;
            m_capacity.tooltip          = "Change the capacity of the vehicle";
            m_capacity.relativePosition = new Vector3(0, 20);

            // Restore default
            m_restore                  = UIUtils.CreateButton(panel);
            m_restore.text             = "Restore default";
            m_restore.width            = 130;
            m_restore.tooltip          = "Restore all values to default";
            m_restore.relativePosition = new Vector3(160, 215);

            // Remove Vehicles
            m_removeLabel                  = this.AddUIComponent <UILabel>();
            m_removeLabel.text             = "Remove vehicles:";
            m_removeLabel.textScale        = 0.8f;
            m_removeLabel.relativePosition = new Vector3(10, height - 60);

            m_clearVehicles                  = UIUtils.CreateButton(this);
            m_clearVehicles.text             = "Driving";
            m_clearVehicles.width            = 90f;
            m_clearVehicles.tooltip          = "Remove all driving vehicles of that type\nHold the SHIFT key to remove all types";
            m_clearVehicles.relativePosition = new Vector3(10, height - 40);

            m_clearParked                  = UIUtils.CreateButton(this);
            m_clearParked.text             = "Parked";
            m_clearParked.width            = 90f;
            m_clearParked.tooltip          = "Remove all parked vehicles of that type\nHold the SHIFT key to remove all types";
            m_clearParked.relativePosition = new Vector3(105, height - 40);

            panel.BringToFront();

            // Event handlers
            m_maxSpeed.eventTextSubmitted     += OnMaxSpeedSubmitted;
            m_acceleration.eventTextSubmitted += OnAccelerationSubmitted;
            m_braking.eventTextSubmitted      += OnBrakingSubmitted;

            m_useColors.eventCheckChanged += OnCheckChanged;

            MouseEventHandler mousehandler = (c, p) => { if (m_initialized)
                                                         {
                                                             (parent as UIMainPanel).ChangePreviewColor((c as UIColorField).selectedColor);
                                                         }
            };

            m_color0.eventMouseEnter += mousehandler;
            m_color1.eventMouseEnter += mousehandler;
            m_color2.eventMouseEnter += mousehandler;
            m_color3.eventMouseEnter += mousehandler;

            m_color0_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color0.selectedColor);
                                                        }
            };
            m_color1_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color1.selectedColor);
                                                        }
            };
            m_color2_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color2.selectedColor);
                                                        }
            };
            m_color3_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color3.selectedColor);
                                                        }
            };

            m_color0.eventSelectedColorChanged += OnColorChanged;
            m_color1.eventSelectedColorChanged += OnColorChanged;
            m_color2.eventSelectedColorChanged += OnColorChanged;
            m_color3.eventSelectedColorChanged += OnColorChanged;

            m_color0_hex.eventTextSubmitted += OnColorHexSubmitted;
            m_color1_hex.eventTextSubmitted += OnColorHexSubmitted;
            m_color2_hex.eventTextSubmitted += OnColorHexSubmitted;
            m_color3_hex.eventTextSubmitted += OnColorHexSubmitted;

            m_enabled.eventCheckChanged       += OnCheckChanged;
            m_addBackEngine.eventCheckChanged += OnCheckChanged;

            m_capacity.eventTextSubmitted += OnCapacitySubmitted;

            m_restore.eventClick += (c, p) =>
            {
                m_initialized = false;
                bool isEnabled = m_options.enabled;
                DefaultOptions.Restore(m_options.prefab);
                VehicleOptions.UpdateTransfertVehicles();

                VehicleOptions.prefabUpdateEngine = m_options.prefab;
                VehicleOptions.prefabUpdateUnits  = m_options.prefab;
                new EnumerableActionThread(VehicleOptions.UpdateBackEngines);
                new EnumerableActionThread(VehicleOptions.UpdateCapacityUnits);

                Show(m_options);

                if (m_options.enabled != isEnabled)
                {
                    eventEnableCheckChanged(this, m_options.enabled);
                }
            };

            m_clearVehicles.eventClick += OnClearVehicleClicked;
            m_clearParked.eventClick   += OnClearVehicleClicked;
        }
Esempio n. 21
0
        /// <summary>
        /// Creates all the submenus depending on the permissions of the user.
        /// </summary>
        private void CreateSubmenus()
        {
            // Add the online players menu.
            if (IsAllowed(Permission.OPMenu))
            {
                OnlinePlayersMenu = new OnlinePlayers();
                Menu     menu   = OnlinePlayersMenu.GetMenu();
                MenuItem button = new MenuItem("Online Players", "All currently connected players.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        OnlinePlayersMenu.UpdatePlayerlist();
                        menu.RefreshIndex();
                        //menu.UpdateScaleform();
                    }
                };
            }
            if (IsAllowed(Permission.OPUnban) || IsAllowed(Permission.OPViewBannedPlayers))
            {
                BannedPlayersMenu = new BannedPlayers();
                Menu     menu   = BannedPlayersMenu.GetMenu();
                MenuItem button = new MenuItem("Banned Players", "View and manage all banned players in this menu.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        TriggerServerEvent("vMenu:RequestBanList", Game.Player.Handle);
                        menu.RefreshIndex();
                        //menu.UpdateScaleform();
                    }
                };
            }

            // Add the player options menu.
            if (IsAllowed(Permission.POMenu))
            {
                PlayerOptionsMenu = new PlayerOptions();
                Menu     menu   = PlayerOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Player Options", "Common player options can be accessed here.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add the vehicle options Menu.
            if (IsAllowed(Permission.VOMenu))
            {
                VehicleOptionsMenu = new VehicleOptions();
                Menu     menu   = VehicleOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Vehicle Options", "Here you can change common vehicle options, as well as tune & style your vehicle.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add the vehicle spawner menu.
            if (IsAllowed(Permission.VSMenu))
            {
                VehicleSpawnerMenu = new VehicleSpawner();
                Menu     menu   = VehicleSpawnerMenu.GetMenu();
                MenuItem button = new MenuItem("Vehicle Spawner", "Spawn a vehicle by name or choose one from a specific category.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add Saved Vehicles menu.
            if (IsAllowed(Permission.SVMenu))
            {
                SavedVehiclesMenu = new SavedVehicles();
                Menu     menu   = SavedVehiclesMenu.GetMenu();
                MenuItem button = new MenuItem("Saved Vehicles", "Save new vehicles, or spawn or delete already saved vehicles.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
                Menu.OnItemSelect += (sender, item, index) =>
                {
                    if (item == button)
                    {
                        SavedVehiclesMenu.UpdateMenuAvailableCategories();
                    }
                };
            }

            // Add the Personal Vehicle menu.
            if (IsAllowed(Permission.PVMenu))
            {
                PersonalVehicleMenu = new PersonalVehicle();
                Menu     menu   = PersonalVehicleMenu.GetMenu();
                MenuItem button = new MenuItem("Personal Vehicle", "Set a vehicle as your personal vehicle, and control some things about that vehicle when you're not inside.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add the player appearance menu.
            if (IsAllowed(Permission.PAMenu))
            {
                PlayerAppearanceMenu = new PlayerAppearance();
                Menu     menu   = PlayerAppearanceMenu.GetMenu();
                MenuItem button = new MenuItem("Player Appearance", "Choose a ped model, customize it and save & load your customized characters.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);

                MpPedCustomizationMenu = new MpPedCustomization();
                Menu     menu2   = MpPedCustomizationMenu.GetMenu();
                MenuItem button2 = new MenuItem("MP Ped Customization", "Create, edit, save and load multiplayer peds. ~r~Note, you can only save peds created in this submenu. vMenu can NOT detect peds created outside of this submenu. Simply due to GTA limitations.")
                {
                    Label = "→→→"
                };
                AddMenu(menu2, button2);
            }

            // Add the time options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (IsAllowed(Permission.TOMenu) && GetSettingsBool(Setting.vmenu_enable_time_sync))
            {
                TimeOptionsMenu = new TimeOptions();
                Menu     menu   = TimeOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Time Options", "Change the time, and edit other time related options.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add the weather options menu.
            // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever.
            if (IsAllowed(Permission.WOMenu) && GetSettingsBool(Setting.vmenu_enable_weather_sync))
            {
                WeatherOptionsMenu = new WeatherOptions();
                Menu     menu   = WeatherOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Weather Options", "Change all weather related options here.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add the weapons menu.
            if (IsAllowed(Permission.WPMenu))
            {
                WeaponOptionsMenu = new WeaponOptions();
                Menu     menu   = WeaponOptionsMenu.GetMenu();
                MenuItem button = new MenuItem("Weapon Options", "Add/remove weapons, modify weapons and set ammo options.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add Weapon Loadouts menu.
            if (IsAllowed(Permission.WLMenu))
            {
                WeaponLoadoutsMenu = new WeaponLoadouts();
                Menu     menu   = WeaponLoadoutsMenu.GetMenu();
                MenuItem button = new MenuItem("Weapon Loadouts", "Mange, and spawn saved weapon loadouts.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add Voice Chat Menu.
            if (IsAllowed(Permission.VCMenu))
            {
                VoiceChatSettingsMenu = new VoiceChat();
                Menu     menu   = VoiceChatSettingsMenu.GetMenu();
                MenuItem button = new MenuItem("Voice Chat Settings", "Change Voice Chat options here.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            {
                RecordingMenu = new Recording();
                Menu     menu   = RecordingMenu.GetMenu();
                MenuItem button = new MenuItem("Recording Options", "In-game recording options.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add misc settings menu.
            //if (CommonFunctions.IsAllowed(Permission.MSMenu))
            // removed the permissions check, because the misc menu should've never been restricted in the first place.
            // not sure why I even added this before... saving of preferences and similar functions should always be allowed.
            // no matter what.
            {
                MiscSettingsMenu = new MiscSettings();
                Menu     menu   = MiscSettingsMenu.GetMenu();
                MenuItem button = new MenuItem("Misc Settings", "Miscellaneous vMenu options/settings can be configured here. You can also save your settings in this menu.")
                {
                    Label = "→→→"
                };
                AddMenu(menu, button);
            }

            // Add About Menu.
            AboutMenu = new About();
            Menu     sub = AboutMenu.GetMenu();
            MenuItem btn = new MenuItem("About vMenu", "Information about vMenu.")
            {
                Label = "→→→"
            };

            AddMenu(sub, btn);

            // Refresh everything.
            MenuController.Menus.ForEach((m) => m.RefreshIndex());

            if (!GetSettingsBool(Setting.vmenu_use_permissions))
            {
                Notify.Alert("vMenu is set up to ignore permissions, default permissions will be used.");
            }
        }
        private void SetupControls()
        {
            UIPanel panel = AddUIComponent <UIPanel>();

            panel.gameObject.AddComponent <UICustomControl>();

            panel.backgroundSprite = "UnlockingPanel";
            panel.width            = width - 10;
            panel.height           = height - 75;
            panel.relativePosition = new Vector3(5, 0);

            // Max Speed
            UILabel maxSpeedLabel = panel.AddUIComponent <UILabel>();

            maxSpeedLabel.text             = "Maximum speed:";
            maxSpeedLabel.textScale        = 0.8f;
            maxSpeedLabel.relativePosition = new Vector3(15, 14);

            m_maxSpeed = UIUtils.CreateTextField(panel);
            m_maxSpeed.numericalOnly    = true;
            m_maxSpeed.width            = 75;
            m_maxSpeed.tooltip          = "Change the maximum speed of the vehicle\nPlease note that vehicles do not go beyond speed limits";
            m_maxSpeed.relativePosition = new Vector3(15, 33);

            kmhLabel                  = panel.AddUIComponent <UILabel>();
            kmhLabel.text             = "km/h";
            kmhLabel.textScale        = 0.8f;
            kmhLabel.relativePosition = new Vector3(95, 38);

            // Acceleration
            UILabel accelerationLabel = panel.AddUIComponent <UILabel>();

            accelerationLabel.text             = "Acceleration/Brake/Turning:";
            accelerationLabel.textScale        = 0.8f;
            accelerationLabel.relativePosition = new Vector3(160, 13);

            m_acceleration = UIUtils.CreateTextField(panel);
            m_acceleration.numericalOnly    = true;
            m_acceleration.allowFloats      = true;
            m_acceleration.width            = 60;
            m_acceleration.tooltip          = "Change the vehicle acceleration factor";
            m_acceleration.relativePosition = new Vector3(160, 33);

            // Braking
            m_braking = UIUtils.CreateTextField(panel);
            m_braking.numericalOnly    = true;
            m_braking.allowFloats      = true;
            m_braking.width            = 60;
            m_braking.tooltip          = "Change the vehicle braking factor";
            m_braking.relativePosition = new Vector3(230, 33);

            // Turning
            m_turning = UIUtils.CreateTextField(panel);
            m_turning.numericalOnly    = true;
            m_turning.allowFloats      = true;
            m_turning.width            = 60;
            m_turning.tooltip          = "Change the vehicle turning factor;\nDefines how well the car corners";
            m_turning.relativePosition = new Vector3(300, 33);

            // Springs
            UILabel springsLabel = panel.AddUIComponent <UILabel>();

            springsLabel.text             = "Springs/Dampers:";
            springsLabel.textScale        = 0.8f;
            springsLabel.relativePosition = new Vector3(15, 66);

            m_springs = UIUtils.CreateTextField(panel);
            m_springs.numericalOnly    = true;
            m_springs.allowFloats      = true;
            m_springs.width            = 60;
            m_springs.tooltip          = "Change the vehicle spring factor;\nDefines how much the suspension moves";
            m_springs.relativePosition = new Vector3(15, 85);

            // Dampers
            m_dampers = UIUtils.CreateTextField(panel);
            m_dampers.numericalOnly    = true;
            m_dampers.allowFloats      = true;
            m_dampers.width            = 60;
            m_dampers.tooltip          = "Change the vehicle damper factor;\nDefines how quickly the suspension returns to the default state";
            m_dampers.relativePosition = new Vector3(85, 85);

            // LeanMultiplier
            UILabel leanMultiplierLabel = panel.AddUIComponent <UILabel>();

            leanMultiplierLabel.text             = "Lean/Nod Multiplier:";
            leanMultiplierLabel.textScale        = 0.8f;
            leanMultiplierLabel.relativePosition = new Vector3(160, 66);

            m_leanMultiplier = UIUtils.CreateTextField(panel);
            m_leanMultiplier.numericalOnly    = true;
            m_leanMultiplier.allowFloats      = true;
            m_leanMultiplier.width            = 60;
            m_leanMultiplier.tooltip          = "Change the vehicle lean multiplication factor;\nDefines how much the vehicle leans to the sides when turning";
            m_leanMultiplier.relativePosition = new Vector3(160, 85);

            // NodMultiplier
            m_nodMultiplier = UIUtils.CreateTextField(panel);
            m_nodMultiplier.numericalOnly    = true;
            m_nodMultiplier.allowFloats      = true;
            m_nodMultiplier.width            = 60;
            m_nodMultiplier.tooltip          = "Change the vehicle nod multiplication factor;\nDefines how much the vehicle nods forward/backward when braking or accelerating";
            m_nodMultiplier.relativePosition = new Vector3(230, 85);

            // Colors
            m_useColors                  = UIUtils.CreateCheckBox(panel);
            m_useColors.text             = "Enable Color variations:";
            m_useColors.isChecked        = true;
            m_useColors.width            = width - 40;
            m_useColors.tooltip          = "Enable color variations\nA random color is chosen between the four following colors";
            m_useColors.relativePosition = new Vector3(15, 116);

            m_color0                      = UIUtils.CreateColorField(panel);
            m_color0.name                 = "AVO-color0";
            m_color0.popupTopmostRoot     = false;
            m_color0.relativePosition     = new Vector3(35, 135);
            m_color0_hex                  = UIUtils.CreateTextField(panel);
            m_color0_hex.maxLength        = 6;
            m_color0_hex.relativePosition = new Vector3(80, 137);

            m_color1                      = UIUtils.CreateColorField(panel);
            m_color1.name                 = "AVO-color1";
            m_color1.popupTopmostRoot     = false;
            m_color1.relativePosition     = new Vector3(35, 160);
            m_color1_hex                  = UIUtils.CreateTextField(panel);
            m_color1_hex.maxLength        = 6;
            m_color1_hex.relativePosition = new Vector3(80, 162);

            m_color2                      = UIUtils.CreateColorField(panel);
            m_color2.name                 = "AVO-color2";
            m_color2.popupTopmostRoot     = false;
            m_color2.relativePosition     = new Vector3(182, 135);
            m_color2_hex                  = UIUtils.CreateTextField(panel);
            m_color2_hex.maxLength        = 6;
            m_color2_hex.relativePosition = new Vector3(225, 137);

            m_color3                      = UIUtils.CreateColorField(panel);
            m_color3.name                 = "AVO-color3";
            m_color3.popupTopmostRoot     = false;
            m_color3.relativePosition     = new Vector3(182, 160);
            m_color3_hex                  = UIUtils.CreateTextField(panel);
            m_color3_hex.maxLength        = 6;
            m_color3_hex.relativePosition = new Vector3(225, 162);

            m_useColorsLabel = panel.AddUIComponent <UILabel>();
            m_useColorsLabel.Hide();
            m_useColorsLabel.textScale        = 0.8f;
            m_useColorsLabel.text             = "Colors are managed by Vehicle Color Expander";
            m_useColorsLabel.relativePosition = new Vector3(15, 116);

            // Enable & BackEngine
            m_enabled                  = UIUtils.CreateCheckBox(panel);
            m_enabled.text             = "Allow this vehicle to spawn";
            m_enabled.isChecked        = true;
            m_enabled.width            = width - 40;
            m_enabled.tooltip          = "Make sure you have at least one vehicle allowed to spawn for that category";
            m_enabled.relativePosition = new Vector3(15, 195);;

            m_addBackEngine                  = UIUtils.CreateCheckBox(panel);
            m_addBackEngine.text             = "Replace last car with engine";
            m_addBackEngine.isChecked        = false;
            m_addBackEngine.width            = width - 40;
            m_addBackEngine.tooltip          = "Make the last car of this train be an engine";
            m_addBackEngine.relativePosition = new Vector3(15, 215);

            // LargeVehicle Setting for NoBigTruck Delivery Mod
            m_isLargeVehicle                  = UIUtils.CreateCheckBox(panel);
            m_isLargeVehicle.text             = "Flag as Large Vehicle";
            m_isLargeVehicle.width            = width - 40;
            m_isLargeVehicle.tooltip          = "Prevent vehicles with trailer to deliver to small buildings\n\nNeeds No Big Trucks mod to work";
            m_isLargeVehicle.relativePosition = new Vector3(15, 215);

            // Capacity
            UIPanel capacityPanel = panel.AddUIComponent <UIPanel>();

            capacityPanel.size             = Vector2.zero;
            capacityPanel.relativePosition = new Vector3(15, 240);

            capacityLabel                  = capacityPanel.AddUIComponent <UILabel>();
            capacityLabel.text             = "Capacity: ";
            capacityLabel.textScale        = 0.8f;
            capacityLabel.relativePosition = new Vector3(0, 2);

            m_capacity = UIUtils.CreateTextField(capacityPanel);
            m_capacity.numericalOnly    = true;
            m_capacity.maxLength        = 8;
            m_capacity.width            = 100;
            m_capacity.tooltip          = "Change the capacity of the vehicle";
            m_capacity.relativePosition = new Vector3(0, 21);

            // Special Capacity
            specialcapacityLabel = capacityPanel.AddUIComponent <UILabel>();
            specialcapacityLabel.Hide();
            specialcapacityLabel.text             = "Special Capacity: ";
            specialcapacityLabel.textScale        = 0.8f;
            specialcapacityLabel.relativePosition = new Vector3(160, 2);

            m_specialcapacity = UIUtils.CreateTextField(capacityPanel);
            m_specialcapacity.Hide();
            m_specialcapacity.numericalOnly    = true;
            m_specialcapacity.maxLength        = 8;
            m_specialcapacity.width            = 100;
            m_specialcapacity.tooltip          = "Change special parameters of the vehicle";
            m_specialcapacity.relativePosition = new Vector3(160, 21);

            // Userguide Special Capacity Button
            m_userguidespecialcapacity = UIUtils.CreateButton(capacityPanel);
            m_userguidespecialcapacity.Hide();
            m_userguidespecialcapacity.normalBgSprite   = "EconomyMoreInfo";
            m_userguidespecialcapacity.hoveredBgSprite  = "EconomyMoreInfoHovered";
            m_userguidespecialcapacity.size             = new Vector2(14f, 14f);
            m_userguidespecialcapacity.tooltip          = "If you do not know, what this value is:\nDo not touch it!\n\nClick for User Guide: Special Capacity";
            m_userguidespecialcapacity.relativePosition = new Vector3(265, 24);

            // Transport Line Overview Button
            m_lineoverview = UIUtils.CreateButton(panel);
            m_lineoverview.Hide();
            m_lineoverview.textScale             = 0.8f;
            m_lineoverview.height                = 18;
            m_lineoverview.textVerticalAlignment = UIVerticalAlignment.Bottom;
            m_lineoverview.text             = "Manage Spawning in Transport Line Overview";
            m_lineoverview.width            = 335;
            m_lineoverview.tooltip          = "Open the Transport Line Overview and manage the vehicle spawning";
            m_lineoverview.relativePosition = new Vector3(15, 194);

            // Userguide Spawn Button
            m_userguidespawn = UIUtils.CreateButton(panel);
            m_userguidespawn.Hide();
            m_userguidespawn.normalBgSprite   = "EconomyMoreInfo";
            m_userguidespawn.hoveredBgSprite  = "EconomyMoreInfoHovered";
            m_userguidespawn.size             = new Vector2(14f, 14f);
            m_userguidespawn.tooltip          = "Click for User Guide: Spawn Control";
            m_userguidespawn.relativePosition = new Vector3(355, 195);

            // Buslabel
            bustrailerLabel           = panel.AddUIComponent <UILabel>();
            bustrailerLabel.textScale = 0.8f;
            bustrailerLabel.text      = "Bus trailers spawning is controlled by the main\n" +
                                        "Bus vehicle. Settings must be configured from\n" +
                                        "the Transport Line Overview panel.";
            bustrailerLabel.relativePosition = new Vector3(15, 194);

            // Restore default
            m_restore                  = UIUtils.CreateButton(panel);
            m_restore.text             = "Default Values";
            m_restore.width            = 120;
            m_restore.tooltip          = "Restore all values to default";
            m_restore.relativePosition = new Vector3(250, height - 45);

            // Remove Vehicles
            m_removeLabel                  = this.AddUIComponent <UILabel>();
            m_removeLabel.text             = "Global Actions for: ";
            m_removeLabel.textScale        = 0.8f;
            m_removeLabel.relativePosition = new Vector3(10, height - 65);

            m_clearVehicles                  = UIUtils.CreateButton(this);
            m_clearVehicles.text             = "Remove Driving";
            m_clearVehicles.width            = 120;
            m_clearVehicles.tooltip          = "Remove all driving vehicles of that type\nHold the SHIFT key to remove all types";
            m_clearVehicles.relativePosition = new Vector3(5, height - 45);

            m_clearParked                  = UIUtils.CreateButton(this);
            m_clearParked.text             = "Remove Parked";
            m_clearParked.width            = 120;
            m_clearParked.tooltip          = "Remove all parked vehicles of that type\nHold the SHIFT key to remove all types";
            m_clearParked.relativePosition = new Vector3(130, height - 45);

            panel.BringToFront();

            // Event handlers
            m_maxSpeed.eventTextSubmitted       += OnMaxSpeedSubmitted;
            m_acceleration.eventTextSubmitted   += OnAccelerationSubmitted;
            m_braking.eventTextSubmitted        += OnBrakingSubmitted;
            m_turning.eventTextSubmitted        += OnTurningSubmitted;
            m_springs.eventTextSubmitted        += OnSpringsSubmitted;
            m_dampers.eventTextSubmitted        += OnDampersSubmitted;
            m_leanMultiplier.eventTextSubmitted += OnleanMultiplierSubmitted;
            m_nodMultiplier.eventTextSubmitted  += OnnodMultiplierSubmitted;

            m_useColors.eventCheckChanged += OnCheckChanged;

            MouseEventHandler mousehandler = (c, p) => { if (m_initialized)
                                                         {
                                                             (parent as UIMainPanel).ChangePreviewColor((c as UIColorField).selectedColor);
                                                         }
            };

            m_color0.eventMouseEnter += mousehandler;
            m_color1.eventMouseEnter += mousehandler;
            m_color2.eventMouseEnter += mousehandler;
            m_color3.eventMouseEnter += mousehandler;

            m_color0_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color0.selectedColor);
                                                        }
            };
            m_color1_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color1.selectedColor);
                                                        }
            };
            m_color2_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color2.selectedColor);
                                                        }
            };
            m_color3_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color3.selectedColor);
                                                        }
            };

            m_color0.eventSelectedColorChanged += OnColorChanged;
            m_color1.eventSelectedColorChanged += OnColorChanged;
            m_color2.eventSelectedColorChanged += OnColorChanged;
            m_color3.eventSelectedColorChanged += OnColorChanged;

            m_color0_hex.eventTextSubmitted += OnColorHexSubmitted;
            m_color1_hex.eventTextSubmitted += OnColorHexSubmitted;
            m_color2_hex.eventTextSubmitted += OnColorHexSubmitted;
            m_color3_hex.eventTextSubmitted += OnColorHexSubmitted;

            m_enabled.eventCheckChanged        += OnCheckChanged;
            m_addBackEngine.eventCheckChanged  += OnCheckChanged;
            m_isLargeVehicle.eventCheckChanged += OnCheckChanged;

            m_capacity.eventTextSubmitted        += OnCapacitySubmitted;
            m_specialcapacity.eventTextSubmitted += OnSpecialCapacitySubmitted;

            m_restore.eventClick += (c, p) =>
            {
                m_initialized = false;
                bool isEnabled = m_options.enabled;
                DefaultOptions.Restore(m_options.prefab);
                VehicleOptions.UpdateTransfertVehicles();

                VehicleOptions.prefabUpdateEngine = m_options.prefab;
                VehicleOptions.prefabUpdateUnits  = m_options.prefab;
                new EnumerableActionThread(VehicleOptions.UpdateBackEngines);
                new EnumerableActionThread(VehicleOptions.UpdateCapacityUnits);

                Show(m_options);

                if (m_options.enabled != isEnabled)
                {
                    eventEnableCheckChanged(this, m_options.enabled);
                }
            };

            m_clearVehicles.eventClick            += OnClearVehicleClicked;
            m_clearParked.eventClick              += OnClearVehicleClicked;
            m_lineoverview.eventClick             += OnlineoverviewClicked;
            m_userguidespawn.eventClick           += OnUserGuideSpawnClicked;
            m_userguidespecialcapacity.eventClick += OnUserGuideSpecialCapacityClicked;
        }