コード例 #1
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;
        }
コード例 #2
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 (!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;
        }
コード例 #3
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                // Section for General Settings

                UIHelperBase Group_General = helper.AddGroup(Translations.Translate("AVO_OPT_GEN") + " - " + Name);

                // Checkbox for Autosave Config

                UICheckBox AutoSaveVehicleConfig_Box = (UICheckBox)Group_General.AddCheckbox(Translations.Translate("AVO_OPT_GEN_ASAVE"), AdvancedVehicleOptions.AutoSaveVehicleConfig, (b) =>
                {
                    AdvancedVehicleOptions.AutoSaveVehicleConfig = b;
                    ModSettings.Save();
                    AdvancedVehicleOptions.UpdateOptionPanelInfo();
                });

                AutoSaveVehicleConfig_Box.tooltip = Translations.Translate("AVO_OPT_GEN_ASAVE_TT");

                // Checkbox for validating services

                UICheckBox ValidateMissingServices_Box = (UICheckBox)Group_General.AddCheckbox(Translations.Translate("AVO_OPT_GEN_SERVICE"), AdvancedVehicleOptions.OnLoadValidateServices, (b) =>
                {
                    AdvancedVehicleOptions.OnLoadValidateServices = b;
                    ModSettings.Save();
                });

                ValidateMissingServices_Box.tooltip = Translations.Translate("AVO_OPT_GEN_SERVICE_TT");

                // Checkbox for Debug Setting

                UICheckBox DebugMsg_Box = (UICheckBox)Group_General.AddCheckbox(Translations.Translate("AVO_OPT_GEN_DEBUG"), Logging.detailLogging, (b) =>
                {
                    Logging.detailLogging = b;
                    ModSettings.Save();
                });

                DebugMsg_Box.tooltip = Translations.Translate("AVO_OPT_GEN_DEBUG_TT");

                Group_General.AddSpace(1);

                // Checkbox for GUI Button

                UICheckBox HideButton_Box = (UICheckBox)Group_General.AddCheckbox(Translations.Translate("AVO_OPT_GEN_GUI"), AdvancedVehicleOptions.HideGUIbutton, (b) =>
                {
                    AdvancedVehicleOptions.HideGUIbutton = b;
                    AdvancedVehicleOptions.UpdateGUI();
                    ModSettings.Save();
                });

                HideButton_Box.tooltip = Translations.Translate("AVO_OPT_GEN_GUI_TT");

                // Datafield for Hot Key

                HideButton_Box.parent.gameObject.AddComponent <OptionsKeymapping>();

                // Checkbox for Language Option

                UIDropDown Language_DropDown = (UIDropDown)Group_General.AddDropdown(Translations.Translate("TRN_CHOICE"), Translations.LanguageList, Translations.Index, (value) =>
                {
                    Translations.Index = value;
                    ModSettings.Save();
                });

                Language_DropDown.tooltip  = Translations.Translate("TRN_TOOLTIP");
                Language_DropDown.autoSize = false;
                Language_DropDown.width    = 270f;

                // Section for Game Balancing

                UIHelperBase Group_Balance = helper.AddGroup(Translations.Translate("AVO_OPT_BAL"));

                // Checkbox for SpeedUnitOption kmh vs mph

                UICheckBox SpeedUnitOptions_Box = (UICheckBox)Group_Balance.AddCheckbox(Translations.Translate("AVO_OPT_BAL_UNITS"), AdvancedVehicleOptions.SpeedUnitOption, (b) =>
                {
                    AdvancedVehicleOptions.SpeedUnitOption = b;
                    ModSettings.Save();
                    AdvancedVehicleOptions.UpdateOptionPanelInfo();
                });

                SpeedUnitOptions_Box.tooltip = Translations.Translate("AVO_OPT_BAL_UNITS_TT");

                // Checkbox for Game Balancing

                UICheckBox ExtendedValues_Box = (UICheckBox)Group_Balance.AddCheckbox(Translations.Translate("AVO_OPT_BAL_EXT"), AdvancedVehicleOptions.ShowMoreVehicleOptions, (b) =>
                {
                    AdvancedVehicleOptions.ShowMoreVehicleOptions = b;
                    ModSettings.Save();
                });

                ExtendedValues_Box.tooltip = Translations.Translate("AVO_OPT_BAL_EXT_TT");

                // Section for Compatibility

                UIHelperBase Group_Compatibility = helper.AddGroup(Translations.Translate("AVO_OPT_COMP"));

                // Checkbox for Overriding Incompability Warnings

                UICheckBox DisplayCompatibility_Box = (UICheckBox)Group_Compatibility.AddCheckbox(Translations.Translate("AVO_OPT_COMP_MODS"), AdvancedVehicleOptions.OverrideCompatibilityWarnings, (b) =>
                {
                    AdvancedVehicleOptions.OverrideCompatibilityWarnings = b;
                    ModSettings.Save();
                });

                DisplayCompatibility_Box.tooltip = Translations.Translate("AVO_OPT_COMP_MODS_TT");

                // Default = True, as AVO shall color shared mod setting values in red.

                // Checkbox for Vehicle Color Expander

                UICheckBox OverrideVCX_Box = (UICheckBox)Group_Compatibility.AddCheckbox(Translations.Translate("AVO_OPT_COMP_VCX"), AdvancedVehicleOptions.OverrideVCX, (b) =>
                {
                    AdvancedVehicleOptions.OverrideVCX = b;
                    ModSettings.Save();
                });

                OverrideVCX_Box.tooltip = Translations.Translate("AVO_OPT_COMP_VCX_TT");

                //Always True, if AVO shall not override Vehicle Color Expander / Asset Color Expander settings. As there is no Settings for Vehicle Color Expander / Asset Color Expander. AVO will show the option, but user cannot change anything as long readOnly is True.

                OverrideVCX_Box.readOnly        = true;
                OverrideVCX_Box.label.textColor = Color.gray;

                if (!VCXCompatibilityPatch.IsVCXActive() | !VCXCompatibilityPatch.IsACXActive())
                {
                    OverrideVCX_Box.enabled = false;    //Do not show the option Checkbox, if Vehicle Color Expander / Asset Color Expander is not active.
                }

                // Checkbox for No Big Trucks

                UICheckBox NoBigTrucks_Box = (UICheckBox)Group_Compatibility.AddCheckbox(Translations.Translate("AVO_OPT_COMP_NBT"), AdvancedVehicleOptions.ControlTruckDelivery, (b) =>
                {
                    AdvancedVehicleOptions.ControlTruckDelivery = b;
                    ModSettings.Save();
                });

                NoBigTrucks_Box.tooltip = Translations.Translate("AVO_OPT_COMP_NBT_TT");
                //True, if AVO shall be enabled to classify Generic Industry vehicles as Large Vehicles, so No Big Trucks can suppress the dispatch to small buildings.

                if (!NoBigTruckCompatibilityPatch.IsNBTActive() | !NoBigTruckCompatibilityPatch.IsNBTBetaActive())
                {
                    NoBigTrucks_Box.enabled = false;   //Do not show the option Checkbox, if No Big Trucks is not active.
                }

                // Add Trailer Compatibility Reference

                UITextField TrailerCompatibilityList_Textfield = (UITextField)Group_Compatibility.AddTextfield(Translations.Translate("AVO_OPT_COMP_TRL"), TrailerRef.Revision, (value) =>
                {
                    Logging.KeyMessage("Using Trailer Configuration file: " + TrailerRef.Revision, value);
                });

                TrailerCompatibilityList_Textfield.tooltip  = Translations.Translate("AVO_OPT_COMP_TRL_TT");
                TrailerCompatibilityList_Textfield.readOnly = true;

                // Support Section with Wiki and Output-Log

                UIHelperBase Group_Support = helper.AddGroup(Translations.Translate("AVO_OPT_SUP"));

                UIButton Wikipedia_Button = (UIButton)Group_Support.AddButton(Translations.Translate("AVO_OPT_SUP_WIKI"), () =>
                {
                    SimulationManager.instance.SimulationPaused = true;
                    Application.OpenURL("https://github.com/CityGecko/CS-AdvancedVehicleOptions/wiki");
                });
                Wikipedia_Button.textScale = 0.8f;

                UIButton OutputLog_Button = (UIButton)Group_Support.AddButton(Translations.Translate("AVO_OPT_SUP_LOG"), () =>
                {
                    Utils.OpenInFileBrowser(Application.dataPath);
                });
                OutputLog_Button.textScale = 0.8f;

                UIButton AVOLog_Button = (UIButton)Group_Support.AddButton(Translations.Translate("AVO_OPT_SUP_SET"), () =>
                {
                    // Utils.OpenInFileBrowser(Application.streamingAssetsPath);
                    Utils.OpenInFileBrowser(DataLocation.localApplicationData);
                });
                AVOLog_Button.textScale = 0.8f;
                AVOLog_Button.tooltip   = (Translations.Translate("AVO_OPT_SUP_SET_TT"));
            }

            catch (Exception e)
            {
                Logging.Error("OnSettingsUI failed");
                Logging.LogException(e);
            }
        }
コード例 #4
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                UICheckBox  checkBox;
                UITextField TextField;
                UIButton    Button;

// Section for General Settings

                UIHelperBase group_general = helper.AddGroup("General Settings                                                   " + Name);

                checkBox = (UICheckBox)group_general.AddCheckbox("Disable debug messages logging", DebugUtils.hideDebugMessages.value, (b) =>
                {
                    DebugUtils.hideDebugMessages.value = b;
                });
                checkBox.tooltip = "If checked, debug messages will not be logged.";

                group_general.AddSpace(10);

                checkBox = (UICheckBox)group_general.AddCheckbox("Hide the user interface", AdvancedVehicleOptionsUID.hideGUI.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.hideGUI.value = b;
                    AdvancedVehicleOptionsUID.UpdateGUI();
                });
                checkBox.tooltip = "Hide the UI completely if you feel like you are done with it and want to save\n" +
                                   "the little bit of memory it takes. Everything else will still be functional.";

                checkBox = (UICheckBox)group_general.AddCheckbox("Disable warning for no available services at map loading", !AdvancedVehicleOptionsUID.onLoadCheck.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.onLoadCheck.value = !b;
                });
                checkBox.tooltip = "Disable the check for missing service vehicles assigned in any category when loading a map.";

// Section for Game Balancing

                UIHelperBase group_balance = helper.AddGroup("Gameplay & Balancing");

// Checkbox for SpeedUnitOption kmh vs mph

                checkBox = (UICheckBox)group_balance.AddCheckbox("Display Miles per Hour (mph) instead of Kilometer per Hour (km/h)", AdvancedVehicleOptionsUID.SpeedUnitOption.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.SpeedUnitOption.value = b;
                });
                checkBox.tooltip = "Changes display of unit of speed from mph to km/h.";

// Checkbox for Game Balancing

                checkBox = (UICheckBox)group_balance.AddCheckbox("Enable various values for non-cargo and non-passenger vehicles", AdvancedVehicleOptionsUID.GameBalanceOptions.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.GameBalanceOptions.value = b;
                });
                checkBox.tooltip = "Allows changes the Firefighting Rate and Capacity for Fire Safety, the Crime Rate Capacity\n" +
                                   "for Police Vehicles and the Maintenance and Pumping Rate for Maintenance Vehicles.\n\n" +
                                   "Can de-balance the intended gameplay. Some values are not documented.";

// Section for Compatibility

                UIHelperBase group_compatibility = helper.AddGroup("Compatibility");

// Checkbox for Overriding Incompability Warnings

                checkBox = (UICheckBox)group_compatibility.AddCheckbox("Display Compatibility Warnings for Mods", AdvancedVehicleOptionsUID.OverrideCompatibilityWarnings.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.OverrideCompatibilityWarnings.value = b;
                });

                checkBox.tooltip = "If enabled, settings which can be modified in Improved Public Transport\n" +
                                   "(by BloodyPenguin) and Transport Lines Manager (by Klyte) will be shown\n" +
                                   "with warning color. Values should be edited in these mods only.\n\n" +
                                   "If disabled, the coloring will not shown.";
                //True, if AVO shall shall color shared mod setting values in red.

// Checkbox for Vehicle Color Expander

                checkBox = (UICheckBox)group_compatibility.AddCheckbox("Vehicle Color Expander: Priority over AVO vehicle coloring", AdvancedVehicleOptionsUID.OverrideVCX.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.OverrideVCX.value = b;
                });

                checkBox.tooltip = "Permanent setting, if Vehicle Color Expander (by Klyte) is active.\n" +
                                   "The color management is controlled by Vehicle Color Expander.\n\n" +
                                   "Values will be configured in Vehicle Color Expander.";

                //True, if AVO shall not override Vehicle Color Expander settings. As there is not Settings for Vehicle Color Expander. AVO will show the option, but user cannot change anything as long readOnly is True.
                checkBox.readOnly        = true;
                checkBox.label.textColor = Color.gray;

                if (!VCXCompatibilityPatch.IsVCXActive())
                {
                    checkBox.enabled = false;                   //Do not show the option Checkbox, if Vehicle Color Expander is not active.
                }

// Checkbox for No Big Trucks

                checkBox = (UICheckBox)group_compatibility.AddCheckbox("No Big Trucks: Classify Generic Industry vehicles as Large Vehicle", AdvancedVehicleOptionsUID.ControlTruckDelivery.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.ControlTruckDelivery.value = b;
                });

                checkBox.tooltip = "If enabled, Delivery Trucks can be tagged as Large Vehicles.\n" +
                                   "Dispatch will be blocked by No Big Trucks (by MacSergey).\n\n" +
                                   "Warning: Experimental feature and may have impact on the simulation.";
                //True, if AVO shall be enabled to classify Generic Industry vehicles as Large Vehicles, so No Big Trucks can suppress the dispatch to small buildings.

                if (!NoBigTruckCompatibilityPatch.IsNBTActive())
                {
                    checkBox.enabled = false;   //Do not show the option Checkbox, if No Big Trucks is not active.
                }

// Add a Spacer
                group_compatibility.AddSpace(20);

// Add Trailer Compatibility Reference

                TextField         = (UITextField)group_compatibility.AddTextfield("Vehicle Trailer compatibility references last updated:", TrailerRef.Revision, (value) => Debug.Log(""), (value) => Debug.Log(""));
                TextField.tooltip = "This field shows the vehicle list revision date for the Bus, Trolley Bus, Fire and Police\n" +
                                    "trailers, which are in real life industry trailers, but have been re-categorized by AVO.";
                TextField.readOnly = true;

                // Support Section with Wiki and Output-Log

                UIHelperBase group_support = helper.AddGroup("Support");

                Button = (UIButton)group_support.AddButton("Open the Advanced Vehicle Options Wiki", () =>
                {
                    SimulationManager.instance.SimulationPaused = true;
                    Application.OpenURL("https://github.com/CityGecko/CS-AdvancedVehicleOptions/wiki");
                });
                Button.textScale = 0.8f;

                Button = (UIButton)group_support.AddButton("Open Cities:Skylines log folder (output_log.txt)", () =>
                {
                    Utils.OpenInFileBrowser(Application.dataPath);
                });
                Button.textScale = 0.8f;
            }

            catch (Exception e)
            {
                DebugUtils.Log("OnSettingsUI failed");
                DebugUtils.LogException(e);
            }
        }