Beispiel #1
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            UIHelper          hp    = (UIHelper)helper;
            UIScrollablePanel panel = (UIScrollablePanel)hp.self;

            panel.eventVisibilityChanged += eventVisibilityChanged;

            //string[] sOptions = new string[]{"8 - (JustTheTip)","16 - (Default)","24 - (Medium)","32 - (Large)","48 - (Very Large)","64 - (Massive)","96 - (Really WTF?)","128 - (FixYourMap!)","Custom - (SetInConfigFile)"};
            UIHelperBase group = helper.AddGroup("CSLShowMoreLimits");

            //group.AddDropdown("Number of Reserved Vehicles:", sOptions, GetOptionIndexFromValue(config.VehicleReserveAmount) , ReservedVehiclesChanged);
            group.AddCheckbox("Enable GUI (CTRL + L)", IsGuiEnabled, OnUseGuiToggle);
            group.AddCheckbox("Auto show on map load", config.AutoShowOnMapLoad, UpdateUseAutoShowOnMapLoad);
            group.AddCheckbox("Dump Stats to log on map exit", config.DumpStatsOnMapEnd, OnDumpStatsAtMapEnd);
            group.AddCheckbox("Enable Verbose Logging", DEBUG_LOG_ON, LoggingChecked);
            group.AddCheckbox("Use alternate keybinding", config.UseAlternateKeyBinding, OnUseAlternateKeyBinding);
            group.AddSpace(20);
            if (Application.platform == RuntimePlatform.WindowsPlayer)
            {
                group.AddButton("Open config file (Windows™ only)", OpenConfigFile);
            }
        }
Beispiel #2
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            _config = Configuration.Instance;
            _config.FlushStagedChanges(); //make sure no prior changes are still around

            // Section: Colors & Names

            var group = helper.AddGroup("Colors & Names");

            var colorStrategies  = Enum.GetNames(typeof(ColorStrategy));
            var namingStrategies = Enum.GetNames(typeof(NamingStrategy));

            group.AddDropdown("Color Strategy", colorStrategies, (int)_config.ColorStrategy,
                              _config.ColorStrategyChange);
            group.AddDropdown("Naming Strategy", namingStrategies, (int)_config.NamingStrategy,
                              _config.NamingStrategyChange);

            // Section: Advanced Settings

            helper.AddSpace(5);
            group = helper.AddGroup("Advanced Settings");

            Debug.Assert(_config.MaxDiffColorPickAttempt != null, "Config.MaxDiffColorPickAttempt != null");
            group.AddSlider("Max Different Color Picks", 1f, 20f, 1f, (float)_config.MaxDiffColorPickAttempt,
                            _config.MaxDiffColorPickChange);

            Debug.Assert(_config.MinColorDiffPercentage != null, "Config.MinColorDiffPercentage != null");
            group.AddSlider("MinColorDifference", 1f, 100f, 5f, (float)_config.MinColorDiffPercentage,
                            _config.MinColorDiffChange);

            group.AddCheckbox("Debug", _logger.Debug, _logger.SetDebug);

            // Bottom: Save

            helper.AddSpace(5);
            helper.AddButton("Save", _config.Save);
        }
Beispiel #3
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            UIHelperBase group = helper.AddGroup("General Options");

            PassElectricityCheckBox = group.AddCheckbox("Pass Electricity", ModSettings.PassElectricity, OnPassElectricityCheckBoxChanged) as UICheckBox;

            UIHelperBase OneSideGroup = helper.AddGroup("One Sided Parking Options");

            DistanceFromCurbSlider         = OneSideGroup.AddSlider("Distance From Curb", (float)ModSettings.minDistanceFromCurb, (float)ModSettings.maxDistanceFromCurb, ModSettings.stepDistanceFromCurb, (float)ModSettings.DistanceFromCurb, OnDistanceFromCurbSliderChanged) as UISlider;
            DistanceFromCurbSlider.tooltip = (((float)ModSettings.DistanceFromCurb - (float)ModSettings.minDistanceFromCurb) / ModSettings.rangeDistanceFromCurb).ToString() + " units";
            DistanceFromCurbSlider.width  += 100;

            DistanceBetweenParkingStallsSlider         = OneSideGroup.AddSlider("Distance Between Rows", (float)ModSettings.minDistanceBetweenParkingStalls, (float)ModSettings.maxDistanceBetweenParkingStalls, ModSettings.stepDistanceBetweenParkingStalls, (float)ModSettings.DistanceBetweenParkingStalls, OnDistanceBetweenParkingStallsSliderChanged) as UISlider;
            DistanceBetweenParkingStallsSlider.tooltip = (((float)ModSettings.DistanceBetweenParkingStalls - (float)ModSettings.minDistanceBetweenParkingStalls) / ModSettings.rangeDistanceBetweenParkingStalls).ToString() + " units";
            DistanceBetweenParkingStallsSlider.width  += 100;

            UIHelperBase resetGroup = helper.AddGroup("Reset");

            ResetButton = resetGroup.AddButton("Reset Settings", resetSettings) as UIButton;

            UIHelperBase SafelyRemoveAutoParkingLotsGroup = helper.AddGroup("Safely Remove Parking Lot Snapping");

            DeleteAssetsButton = SafelyRemoveAutoParkingLotsGroup.AddButton("Delete Parking Lot Snapping Assets", deleteAllAssets) as UIButton;
        }
Beispiel #4
0
        internal static void MakeSettings_Maintenance(ExtUITabstrip tabStrip)
        {
            UIHelper     panelHelper      = tabStrip.AddTabPage(Translation.Options.Get("Tab:Maintenance"));
            UIHelperBase maintenanceGroup = panelHelper.AddGroup(T("Tab:Maintenance"));

            _resetStuckEntitiesBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Reset stuck cims and vehicles"),
                onClickResetStuckEntities) as UIButton;

            _removeParkedVehiclesBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Remove parked vehicles"),
                OnClickRemoveParkedVehicles) as UIButton;

            _removeAllExistingTrafficLightsBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Remove all existing traffic lights"),
                OnClickRemoveAllExistingTrafficLights) as UIButton;
#if DEBUG
            _resetSpeedLimitsBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Reset custom speed limits"),
                OnClickResetSpeedLimits) as UIButton;
#endif
            _reloadGlobalConfBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Reload global configuration"),
                OnClickReloadGlobalConf) as UIButton;
            _resetGlobalConfBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Reset global configuration"),
                OnClickResetGlobalConf) as UIButton;

#if QUEUEDSTATS
            _showPathFindStatsToggle = maintenanceGroup.AddCheckbox(
                T("Maintenance.Checkbox:Show path-find stats"),
                Options.showPathFindStats,
                OnShowPathFindStatsChanged) as UICheckBox;
#endif

            var featureGroup =
                panelHelper.AddGroup(T("Maintenance.Group:Activated features")) as UIHelper;
            EnablePrioritySignsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Priority signs"),
                Options.prioritySignsEnabled,
                OnPrioritySignsEnabledChanged) as UICheckBox;
            EnableTimedLightsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Timed traffic lights"),
                Options.timedLightsEnabled,
                OnTimedLightsEnabledChanged) as UICheckBox;
            _enableCustomSpeedLimitsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Speed limits"),
                Options.customSpeedLimitsEnabled,
                OnCustomSpeedLimitsEnabledChanged) as UICheckBox;
            _enableVehicleRestrictionsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Vehicle restrictions"),
                Options.vehicleRestrictionsEnabled,
                OnVehicleRestrictionsEnabledChanged) as
                                               UICheckBox;
            _enableParkingRestrictionsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Parking restrictions"),
                Options.parkingRestrictionsEnabled,
                OnParkingRestrictionsEnabledChanged) as
                                               UICheckBox;
            _enableJunctionRestrictionsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Junction restrictions"),
                Options.junctionRestrictionsEnabled,
                OnJunctionRestrictionsEnabledChanged) as
                                                UICheckBox;
            _turnOnRedEnabledToggle = featureGroup.AddCheckbox(
                T("Maintenance.Checkbox:Turn on red"),
                Options.turnOnRedEnabled,
                OnTurnOnRedEnabledChanged) as UICheckBox;
            _enableLaneConnectorToggle = featureGroup.AddCheckbox(
                T("Maintenance.Checkbox:Lane connector"),
                Options.laneConnectorEnabled,
                OnLaneConnectorEnabledChanged) as UICheckBox;

            Options.Indent(_turnOnRedEnabledToggle);
        }
Beispiel #5
0
        /// <summary>
        /// Called when initializing mod settings UI.
        /// </summary>
        /// <param name="helper">The helper.</param>
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                this.InitializeHelper(helper);

                helper.AddCheckbox(
                    "Create HTML report automatically",
                    Global.Settings.CreateHtmlReportOnLevelLoaded,
                    value =>
                {
                    try
                    {
                        if (Global.Settings.CreateHtmlReportOnLevelLoaded != value)
                        {
                            Global.Settings.CreateHtmlReportOnLevelLoaded = value;
                            Global.Settings.Save();
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error(this, "OnSettingsUI", ex, "CreateHtmlReportOnLevelLoaded", value);
                    }
                });

                helper.AddCheckbox(
                    "Create text file report automatically",
                    Global.Settings.CreateDataReportOnLevelLoaded,
                    value =>
                {
                    try
                    {
                        if (Global.Settings.CreateDataReportOnLevelLoaded != value)
                        {
                            Global.Settings.CreateDataReportOnLevelLoaded = value;
                            Global.Settings.Save();
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error(this, "OnSettingsUI", ex, "CreateDataReportOnLevelLoaded", value);
                    }
                });

                this.HtmlReportButton = (UIComponent)helper.AddButton(
                    FileSystem.CanOpenFile ? "HTML report" : "Save HTML report",
                    () =>
                {
                    try
                    {
                        if (FileSystem.CanOpenFile)
                        {
                            AssetReporter.SaveReports(false, true, false);
                            AssetReporter.OpenHtmlReport();
                        }
                        else
                        {
                            AssetReporter.SaveReports(true, true, false);
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error(this, "OnSettingsUI", ex, "HtmlReportButton");
                    }
                });

                this.DataReportButton = (UIComponent)helper.AddButton(
                    FileSystem.CanOpenFile ? "Text report" : "Save text report",
                    () =>
                {
                    try
                    {
                        if (FileSystem.CanOpenFile)
                        {
                            AssetReporter.SaveReports(false, false, true);
                            AssetReporter.OpenDataReport();
                        }
                        else
                        {
                            AssetReporter.SaveReports(true, false, true);
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error(this, "OnSettingsUI", ex, "DataReportButton");
                    }
                });
            }
            catch (Exception ex)
            {
                Log.Error(this, "OnSettingsUI", ex);
            }
        }
Beispiel #6
0
 public void OnSettingsUI(UIHelperBase helper)
 {
     helper.AddButton("Update whole map", SurfaceManager.UpdateWholeMap);
 }
Beispiel #7
0
        public static void MakeSettings(UIHelperBase helper)
        {
            LoadSetting();
            UIHelper    actualHelper = helper as UIHelper;
            UIComponent container    = actualHelper.self as UIComponent;

            UITabstrip tabStrip = container.AddUIComponent <UITabstrip>();

            tabStrip.relativePosition = new Vector3(0, 0);
            tabStrip.size             = new Vector2(container.width - 20, 40);

            UITabContainer tabContainer = container.AddUIComponent <UITabContainer>();

            tabContainer.relativePosition = new Vector3(0, 40);
            tabContainer.size             = new Vector2(container.width - 20, container.height - tabStrip.height - 20);
            tabStrip.tabPages             = tabContainer;

            int tabIndex = 0;

            // Lane_ShortCut

            AddOptionTab(tabStrip, Localization.Get("BASIC_SETTING"));
            tabStrip.selectedIndex = tabIndex;

            UIPanel currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel;

            currentPanel.autoLayout              = true;
            currentPanel.autoLayoutDirection     = LayoutDirection.Vertical;
            currentPanel.autoLayoutPadding.top   = 5;
            currentPanel.autoLayoutPadding.left  = 10;
            currentPanel.autoLayoutPadding.right = 10;

            UIHelper panelHelper = new UIHelper(currentPanel);

            UIHelperBase group = panelHelper.AddGroup(Localization.Get("BASIC_SETTING"));

            group.AddCheckbox(Localization.Get("SHOW_LACK_OF_RESOURCE"), RealCity.debugMode, (index) => debugModeEnable(index));
            group.AddCheckbox(Localization.Get("REDUCE_CARGO_ENABLE"), RealCity.reduceVehicle, (index) => reduceVehicleEnable(index));
            group.AddCheckbox(Localization.Get("NO_PASSENGERCAR"), RealCity.noPassengerCar, (index) => noPassengerCarEnable(index));
            group.AddButton(Localization.Get("RESET_VALUE"), Loader.InitData);

            if (Loader.isTransportLinesManagerRunning)
            {
                UIHelperBase group1 = panelHelper.AddGroup(Localization.Get("TLMRUNNING"));
            }
            else
            {
                UIHelperBase group1 = panelHelper.AddGroup(Localization.Get("TLMNOTRUNNING"));
            }

            ++tabIndex;

            AddOptionTab(tabStrip, Localization.Get("SPTB"));
            tabStrip.selectedIndex = tabIndex;

            currentPanel                         = tabStrip.tabContainer.components[tabIndex] as UIPanel;
            currentPanel.autoLayout              = true;
            currentPanel.autoLayoutDirection     = LayoutDirection.Vertical;
            currentPanel.autoLayoutPadding.top   = 5;
            currentPanel.autoLayoutPadding.left  = 10;
            currentPanel.autoLayoutPadding.right = 10;

            panelHelper = new UIHelper(currentPanel);
            var generalGroup2 = panelHelper.AddGroup(Localization.Get("SMART_PUBLIC_TRANSPORT_BUDGET_WEEKDAY")) as UIHelper;

            morningBudgetWeekDaySlider = generalGroup2.AddSlider(Localization.Get("WEEKDAY_MORNING_BUDGET") + "(" + morningBudgetWeekDay.ToString() + "%)", 10, 300, 5, morningBudgetWeekDay, onMorningBudgetWeekDayChanged) as UISlider;
            morningBudgetWeekDaySlider.parent.Find <UILabel>("Label").width = 500f;
            eveningBudgetWeekDaySlider = generalGroup2.AddSlider(Localization.Get("WEEKDAY_EVENING_BUDGET") + "(" + eveningBudgetWeekDay.ToString() + "%)", 10, 300, 5, eveningBudgetWeekDay, onEveningBudgetWeekDayChanged) as UISlider;
            eveningBudgetWeekDaySlider.parent.Find <UILabel>("Label").width = 500f;
            deepNightBudgetWeekDaySlider = generalGroup2.AddSlider(Localization.Get("WEEKDAY_DEEPNIGHT_BUDGET") + "(" + deepNightBudgetWeekDay.ToString() + "%)", 10, 300, 5, deepNightBudgetWeekDay, onDeepNightBudgetWeekDayChanged) as UISlider;
            deepNightBudgetWeekDaySlider.parent.Find <UILabel>("Label").width = 500f;
            otherBudgetWeekDaySlider = generalGroup2.AddSlider(Localization.Get("WEEKDAY_OTHER_BUDGET") + "(" + otherBudgetWeekDay.ToString() + "%)", 10, 300, 5, otherBudgetWeekDay, onOtherBudgetWeekDayChanged) as UISlider;
            otherBudgetWeekDaySlider.parent.Find <UILabel>("Label").width = 500f;

            var generalGroup3 = panelHelper.AddGroup(Localization.Get("SMART_PUBLIC_TRANSPORT_BUDGET_WEEKEND")) as UIHelper;

            morningBudgetWeekEndSlider = generalGroup3.AddSlider(Localization.Get("WEEKEND_MORNING_BUDGET") + "(" + morningBudgetWeekEnd.ToString() + "%)", 10, 300, 5, morningBudgetWeekEnd, onMorningBudgetWeekEndChanged) as UISlider;
            morningBudgetWeekEndSlider.parent.Find <UILabel>("Label").width = 500f;
            eveningBudgetWeekEndSlider = generalGroup3.AddSlider(Localization.Get("WEEKEND_EVENING_BUDGET") + "(" + eveningBudgetWeekEnd.ToString() + "%)", 10, 300, 5, eveningBudgetWeekEnd, onEveningBudgetWeekEndChanged) as UISlider;
            eveningBudgetWeekEndSlider.parent.Find <UILabel>("Label").width = 500f;
            deepNightBudgetWeekEndSlider = generalGroup3.AddSlider(Localization.Get("WEEKEND_DEEPNIGHT_BUDGET") + "(" + deepNightBudgetWeekEnd.ToString() + "%)", 10, 300, 5, deepNightBudgetWeekEnd, onDeepNightBudgetWeekEndChanged) as UISlider;
            deepNightBudgetWeekEndSlider.parent.Find <UILabel>("Label").width = 500f;
            otherBudgetWeekEndSlider = generalGroup3.AddSlider(Localization.Get("WEEKEND_OTHER_BUDGET") + "(" + otherBudgetWeekEnd.ToString() + "%)", 10, 300, 5, otherBudgetWeekEnd, onOtherBudgetWeekEndChanged) as UISlider;
            otherBudgetWeekEndSlider.parent.Find <UILabel>("Label").width = 500f;

            ++tabIndex;

            AddOptionTab(tabStrip, Localization.Get("SPTB2"));
            tabStrip.selectedIndex = tabIndex;

            currentPanel                         = tabStrip.tabContainer.components[tabIndex] as UIPanel;
            currentPanel.autoLayout              = true;
            currentPanel.autoLayoutDirection     = LayoutDirection.Vertical;
            currentPanel.autoLayoutPadding.top   = 5;
            currentPanel.autoLayoutPadding.left  = 10;
            currentPanel.autoLayoutPadding.right = 10;

            panelHelper = new UIHelper(currentPanel);
            var generalGroup4 = panelHelper.AddGroup(Localization.Get("SMART_PUBLIC_TRANSPORT_BUDGET_MAX")) as UIHelper;

            morningBudgetMaxSlider = generalGroup4.AddSlider(Localization.Get("MAX_MORNING_BUDGET") + "(" + morningBudgetMax.ToString() + "%)", 10, 300, 5, morningBudgetMax, onMorningBudgetMaxChanged) as UISlider;
            morningBudgetMaxSlider.parent.Find <UILabel>("Label").width = 500f;
            eveningBudgetMaxSlider = generalGroup4.AddSlider(Localization.Get("MAX_EVENING_BUDGET") + "(" + eveningBudgetMax.ToString() + "%)", 10, 300, 5, eveningBudgetMax, onEveningBudgetMaxChanged) as UISlider;
            eveningBudgetMaxSlider.parent.Find <UILabel>("Label").width = 500f;
            deepNightBudgetMaxSlider = generalGroup4.AddSlider(Localization.Get("MAX_DEEPNIGHT_BUDGET") + "(" + deepNightBudgetMax.ToString() + "%)", 10, 300, 5, deepNightBudgetMax, onDeepNightBudgetMaxChanged) as UISlider;
            deepNightBudgetMaxSlider.parent.Find <UILabel>("Label").width = 500f;
            otherBudgetMaxSlider = generalGroup4.AddSlider(Localization.Get("MAX_OTHER_BUDGET") + "(" + otherBudgetMax.ToString() + "%)", 10, 300, 5, otherBudgetMax, onOtherBudgetMaxChanged) as UISlider;
            otherBudgetMaxSlider.parent.Find <UILabel>("Label").width = 500f;

            var generalGroup5 = panelHelper.AddGroup(Localization.Get("SMART_PUBLIC_TRANSPORT_BUDGET_MIN")) as UIHelper;

            morningBudgetMinSlider = generalGroup5.AddSlider(Localization.Get("MIN_MORNING_BUDGET") + "(" + morningBudgetMin.ToString() + "%)", 10, 300, 5, morningBudgetMin, onMorningBudgetMinChanged) as UISlider;
            morningBudgetMinSlider.parent.Find <UILabel>("Label").width = 500f;
            eveningBudgetMinSlider = generalGroup5.AddSlider(Localization.Get("MIN_EVENING_BUDGET") + "(" + eveningBudgetMin.ToString() + "%)", 10, 300, 5, eveningBudgetMin, onEveningBudgetMinChanged) as UISlider;
            eveningBudgetMinSlider.parent.Find <UILabel>("Label").width = 500f;
            deepNightBudgetMinSlider = generalGroup5.AddSlider(Localization.Get("MIN_DEEPNIGHT_BUDGET") + "(" + deepNightBudgetMin.ToString() + "%)", 10, 300, 5, deepNightBudgetMin, onDeepNightBudgetMinChanged) as UISlider;
            deepNightBudgetMinSlider.parent.Find <UILabel>("Label").width = 500f;
            otherBudgetMinSlider = generalGroup5.AddSlider(Localization.Get("MIN_OTHER_BUDGET") + "(" + otherBudgetMin.ToString() + "%)", 10, 300, 5, otherBudgetMin, onOtherBudgetMinChanged) as UISlider;
            otherBudgetMinSlider.parent.Find <UILabel>("Label").width = 500f;

            SaveSetting();
        }
Beispiel #8
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            helper.AddCheckbox("Use Grass Decorations", Settings.UseGrassDecorations, (b) =>
            {
                Settings.UseGrassDecorations = b;
                Settings.Save();
                if (Manager.InGame)
                {
                    Manager.Terrain.m_useGrassDecorations = b;
                }
            });
            helper.AddSpace(uiSpacing);

            helper.AddCheckbox("Use Fertile Decorations", Settings.UseFertileDecorations, (b) =>
            {
                Settings.UseFertileDecorations = b;
                Settings.Save();
                if (Manager.InGame)
                {
                    Manager.Terrain.m_useFertileDecorations = b;
                }
            });
            helper.AddSpace(uiSpacing);

            helper.AddCheckbox("Use Cliff Decorations", Settings.UseCliffDecorations, (b) =>
            {
                Settings.UseCliffDecorations = b;
                Settings.Save();
                if (Manager.InGame)
                {
                    Manager.Terrain.m_useCliffDecorations = b;
                }
            });
            helper.AddSpace(uiSpacing);
            resolutionDropdown = (UIDropDown)helper.AddDropdown("Resolution", resolutionList, SelectedResolutionIndex, (index) =>
            {
                DecorationResolution resolution;
                switch (index)
                {
                case 0:
                    resolution = DecorationResolution.Low;
                    break;

                case 1:
                    resolution = DecorationResolution.Medium;
                    break;

                case 2:
                    resolution = DecorationResolution.High;
                    break;

                default:
                    resolution = DecorationResolution.Ultra;
                    break;
                }

                Settings.SelectedResolution = resolution;
                Settings.Save();
                if (Manager.InGame)
                {
                    Manager.DecorationRenderer.SetResolution((int)resolution);
                }
            });
            helper.AddSpace(uiSpacing);

            densitySlider = (UISlider)helper.AddSlider($"Decorations Density: {Settings.Density}", 5f, 127f, 1f, Settings.Density, (f) =>
            {
                var density = Convert.ToInt32(f);
                densitySlider.parent.Find <UILabel>("Label").text = $"Decorations Density: {Convert.ToInt32(f).ToString()}";
                Settings.Density = density;
                Settings.Save();
                if (Manager.InGame)
                {
                    Manager.UpdateDensity(density);
                }
            });
            densitySlider.scrollWheelAmount = 1f;
            var sprite = densitySlider.thumbObject as UISprite;

            sprite.spriteName    = "InfoIconBaseHovered";
            sprite.size          = new Vector2(10f, 10f);
            densitySlider.height = 5f;
            helper.AddSpace(uiSpacing);

            cliffDropdown = (UIDropDown)helper.AddDropdown("Cliff", PackNames, SelectedCliffDropdownIndex, (index) =>
            {
                Settings.SelectedCliffPack = PackNames[index];
                Settings.Save();
                if (Manager.InGame)
                {
                    Manager.Load(DecorationType.Cliff);
                }
            });
            cliffDropdown.size = dropdownSize;
            helper.AddSpace(uiSpacing);

            fertileDropdown = (UIDropDown)helper.AddDropdown("Fertile", PackNames, SelectedFertileDropdownIndex, (index) =>
            {
                Settings.SelectedFertilePack = PackNames[index];
                Settings.Save();
                if (Manager.InGame)
                {
                    Manager.Load(DecorationType.Fertile);
                }
            });
            fertileDropdown.size = dropdownSize;
            helper.AddSpace(uiSpacing);

            grassDropdown = (UIDropDown)helper.AddDropdown("Grass", PackNames, SelectedGrassDropdownIndex, (index) =>
            {
                Settings.SelectedGrassPack = PackNames[index];
                Settings.Save();
                if (Manager.InGame)
                {
                    Manager.Load(DecorationType.Grass);
                }
            });
            grassDropdown.size = dropdownSize;
            helper.AddSpace(uiSpacing);

            helper.AddButton("Load All", () =>
            {
                Manager.Load(DecorationType.Cliff);
                Manager.Load(DecorationType.Grass);
                Manager.Load(DecorationType.Fertile);
            });
        }
Beispiel #9
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            UIHelperBase group = helper.AddGroup("DayNight Fog");

            group.AddCheckbox("Daynight Fog", FCSettings.daynightfog, sel =>
            {
                var dnfog = UnityEngine.Object.FindObjectOfType <DayNightFogEffect>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (dnfog != null)
                {
                    dnfog.enabled = sel;
                }

                // Update and save settings.
                FCSettings.daynightfog = sel;
                FCSettings.SaveSettings();
            });

            group.AddSlider("Color Decay(0.05 ~ 1)", 0.05f, 1, 0.01f, FCSettings.colordecay, sel =>
            {
                var coldecay = UnityEngine.Object.FindObjectOfType <FogProperties>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (coldecay != null)
                {
                    coldecay.m_ColorDecay = sel;
                }

                // Update and save settings.
                FCSettings.colordecay = sel;
                FCSettings.SaveSettings();
            });

            group.AddTextfield("Color Decay", FCSettings.colordecay.ToString(), sel =>
            {
                var coldecay = UnityEngine.Object.FindObjectOfType <FogProperties>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (coldecay != null)
                {
                    coldecay.m_ColorDecay = float.Parse(sel);
                }

                // Update and save settings.
                FCSettings.colordecay = float.Parse(sel);
                FCSettings.SaveSettings();
            });

            group.AddSlider("Fog Density", 0, 0.00223f, 0.0001f, FCSettings.fogdensity, sel =>
            {
                var coldecay = UnityEngine.Object.FindObjectOfType <FogProperties>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (coldecay != null)
                {
                    coldecay.m_FogDensity = sel;
                }

                // Update and save settings.
                FCSettings.fogdensity = sel;
                FCSettings.SaveSettings();
            });

            group.AddSlider("Noise Contribution", 0.1f, 1.4f, 0.01f, FCSettings.noisecontribution, sel =>
            {
                var nocontri = UnityEngine.Object.FindObjectOfType <FogProperties>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (nocontri != null)
                {
                    nocontri.m_NoiseContribution = sel;
                }

                // Update and save settings.
                FCSettings.noisecontribution = sel;
                FCSettings.SaveSettings();
            });

            group.AddTextfield("Fog Height", FCSettings.fogheight.ToString(), sel =>
            {
                var fogheight = UnityEngine.Object.FindObjectOfType <FogProperties>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (fogheight != null)
                {
                    fogheight.m_FogHeight = int.Parse(sel);
                }

                // Update and save settings.
                FCSettings.fogheight = int.Parse(sel);
                FCSettings.SaveSettings();
            });

            group.AddTextfield("Horizon Height", FCSettings.horizonheight.ToString(), sel =>
            {
                var horizonh = UnityEngine.Object.FindObjectOfType <FogProperties>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (horizonh != null)
                {
                    horizonh.m_HorizonHeight = int.Parse(sel);
                }

                // Update and save settings.
                FCSettings.horizonheight = int.Parse(sel);
                FCSettings.SaveSettings();
            });

            group.AddSlider("Fog Visibility", 0, 8000, 1, FCSettings.fogstart, sel =>
            {
                var fogstart = UnityEngine.Object.FindObjectOfType <FogProperties>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (fogstart != null)
                {
                    fogstart.m_FogStart = sel;
                }

                // Update and save settings.
                FCSettings.fogstart = (int)sel;
                FCSettings.SaveSettings();
            });

            group.AddSlider("Wind Speed", 0, 0.01f, 0.0001f, FCSettings.windspeed, sel =>
            {
                var windspeed = UnityEngine.Object.FindObjectOfType <FogProperties>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (windspeed != null)
                {
                    windspeed.m_WindSpeed = sel;
                }

                // Update and save settings.
                FCSettings.windspeed = (int)sel;
                FCSettings.SaveSettings();
            });

            group.AddCheckbox("Edge Fog", FCSettings.daynightedge, sel =>
            {
                var dnedge = UnityEngine.Object.FindObjectOfType <FogProperties>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (dnedge != null)
                {
                    dnedge.m_edgeFog = sel;
                }

                // Update and save settings.
                FCSettings.daynightedge = sel;
                FCSettings.SaveSettings();
            });

            UIHelperBase group2 = helper.AddGroup("Classic Fog");

            group2.AddCheckbox("Classic Fog (Enable Cubemap)", FCSettings.classicfog, sel =>
            {
                var cfog = UnityEngine.Object.FindObjectOfType <FogEffect>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (cfog != null)
                {
                    cfog.enabled = sel;
                }

                // Update and save settings.
                FCSettings.classicfog = sel;
                FCSettings.SaveSettings();
            });

            group2.AddCheckbox("Volume Fog", FCSettings.volumefog, sel =>
            {
                var vfog = UnityEngine.Object.FindObjectOfType <RenderProperties>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (vfog != null)
                {
                    vfog.m_useVolumeFog = sel;
                }

                // Update and save settings.
                FCSettings.volumefog = sel;
                FCSettings.SaveSettings();
            });


            group2.AddSlider("Inscattering Size", -10, -1, 0.1f, FCSettings.insEx, sel =>
            {
                var insex = UnityEngine.Object.FindObjectOfType <RenderProperties>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (insex != null)
                {
                    insex.m_inscatteringExponent = -(float)Math.Pow(sel, 5);
                }

                FCSettings.insEx = sel;
                FCSettings.SaveSettings();
            });

            group2.AddTextfield("Inscattering Intensity", FCSettings.insTs.ToString(), sel =>
            {
                var insts = UnityEngine.Object.FindObjectOfType <RenderProperties>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (insts != null)
                {
                    insts.m_inscatteringIntensity = float.Parse(sel);
                }

                // Update and save settings.
                FCSettings.insTs = float.Parse(sel);
                FCSettings.SaveSettings();
            });

            group2.AddDropdown("Inscattering Color", InscolLabels, FCSettings.inscatteringcolor, sel =>
            {
                FCSettings.inscatteringcolor = sel;
                FCSettings.SaveSettings();

                var inscol = UnityEngine.Object.FindObjectOfType <RenderProperties>();

                if (FCSettings.inscatteringcolor == 2)
                {
                    inscol.m_inscatteringColor = new Color(FCSettings.ins_r, FCSettings.ins_g, FCSettings.ins_b, 1f);
                }

                else if (FCSettings.inscatteringcolor == 0)
                {
                    inscol.m_inscatteringColor = new Color(0.5647059f, 0.9254902f, 1f, 1f);
                }
            });

            group2.AddSlider("R", 0, 1, 0.001f, FCSettings.ins_r, sel =>
            {
                var inscol = UnityEngine.Object.FindObjectOfType <RenderProperties>();

                if (FCSettings.inscatteringcolor == 2)
                {
                    inscol.m_inscatteringColor = new Color(FCSettings.ins_r, FCSettings.ins_g, FCSettings.ins_b, 1f);
                }

                FCSettings.ins_r = sel;
                FCSettings.SaveSettings();
            });

            group2.AddSlider("G", 0, 1, 0.001f, FCSettings.ins_g, sel =>
            {
                var inscol = UnityEngine.Object.FindObjectOfType <RenderProperties>();

                if (FCSettings.inscatteringcolor == 2)
                {
                    inscol.m_inscatteringColor = new Color(FCSettings.ins_r, FCSettings.ins_g, FCSettings.ins_b, 1f);
                }

                FCSettings.ins_g = sel;
                FCSettings.SaveSettings();
            });

            group2.AddSlider("B", 0, 1, 0.001f, FCSettings.ins_b, sel =>
            {
                var inscol = UnityEngine.Object.FindObjectOfType <RenderProperties>();

                if (FCSettings.inscatteringcolor == 2)
                {
                    inscol.m_inscatteringColor = new Color(FCSettings.ins_r, FCSettings.ins_g, FCSettings.ins_b, 1f);
                }

                FCSettings.ins_b = sel;
                FCSettings.SaveSettings();
            });


            group2.AddCheckbox("Custom Volume Fog Color", FCSettings.volcustom, sel =>
            {
                FCSettings.volcustom = sel;
                FCSettings.SaveSettings();

                var inscol = UnityEngine.Object.FindObjectOfType <RenderProperties>();

                if (FCSettings.volcustom == false)
                {
                    inscol.m_volumeFogColor = new Color(0.6509804f, 0.8862745f, 1f, 1f);
                }
                else
                {
                    inscol.m_volumeFogColor = new Color(FCSettings.vol_r, FCSettings.vol_g, FCSettings.vol_b, 1f);
                }
            });

            group2.AddSlider("R", 0, 1, 0.001f, FCSettings.vol_r, sel =>
            {
                var inscol = UnityEngine.Object.FindObjectOfType <RenderProperties>();

                if (FCSettings.volcustom)
                {
                    inscol.m_volumeFogColor = new Color(FCSettings.vol_r, FCSettings.vol_g, FCSettings.vol_b, 1f);
                }

                FCSettings.vol_r = sel;
                FCSettings.SaveSettings();
            });;

            group2.AddSlider("G", 0, 1, 0.001f, FCSettings.vol_g, sel =>
            {
                var inscol = UnityEngine.Object.FindObjectOfType <RenderProperties>();

                if (FCSettings.volcustom)
                {
                    inscol.m_volumeFogColor = new Color(FCSettings.vol_r, FCSettings.vol_g, FCSettings.vol_b, 1f);
                }

                FCSettings.vol_g = sel;
                FCSettings.SaveSettings();
            });

            group2.AddSlider("B", 0, 1, 0.001f, FCSettings.vol_b, sel =>
            {
                var inscol = UnityEngine.Object.FindObjectOfType <RenderProperties>();

                if (FCSettings.volcustom)
                {
                    inscol.m_volumeFogColor = new Color(FCSettings.vol_r, FCSettings.vol_g, FCSettings.vol_b, 1f);
                }

                FCSettings.vol_b = sel;
                FCSettings.SaveSettings();
            });

            group2.AddCheckbox("Edge Fog", FCSettings.classicedge, sel =>
            {
                var cedge = UnityEngine.Object.FindObjectOfType <FogEffect>();

                // Null check - for e.g. access from main menu options before game has loaded.
                if (cedge != null)
                {
                    cedge.m_edgeFog = sel;
                }

                // Update and save settings.
                FCSettings.classicedge = sel;
                FCSettings.SaveSettings();

                var vfstart = UnityEngine.Object.FindObjectOfType <RenderProperties>();

                if (FCSettings.classicedge)
                {
                    vfstart.m_volumeFogStart = 1711;
                }
                else
                {
                    vfstart.m_volumeFogStart = 0;
                }
            });

            UIHelperBase groupReset = helper.AddGroup("Reset");

            groupReset.AddButton("Reset to Default", () =>
            {
                FCSettings.colordecay        = 0.2f;
                FCSettings.fogdensity        = 0.00223f;
                FCSettings.noisecontribution = 1f;
                FCSettings.windspeed         = 0.001f;
                FCSettings.fogheight         = 1000;
                FCSettings.horizonheight     = 800;
                FCSettings.fogstart          = 194;

                FCSettings.classicfog   = false;
                FCSettings.daynightfog  = true;
                FCSettings.daynightedge = true;
                FCSettings.classicedge  = true;
                FCSettings.volumefog    = true;
                FCSettings.volcustom    = true;

                FCSettings.inscatteringcolor = 0;

                FCSettings.ins_r = 0.5647059f;
                FCSettings.ins_g = 0.9254902f;
                FCSettings.ins_b = 1f;

                FCSettings.insEx = -1.11457f;
                FCSettings.insTs = 1.72f;

                FCSettings.vol_r = 0.6509804f;
                FCSettings.vol_g = 0.8862745f;
                FCSettings.vol_b = 1f;

                FCSettings.SaveSettings();

                var fc                 = UnityEngine.Object.FindObjectOfType <FogProperties>();
                fc.m_ColorDecay        = FCSettings.colordecay;
                fc.m_FogDensity        = FCSettings.fogdensity;
                fc.m_NoiseContribution = FCSettings.noisecontribution;
                fc.m_edgeFog           = FCSettings.daynightedge;
                fc.m_FogHeight         = FCSettings.fogheight;
                fc.m_HorizonHeight     = FCSettings.horizonheight;
                fc.m_FogStart          = FCSettings.fogstart;
                fc.m_WindSpeed         = FCSettings.windspeed;

                var fc2       = UnityEngine.Object.FindObjectOfType <FogEffect>();
                fc2.enabled   = FCSettings.classicfog;
                fc2.m_edgeFog = FCSettings.classicedge;

                var fc3     = UnityEngine.Object.FindObjectOfType <DayNightFogEffect>();
                fc3.enabled = FCSettings.daynightfog;

                var fc4                     = UnityEngine.Object.FindObjectOfType <RenderProperties>();
                fc4.m_useVolumeFog          = FCSettings.volumefog;
                fc4.m_inscatteringExponent  = (float)-Math.Pow(FCSettings.insEx, 5);
                fc4.m_inscatteringIntensity = FCSettings.insTs;

                if (FCSettings.inscatteringcolor == 2)
                {
                    fc4.m_inscatteringColor = new Color(FCSettings.ins_r, FCSettings.ins_g, FCSettings.ins_b, 1f);
                }
                else if (FCSettings.inscatteringcolor == 0)
                {
                    fc4.m_inscatteringColor = new Color(0.5647059f, 0.9254902f, 1f, 1f);
                }

                if (FCSettings.volcustom == false)
                {
                    fc4.m_volumeFogColor = new Color(0.6509804f, 0.8862745f, 1f, 1f);
                }
                else
                {
                    fc4.m_volumeFogColor = new Color(FCSettings.vol_r, FCSettings.vol_g, FCSettings.vol_b, 1f);
                }

                if (FCSettings.classicedge)
                {
                    fc4.m_volumeFogStart = 1711;
                }
                else
                {
                    fc4.m_volumeFogStart = 0;
                }

                FCSettings.LoadSettings();
            });
        }
Beispiel #10
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                UIHelperBase group = helper.AddGroup(Name);
                UIPanel      panel = ((UIPanel)((UIHelper)group).self) as UIPanel;

                UICheckBox checkBox = (UICheckBox)group.AddCheckbox("Auto-close Toolbox menu", MoveItTool.autoCloseAlignTools.value, (b) =>
                {
                    MoveItTool.autoCloseAlignTools.value = b;
                    if (UIMoreTools.MoreToolsPanel != null)
                    {
                        UIMoreTools.CloseMenu();
                    }
                });
                checkBox.tooltip = "Check this to close the Toolbox menu after choosing a tool.";

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox("Prefer fast, low-detail moving (hold Shift to temporarily switch)", MoveItTool.fastMove.value, (b) =>
                {
                    MoveItTool.fastMove.value = b;
                });
                checkBox.tooltip = "Helps you position objects when your frame-rate is poor.";

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox("Hide selectors/overlays when in low-sensitivity mode", MoveItTool.hideSelectorsOnLowSensitivity.value, (b) =>
                {
                    MoveItTool.hideSelectorsOnLowSensitivity.value = b;
                });
                checkBox.tooltip = "When holding control, the selection overlays are hidden";

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox("Select pylons and pillars by holding Alt only", MoveItTool.altSelectNodeBuildings.value, (b) =>
                {
                    MoveItTool.altSelectNodeBuildings.value = b;
                });

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox("Use cardinal movements", MoveItTool.useCardinalMoves.value, (b) =>
                {
                    MoveItTool.useCardinalMoves.value = b;
                });
                checkBox.tooltip = "If checked, Up will move in the North direction, Down is South, Left is West, Right is East.";

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox("Right click cancels cloning", MoveItTool.rmbCancelsCloning.value, (b) =>
                {
                    MoveItTool.rmbCancelsCloning.value = b;
                });
                checkBox.tooltip = "If checked, Right click will cancel cloning instead of rotating 45°.";

                group.AddSpace(10);
                group = helper.AddGroup("General Shortcuts");
                panel = ((UIPanel)((UIHelper)group).self) as UIPanel;
                group.AddSpace(10);

                ((UIPanel)((UIHelper)group).self).gameObject.AddComponent <OptionsKeymappingMain>();

                group.AddSpace(10);
                group = helper.AddGroup("Toolbox Shortcuts");
                panel = ((UIPanel)((UIHelper)group).self) as UIPanel;
                group.AddSpace(10);

                ((UIPanel)((UIHelper)group).self).gameObject.AddComponent <OptionsKeymappingToolbox>();

                group.AddSpace(10);
                group = helper.AddGroup("Extra Options");
                panel = ((UIPanel)((UIHelper)group).self) as UIPanel;
                group.AddSpace(10);

                UIButton button = (UIButton)group.AddButton("Remove Ghost Nodes", MoveItTool.CleanGhostNodes);
                button.tooltip = "Use this button when in-game to remove ghost nodes (nodes with no segments attached). Note: this will clear Move It's undo history!";

                group.AddSpace(20);

                checkBox = (UICheckBox)group.AddCheckbox("Disable debug messages logging", DebugUtils.hideDebugMessages.value, (b) =>
                {
                    DebugUtils.hideDebugMessages.value = b;
                });
                checkBox.tooltip = "If checked, debug messages won't be logged.";

                checkBox = (UICheckBox)group.AddCheckbox("Show Move It debug panel\n", MoveItTool.showDebugPanel.value, (b) =>
                {
                    MoveItTool.showDebugPanel.value = b;
                    if (MoveItTool.m_debugPanel != null)
                    {
                        MoveItTool.m_debugPanel.Visible(b);
                    }
                });
                checkBox.name = "MoveIt_DebugPanel";

                UILabel debugLabel = panel.AddUIComponent <UILabel>();
                debugLabel.name = "debugLabel";
                debugLabel.text = "      Shows information about the last highlighted object. Slightly decreases\n" +
                                  "      performance, do not enable unless you have a specific reason.\n ";

                group.AddSpace(5);
                UILabel nsLabel = panel.AddUIComponent <UILabel>();
                nsLabel.name = "nsLabel";
                nsLabel.text = NS_Manager.getVersionText();

                UILabel ncLabel = panel.AddUIComponent <UILabel>();
                ncLabel.name = "ncLabel";
                ncLabel.text = NodeController_Manager.getVersionText();

                UILabel tmpeLabel = panel.AddUIComponent <UILabel>();
                tmpeLabel.name = "tmpeLabel";
                tmpeLabel.text = TMPE_Manager.getVersionText();

                group = helper.AddGroup("Procedural Objects");
                panel = ((UIPanel)((UIHelper)group).self) as UIPanel;

                UILabel poLabel = panel.AddUIComponent <UILabel>();
                poLabel.name = "poLabel";
                poLabel.text = PO_Manager.getVersionText();

                UILabel poWarning = panel.AddUIComponent <UILabel>();
                poWarning.name = "poWarning";
                poWarning.text = "      Please note: you can not undo Bulldozed PO. This means if you delete \n" +
                                 "      PO objects with Move It, they are immediately PERMANENTLY gone.\n ";

                checkBox = (UICheckBox)group.AddCheckbox("Hide the PO deletion warning", !MoveItTool.POShowDeleteWarning.value, (b) =>
                {
                    MoveItTool.POShowDeleteWarning.value = !b;
                });

                checkBox = (UICheckBox)group.AddCheckbox("Highlight unselected visible PO objects", MoveItTool.POHighlightUnselected.value, (b) =>
                {
                    MoveItTool.POHighlightUnselected.value = b;
                    if (MoveItTool.PO != null)
                    {
                        try
                        {
                            MoveItTool.PO.ToolEnabled();
                        }
                        catch (ArgumentException e)
                        {
                            Debug.Log($"PO Integration failed:\n{e}");
                        }
                    }
                });
                checkBox.tooltip = "Show a faded purple circle around PO objects that aren't selected.";

                group.AddSpace(15);

                panel.gameObject.AddComponent <OptionsKeymappingPO>();

                group.AddSpace(15);
            }
            catch (Exception e)
            {
                DebugUtils.Log("OnSettingsUI failed");
                DebugUtils.LogException(e);
            }
        }
Beispiel #11
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                LocaleManager.eventLocaleChanged -= MoveItLoader.LocaleChanged;
                MoveItLoader.LocaleChanged();
                LocaleManager.eventLocaleChanged += MoveItLoader.LocaleChanged;

                UIHelperBase group = helper.AddGroup(Name);
                UIPanel      panel = ((UIHelper)group).self as UIPanel;

                UICheckBox checkBox = (UICheckBox)group.AddCheckbox(Str.options_AutoCloseToolbox, MoveItTool.autoCloseAlignTools.value, (b) =>
                {
                    MoveItTool.autoCloseAlignTools.value = b;
                    if (UIMoreTools.MoreToolsPanel != null)
                    {
                        UIMoreTools.CloseMenu();
                    }
                });
                checkBox.tooltip = Str.options_AutoCloseToolbox_Tooltip;

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox(Str.options_PreferFastmove, MoveItTool.fastMove.value, (b) =>
                {
                    MoveItTool.fastMove.value = b;
                });
                checkBox.tooltip = Str.options_PreferFastmove_Tooltip;

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox(Str.options_UseCompass, MoveItTool.useCardinalMoves.value, (b) =>
                {
                    MoveItTool.useCardinalMoves.value = b;
                });
                checkBox.tooltip = Str.options_UseCompass_Tooltip;

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox(Str.options_RightClickCancel, MoveItTool.rmbCancelsCloning.value, (b) =>
                {
                    MoveItTool.rmbCancelsCloning.value = b;
                });
                checkBox.tooltip = Str.options_RightClickCancel_Tooltip;

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox(Str.options_AdvancedPillarControl, MoveItTool.advancedPillarControl.value, (b) =>
                {
                    MoveItTool.advancedPillarControl.value = b;
                });
                checkBox.tooltip = Str.options_AdvancedPillarControl_Tooltip;

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox(Str.options_AltForPillars, MoveItTool.altSelectNodeBuildings.value, (b) =>
                {
                    MoveItTool.altSelectNodeBuildings.value = b;
                });

                group.AddSpace(10);
                group = helper.AddGroup(Str.options_ShortcutsGeneral);
                panel = ((UIHelper)group).self as UIPanel;
                group.AddSpace(10);

                ((UIPanel)((UIHelper)group).self).gameObject.AddComponent <OptionsKeymappingMain>();

                group.AddSpace(10);
                group = helper.AddGroup(Str.options_ShortcutsToolbox);
                panel = ((UIHelper)group).self as UIPanel;
                group.AddSpace(10);

                ((UIPanel)((UIHelper)group).self).gameObject.AddComponent <OptionsKeymappingToolbox>();

                group.AddSpace(10);
                group = helper.AddGroup(Str.options_ExtraOptions);
                panel = ((UIHelper)group).self as UIPanel;
                group.AddSpace(10);

                UIButton button = (UIButton)group.AddButton(Str.options_RemoveGhostNodes, MoveItTool.CleanGhostNodes);
                button.tooltip = Str.options_RemoveGhostNodes_Tooltip;

                group.AddSpace(10);

                button = (UIButton)group.AddButton(Str.options_ResetButtonPosition, () =>
                {
                    UIMoveItButton.savedX.value = -1000;
                    UIMoveItButton.savedY.value = -1000;
                    MoveItTool.instance?.m_button?.ResetPosition();
                });

                group.AddSpace(20);

                checkBox = (UICheckBox)group.AddCheckbox(Str.options_DisableDebugLogging, DebugUtils.hideDebugMessages.value, (b) =>
                {
                    DebugUtils.hideDebugMessages.value = b;
                });
                checkBox.tooltip = Str.options_DisableDebugLogging_Tooltip;

                checkBox = (UICheckBox)group.AddCheckbox(Str.options_ShowDebugPanel, MoveItTool.showDebugPanel.value, (b) =>
                {
                    MoveItTool.showDebugPanel.value = b;
                    if (MoveItTool.m_debugPanel != null)
                    {
                        MoveItTool.m_debugPanel.Visible(b);
                    }
                });
                checkBox.name = "MoveIt_DebugPanel";

                group.AddSpace(5);
                UILabel nsLabel = panel.AddUIComponent <UILabel>();
                nsLabel.name = "nsLabel";
                nsLabel.text = NS_Manager.getVersionText();

                group = helper.AddGroup(Str.options_ProceduralObjects);
                panel = ((UIHelper)group).self as UIPanel;

                UILabel poLabel = panel.AddUIComponent <UILabel>();
                poLabel.name = "poLabel";
                poLabel.text = PO_Manager.getVersionText();

                // TODO add users of MoveITIntegration.dll here by name/description

                UILabel poWarning = panel.AddUIComponent <UILabel>();
                poWarning.name    = "poWarning";
                poWarning.padding = new RectOffset(25, 0, 0, 15);
                poWarning.text    = Str.options_PODeleteWarning;

                checkBox = (UICheckBox)group.AddCheckbox(Str.options_HidePODeletionWarning, !MoveItTool.POShowDeleteWarning.value, (b) =>
                {
                    MoveItTool.POShowDeleteWarning.value = !b;
                });

                group.AddSpace(15);

                panel.gameObject.AddComponent <OptionsKeymappingPO>();

                group.AddSpace(15);
            }
            catch (Exception e)
            {
                DebugUtils.Log("OnSettingsUI failed");
                DebugUtils.LogException(e);
            }
        }
Beispiel #12
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            LocaleManager.eventLocaleChanged -= LocaleChanged;
            LocaleChanged();
            LocaleManager.eventLocaleChanged += LocaleChanged;

            UIHelperBase group = helper.AddGroup(Name);

            //Assembly assembly = null;
            //foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
            //{
            //    if (a.FullName.Length >= 12 && a.FullName.Substring(0, 12) == "NetworkSkins")
            //    {
            //        assembly = a;
            //        break;
            //    }
            //}

            UICheckBox checkBox = (UICheckBox)group.AddCheckbox(Localize.options_SetFRTMode, PickerTool.doSetFRTMode.value, (b) =>
            {
                PickerTool.doSetFRTMode.value = b;
            });

            checkBox.tooltip = Localize.options_SetFRTMode_Tooltip;

            group.AddSpace(10);

            checkBox = (UICheckBox)group.AddCheckbox(Localize.options_OpenMenu, PickerTool.openMenu.value, (b) =>
            {
                PickerTool.openMenu.value = b;
            });
            checkBox.tooltip = Localize.options_OpenMenu_Tooltip;

            checkBox = (UICheckBox)group.AddCheckbox(Localize.options_OpenMenuNetworks, PickerTool.openMenuNetworks.value, (b) =>
            {
                PickerTool.openMenuNetworks.value = b;
            });

            group.AddSpace(10);

            group.AddSpace(10);

            ((UIPanel)((UIHelper)group).self).gameObject.AddComponent <OptionsKeymappingMain>();
            UIPanel panel = ((UIHelper)group).self as UIPanel;

            group.AddSpace(20);

            UIButton button = (UIButton)group.AddButton(Localize.options_ResetButtonPosition, () =>
            {
                UIPickerButton.savedX.value = -1000;
                UIPickerButton.savedY.value = -1000;
                PickerTool.instance?.m_button?.ResetPosition();
            });

            group.AddSpace(20);

            panel = ((UIHelper)group).self as UIPanel;
            UILabel fitLabel = panel.AddUIComponent <UILabel>();

            fitLabel.name = "fitLabel";
            fitLabel.text = $"Find It: ";
            switch (GetFindItVersion())
            {
            case 0:
                fitLabel.text += Localize.options_NotFound;
                break;

            case 1:
                fitLabel.text += Localize.options_Found + " (v1)";
                break;

            case 2:
                fitLabel.text += Localize.options_Found + " (v2)";
                break;

            default:
                fitLabel.text += Localize.options_Unknown;
                break;
            }

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

            mitLabel.name = "mitLabel";
            mitLabel.text = $"Move It: ";
            switch (GetMoveItVersion())
            {
            case 0:
                mitLabel.text += Localize.options_NotFound;
                break;

            case 1:
                mitLabel.text += Localize.options_Found;
                break;

            default:
                mitLabel.text += Localize.options_Unknown;
                break;
            }

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

            ns2Label.name = "ns2Label";
            ns2Label.text = $"Network Skins 2: ";
            switch (PickerTool.isNS2Installed())
            {
            case false:
                ns2Label.text += Localize.options_NotFound;
                break;

            case true:
                ns2Label.text += Localize.options_Found;
                break;
            }

            group.AddSpace(20);
        }
Beispiel #13
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);
            }
        }
        /// <summary>
        /// Adds mod options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        internal ModOptions(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab and helper.
            UIPanel  panel  = PanelUtils.AddTab(tabStrip, Translations.Translate("PRR_OPTION_MOD"), tabIndex, true);
            UIHelper helper = new UIHelper(panel);


            UIDropDown translationDropDown = (UIDropDown)helper.AddDropdown(Translations.Translate("TRN_CHOICE"), Translations.LanguageList, Translations.Index, (value) =>
            {
                Translations.Index = value;
                SettingsUtils.SaveSettings();
            });

            translationDropDown.autoSize = false;
            translationDropDown.width    = 270f;

            // Game options.

            /*UIHelperBase gameGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_LOA"));
             *
             * // Add reset on load checkbox.
             * gameGroup.AddCheckbox(Translations.Translate("PRR_OPTION_FORCERESET"), ModSettings.resetOnLoad, isChecked =>
             * {
             *  ModSettings.resetOnLoad = isChecked;
             *  SettingsUtils.SaveSettings();
             * });*/

            // Notification options.
            UIHelperBase notificationGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_NOT"));

            // Add logging checkbox.
            notificationGroup.AddCheckbox(Translations.Translate("PRR_OPTION_WHATSNEW"), ModSettings.showWhatsNew, isChecked =>
            {
                ModSettings.showWhatsNew = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Logging options.
            UIHelperBase logGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_LOG"));

            // Add logging checkbox.
            logGroup.AddCheckbox(Translations.Translate("PRR_OPTION_MOREDEBUG"), Logging.detailLogging, isChecked =>
            {
                Logging.detailLogging = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Thumbnail options.
            UIHelperBase thumbGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_TMB"));

            // Add thumbnail background dropdown.
            thumbGroup.AddDropdown(Translations.Translate("PRR_OPTION_THUMBACK"), ModSettings.ThumbBackNames, ModSettings.thumbBacks, (value) =>
            {
                ModSettings.thumbBacks = value;
                SettingsUtils.SaveSettings();
            });

            // Add regenerate thumbnails button.
            thumbGroup.AddButton(Translations.Translate("PRR_OPTION_REGENTHUMBS"), () => PloppableTool.Instance.RegenerateThumbnails());

            // Add speed boost checkbox.
            UIHelperBase speedGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_SPDHDR"));

            speedGroup.AddCheckbox(Translations.Translate("PRR_OPTION_SPEED"), ModSettings.speedBoost, isChecked =>
            {
                ModSettings.speedBoost = isChecked;
                SettingsUtils.SaveSettings();
            });
        }
Beispiel #15
0
        public static void BuildSettingsMenu(ref UIHelperBase helper)
        {
            try
            {
                UIHelper hp = (UIHelper)helper;
                panel = (UIScrollablePanel)hp.self;
                if (panel != null)
                {
                    panel.eventVisibilityChanged += SettingsEventVisibilityChanged;
                }
                UIHelperBase group = helper.AddGroup(Mod.MOD_NAME); //Title of your settings options panel, keep it short.
                group.AddSpace(10);
                sliderFireRateValue           = (UISlider)group.AddSlider("Tree Fire Spread Rate", 0.0f, 100.0f, 5.0f, (float)Mod.config.TreeFireSpreadRate, OnFireRateChanged);
                m_FireSettingTxtUIref         = (UITextField)group.AddTextfield("Rate", Mod.config.TreeFireSpreadRate.ToString(), delegate(string str) { }, delegate(string str) { });
                m_FireSettingTxtUIref.text    = sliderFireRateValue.value.ToString();
                m_FireSettingTxtUIref.tooltip = "Current setting of the tree fire rate relative to the base game";
                group.AddSpace(16);

                sliderFireRateDisasterValue = (UISlider)group.AddSlider("Tree Fire Spread Rate (Disasters)", 0.0f, 100.0f, 5.0f, (float)Mod.config.TreeFireSpreadRate, OnFireRateChangedDisaster);
                group.AddSpace(10);
                m_FireSettingDisasterTxtUIref         = (UITextField)group.AddTextfield("Rate", Mod.config.TreeFireDisasterSpreadRate.ToString(), delegate(string str) { }, delegate(string str) { });
                m_FireSettingDisasterTxtUIref.text    = sliderFireRateDisasterValue.value.ToString();
                m_FireSettingDisasterTxtUIref.tooltip = "Current setting of the tree fire rate when part of disaster relative to the base game";
                if ((int)Mod.config.TreeFireSpreadRate <= 0)
                {
                    m_FireSettingTxtUIref.text = "Disabled";
                }
                if ((int)Mod.config.TreeFireSpreadRate > 99)
                {
                    m_FireSettingTxtUIref.text = "Original";
                }
                if ((int)Mod.config.TreeFireDisasterSpreadRate <= 0)
                {
                    m_FireSettingDisasterTxtUIref.text = "Disabled";
                }
                if ((int)Mod.config.TreeFireDisasterSpreadRate > 99)
                {
                    m_FireSettingDisasterTxtUIref.text = "Original";
                }
                group.AddSpace(12);
                UICheckBox chkDisableBuildingFires = (UICheckBox)group.AddCheckbox("Disable normal building fires", Mod.config.DisableBuildingFires, OnDisableFires);
                chkDisableBuildingFires.tooltip = "Will disable buildings from catching fire via normal methods, existing fires will continue till they burn out\n Does not effect disaster trigged building fires.\nThis was only included for convenience for people using no-fire mods to not have to have 2 mods";
                group.AddSpace(10);
                UICheckBox chkEnableLogging = (UICheckBox)group.AddCheckbox("Enable Logging", Mod.DEBUG_LOG_ON, OnLoggingChecked);
                chkEnableLogging.tooltip = "Enables logging of debug data to your log file.";
                group.AddSpace(20);
                UIButton btnResetAllTrees = (UIButton)group.AddButton("Extinguish All Tree Fires", ResetAllBurningTrees);
                btnResetAllTrees.tooltip = "Resets the flags on all trees to mark them not burned or damaged,\n then wipes the burningtree list, ground is not touched however.";
                group.AddSpace(12);
                UILabel txtMessage;
                txtMessage      = panel.AddUIComponent <UILabel>();
                txtMessage.text = "Note all options can be changed during game play, and are effective immediately.\nYou must be in game obviously to use the Extinguish button.";
                group.AddSpace(10);
                UILabel txtMessage2;
                txtMessage2      = panel.AddUIComponent <UILabel>();
                txtMessage2.text = "Version: " + Mod.MOD_VERSIONSTRING;
                group.AddSpace(12);
                txtMessageState = panel.AddUIComponent <UILabel>();
                object[] tmpvars = new object[] { isInGame.ToString(), Detours.isActive.ToString(), TreeFireControl_Loader.FireStats.totalburncalls.ToString(), TreeFireControl_Loader.FireStats.totalburncallsnormal.ToString(), TreeFireControl_Loader.FireStats.totalburncallsdisaster.ToString(), TreeFireControl_Loader.FireStats.totalburncallsblockednormal.ToString(), TreeFireControl_Loader.FireStats.totalburncallsblockeddisaster.ToString() };
                txtMessageState.text = string.Format("StateInfo: isInGame:{0} DetoursActive:{1}\n Total:{2} Totalnorm:{3} Totaldist:{4}\n Totalnormskipped:{5} Totaldistskipped:{6}", tmpvars);
                txtMessageState.Hide();
                //               panel.autoLayout = false;
//                btnClearStats = (UIButton)group.AddButton("Clear Stats", ClearStats_Clicked);
                btnClearStats                  = (UIButton)panel.AddUIComponent <UIButton>();
                btnClearStats.autoSize         = false;
                btnClearStats.size             = new Vector2(130, 28);
                btnClearStats.normalBgSprite   = "ButtonMenu";
                btnClearStats.hoveredTextColor = new Color32(7, 137, 255, 255);
                btnClearStats.pressedTextColor = new Color32(30, 30, 44, 255);
                btnClearStats.playAudioEvents  = true;
//                panel.AddUIComponent<UIButton>();
                btnClearStats.text        = "ClearStats";
                btnClearStats.eventClick += ClearStats_Clicked;
//                btnClearStats.relativePosition = new Vector3(txtMessageState.relativePosition.x, txtMessageState.relativePosition.y + 42f);
                btnClearStats.Hide();
                if (Mod.DEBUG_LOG_ON)
                {
                    txtMessage.Show(); btnClearStats.Show();
                }
                if (Mod.DEBUG_LOG_ON)
                {
                    Logger.dbgLog("UI setup completed");
                }
            }
            catch (Exception ex)
            { Logger.dbgLog("Error ", ex); }

            //group.AddCheckbox("Auto Show On Map Load", config.UseAlternateKeyBinding, OnUseAlternateKeyBinding); //<-- last part is function you want called when clicked\unclicked.
            //group.AddCheckbox("Use Alternate Keybinding", config.UseAlternateKeyBinding, OnUseAlternateKeyBinding); //<-- last part is function you want called when clicked\unclicked.
            //group.AddCheckbox("Enable Verbose Logging", DEBUG_LOG_ON, OnLoggingChecked); //<-- last part is function you want called when clicked\unclicked.
        }
        public void OnSettingsUI(UIHelperBase helper)
        {
            if (LocalizationManager.instance == null)
            {
                LocalizationManager.CreateManager();
            }
            SetUnits();

            ExtUITabstrip tabStrip = ExtUITabstrip.Create((UIHelper)helper);

            UIHelper     gentab         = tabStrip.AddTabPage("  " + LocalizationManager.instance.current["settings_GENERAL"] + "  ", out genTabButton);
            UIHelperBase group          = gentab.AddGroup(LocalizationManager.instance.current["settings_GENERAL"]);
            UIHelper     keybindingsTab = tabStrip.AddTabPage(" " + LocalizationManager.instance.current["settings_KB"] + " ", out kbTabButton);
            UIHelperBase kbGroup        = keybindingsTab.AddGroup(LocalizationManager.instance.current["settings_KB"]);

            // UIHelperBase group = helper.AddGroup("    Procedural Objects");

            // KEY BINDINGS TAB

            ((UIPanel)((UIHelper)kbGroup).self).gameObject.AddComponent <OptionsKeymappingGeneral>();
            kbGroup.AddSpace(8);
            var KBPosGroup = kbGroup.AddGroup(LocalizationManager.instance.current["position"]);

            ((UIPanel)((UIHelper)KBPosGroup).self).gameObject.AddComponent <OptionsKeymappingPosition>();
            KBPosGroup.AddSpace(8);
            var KBRotGroup = kbGroup.AddGroup(LocalizationManager.instance.current["rotation"]);

            ((UIPanel)((UIHelper)KBRotGroup).self).gameObject.AddComponent <OptionsKeymappingRotation>();
            KBRotGroup.AddSpace(8);
            var KBScaleGroup = kbGroup.AddGroup(LocalizationManager.instance.current["scale_obj"]);

            ((UIPanel)((UIHelper)KBScaleGroup).self).gameObject.AddComponent <OptionsKeymappingScale>();
            KBScaleGroup.AddSpace(8);
            var KBSMActionsGroup = kbGroup.AddGroup(LocalizationManager.instance.current["CTActions"] + " (" + LocalizationManager.instance.current["selection_mode"] + ")");

            ((UIPanel)((UIHelper)KBSMActionsGroup).self).gameObject.AddComponent <OptionsKeymappingSelectionModeActions>();
            KBSMActionsGroup.AddSpace(8);
            openKeybindingsButton = (UIButton)kbGroup.AddButton(LocalizationManager.instance.current["open_kbd_cfg"], openKeybindings);

            KeyBindingsManager.Initialize();

            // GENERAL TAB
            UIPanel globalPanel = ((UIPanel)((UIHelper)group).self);

            gizmoSizeSlider         = (UISlider)group.AddSlider(string.Format(LocalizationManager.instance.current["settings_GIZMO_label"], (GizmoSize.value * 100).ToString()), 0.2f, 3f, 0.1f, GizmoSize.value, gizmoSizeChanged);
            gizmoSizeSlider.width   = 600;
            gizmoSizeSlider.height  = 16;
            gizmoSizeSlider.tooltip = LocalizationManager.instance.current["settings_GIZMO_tooltip"];

            var gizmoSizePanel = globalPanel.Find <UIPanel>("OptionsSliderTemplate(Clone)");

            gizmoSizePanel.name   = "GizmoSizePanel";
            gizmoSizeLabel        = gizmoSizePanel.Find <UILabel>("Label");
            gizmoSizeLabel.width *= 3.5f;

            gizmoOpacitySlider        = (UISlider)group.AddSlider(string.Format(LocalizationManager.instance.current["settings_GIZMO_OPACITY_label"], (GizmoOpacity.value * 100).ToString()), .1f, 1f, 0.05f, GizmoOpacity.value, gizmoOpacityChanged);
            gizmoOpacitySlider.width  = 600;
            gizmoOpacitySlider.height = 16;

            var gizmoOpacityPanel = globalPanel.components.First(c => c.GetType() == typeof(UIPanel) && c != gizmoSizePanel);

            gizmoOpacityPanel.name   = "GizmoOpacityPanel";
            gizmoOpacityLabel        = gizmoOpacityPanel.Find <UILabel>("Label");
            gizmoOpacityLabel.width *= 3.5f;


            group.AddDropdown(LocalizationManager.instance.current["settings_DISTUNITS_label"],
                              new string[] { LocalizationManager.instance.current["settings_DISTUNITS_m"] + " (m)",
                                             LocalizationManager.instance.current["settings_DISTUNITS_ft"] + " (ft)",
                                             LocalizationManager.instance.current["settings_DISTUNITS_yd"] + " (yd)" }, DistanceUnits.value,
                              (int value) => {
                DistanceUnits.value = value;
                SetUnits();
                // propRenderDistanceChanged(PropRenderDistance.value);
                // buildingRenderDistanceChanged(BuildingRenderDistance.value);
            });

            group.AddDropdown(LocalizationManager.instance.current["settings_ANGUNITS_label"],
                              new string[] { LocalizationManager.instance.current["settings_ANGUNITS_deg"] + " (°)",
                                             LocalizationManager.instance.current["settings_ANGUNITS_rad"] + " (rad)" }, AngleUnits.value, (int value) => { AngleUnits.value = value; SetUnits(); });

            useUINightModeCheckbox = (UICheckBox)group.AddCheckbox(LocalizationManager.instance.current["settings_USEUINIGHTMODE_toggle"], UseUINightMode.value, (bool value) => { UseUINightMode.value = value; });

            hideDisLayerIconCheckbox = (UICheckBox)group.AddCheckbox(LocalizationManager.instance.current["settings_HIDEDISABLEDLAYERSICON_toggle"], HideDisabledLayersIcon.value, hideDisabledLayersIconChanged);

            // usePasteIntoCheckbox = (UICheckBox)group.AddCheckbox(LocalizationManager.instance.current["settings_USEPASTEINTO_toggle"], UsePasteInto.value, usePasteIntoChanged);

            autoResizeDecalsCheckbox = (UICheckBox)group.AddCheckbox(LocalizationManager.instance.current["settings_AUTORESIZEDECALS_toggle"], AutoResizeDecals.value, autoResizeDecalsChanged);

            includeSubBuildingsCheckbox = (UICheckBox)group.AddCheckbox(LocalizationManager.instance.current["settings_CONVERTSUBBUILDINGS_toggle"], IncludeSubBuildings.value, includeSubBuildingsChanged);

            useColorVariationCheckbox = (UICheckBox)group.AddCheckbox(LocalizationManager.instance.current["settings_USECOLORVAR_toggle"], UseColorVariation.value, useColorVariationChanged);

            group.AddSpace(10);
            var sliderGroup = gentab.AddGroup("  " + LocalizationManager.instance.current["settings_CONFDEL_title"]);

            confirmDelCheckbox = (UICheckBox)sliderGroup.AddCheckbox(LocalizationManager.instance.current["settings_CONFDEL_toggle"], ShowConfirmDeletion.value, confirmDeletionCheckboxChanged);

            confirmDelThresholdSlider         = (UISlider)sliderGroup.AddSlider(string.Format(LocalizationManager.instance.current["settings_CONFDEL_SLIDER_label"], ConfirmDeletionThreshold.value.ToString()), 1f, 15f, 1f, ConfirmDeletionThreshold.value, confirmDeletionThresholdChanged);
            confirmDelThresholdSlider.width   = 715;
            confirmDelThresholdSlider.height  = 16;
            confirmDelThresholdSlider.tooltip = LocalizationManager.instance.current["settings_CONFDEL_SLIDER_tooltip"];

            confirmDelThresholdLabel = (UILabel)((UIPanel)((UIHelper)sliderGroup).self).components.First(c => c.GetType() == typeof(UIPanel) && c.components.Any(comp => comp.GetType() == typeof(UISlider)))
                                       .components.First(c => c.GetType() == typeof(UILabel));
            confirmDelThresholdLabel.width *= 3.5f;
            if (!ShowConfirmDeletion.value)
            {
                confirmDelThresholdSlider.isEnabled = false;
            }


            sliderGroup.AddSpace(10);
            var languageGroup = gentab.AddGroup("  " + LocalizationManager.instance.current["settings_LANG_title"]);

            languageGroup.AddDropdown(LocalizationManager.instance.current["settings_LANG_title"], LocalizationManager.instance.identifiers, LocalizationManager.instance.available.IndexOf(LocalizationManager.instance.current), languageChanged);

            languageGroup.AddSpace(10);

            showDevCheckbox = (UICheckBox)languageGroup.AddCheckbox(LocalizationManager.instance.current["settings_DEVTOOLS_toggle"], ShowDeveloperTools.value, (value) =>
            {
                ShowDeveloperTools.value = value;
            });
            showDevCheckbox.tooltip = LocalizationManager.instance.current["settings_DEVTOOLS_tooltip"];
        }
		public static float someValue4 = 50f; // debug value

		public static void makeSettings(UIHelperBase helper) {
			mainGroup = helper.AddGroup(Translation.GetString("TMPE_Title"));
			simAccuracyDropdown = mainGroup.AddDropdown(Translation.GetString("Simulation_accuracy") + ":", new string[] { Translation.GetString("Very_high"), Translation.GetString("High"), Translation.GetString("Medium"), Translation.GetString("Low"), Translation.GetString("Very_Low") }, simAccuracy, onSimAccuracyChanged) as UIDropDown;
			recklessDriversDropdown = mainGroup.AddDropdown(Translation.GetString("Reckless_driving") + ":", new string[] { Translation.GetString("Path_Of_Evil_(10_%)"), Translation.GetString("Rush_Hour_(5_%)"), Translation.GetString("Minor_Complaints_(2_%)"), Translation.GetString("Holy_City_(0_%)") }, recklessDrivers, onRecklessDriversChanged) as UIDropDown;
			//publicTransportUsageDropdown = mainGroup.AddDropdown(Translation.GetString("Citizens_use_public_transportation") + ":", new string[] { Translation.GetString("Very_often"), Translation.GetString("Often"), Translation.GetString("Sometimes"), Translation.GetString("Rarely"), Translation.GetString("Very_rarely") }, recklessDrivers, onRecklessDriversChanged) as UIDropDown;
			relaxedBussesToggle = mainGroup.AddCheckbox(Translation.GetString("Busses_may_ignore_lane_arrows"), relaxedBusses, onRelaxedBussesChanged) as UICheckBox;
#if DEBUG
			allRelaxedToggle = mainGroup.AddCheckbox(Translation.GetString("All_vehicles_may_ignore_lane_arrows"), allRelaxed, onAllRelaxedChanged) as UICheckBox;
#endif
			allowEnterBlockedJunctionsToggle = mainGroup.AddCheckbox(Translation.GetString("Vehicles_may_enter_blocked_junctions"), allowEnterBlockedJunctions, onAllowEnterBlockedJunctionsChanged) as UICheckBox;
			allowUTurnsToggle = mainGroup.AddCheckbox(Translation.GetString("Vehicles_may_do_u-turns_at_junctions"), allowUTurns, onAllowUTurnsChanged) as UICheckBox;
			allowLaneChangesWhileGoingStraightToggle = mainGroup.AddCheckbox(Translation.GetString("Vehicles_going_straight_may_change_lanes_at_junctions"), allowLaneChangesWhileGoingStraight, onAllowLaneChangesWhileGoingStraightChanged) as UICheckBox;
			strongerRoadConditionEffectsToggle = mainGroup.AddCheckbox(Translation.GetString("Road_condition_has_a_bigger_impact_on_vehicle_speed"), strongerRoadConditionEffects, onStrongerRoadConditionEffectsChanged) as UICheckBox;
			enableDespawningToggle = mainGroup.AddCheckbox(Translation.GetString("Enable_despawning"), enableDespawning, onEnableDespawningChanged) as UICheckBox;
			aiGroup = helper.AddGroup("Advanced Vehicle AI");
			advancedAIToggle = aiGroup.AddCheckbox(Translation.GetString("Enable_Advanced_Vehicle_AI"), advancedAI, onAdvancedAIChanged) as UICheckBox;
			highwayRulesToggle = aiGroup.AddCheckbox(Translation.GetString("Enable_highway_specific_lane_merging/splitting_rules")+" (BETA feature)", highwayRules, onHighwayRulesChanged) as UICheckBox;
			laneChangingRandomizationDropdown = aiGroup.AddDropdown(Translation.GetString("Drivers_want_to_change_lanes_(only_applied_if_Advanced_AI_is_enabled):"), new string[] { Translation.GetString("Very_often") + " (50 %)", Translation.GetString("Often") + " (25 %)", Translation.GetString("Sometimes") + " (10 %)", Translation.GetString("Rarely") + " (5 %)", Translation.GetString("Very_rarely") + " (2.5 %)", Translation.GetString("Only_if_necessary") }, laneChangingRandomization, onLaneChangingRandomizationChanged) as UIDropDown;
			overlayGroup = helper.AddGroup(Translation.GetString("Persistently_visible_overlays"));
			prioritySignsOverlayToggle = overlayGroup.AddCheckbox(Translation.GetString("Priority_signs"), prioritySignsOverlay, onPrioritySignsOverlayChanged) as UICheckBox;
			timedLightsOverlayToggle = overlayGroup.AddCheckbox(Translation.GetString("Timed_traffic_lights"), timedLightsOverlay, onTimedLightsOverlayChanged) as UICheckBox;
			speedLimitsOverlayToggle = overlayGroup.AddCheckbox(Translation.GetString("Speed_limits"), speedLimitsOverlay, onSpeedLimitsOverlayChanged) as UICheckBox;
			vehicleRestrictionsOverlayToggle = overlayGroup.AddCheckbox(Translation.GetString("Vehicle_restrictions"), vehicleRestrictionsOverlay, onVehicleRestrictionsOverlayChanged) as UICheckBox;
			nodesOverlayToggle = overlayGroup.AddCheckbox(Translation.GetString("Nodes_and_segments"), nodesOverlay, onNodesOverlayChanged) as UICheckBox;
			showLanesToggle = overlayGroup.AddCheckbox(Translation.GetString("Lanes"), showLanes, onShowLanesChanged) as UICheckBox;
			maintenanceGroup = helper.AddGroup(Translation.GetString("Maintenance"));
			forgetTrafficLightsBtn = maintenanceGroup.AddButton(Translation.GetString("Forget_toggled_traffic_lights"), onClickForgetToggledLights) as UIButton;
#if DEBUG
			disableSomething1Toggle = maintenanceGroup.AddCheckbox("Enable path-finding debugging", disableSomething1, onDisableSomething1Changed) as UICheckBox;
			disableSomething2Toggle = maintenanceGroup.AddCheckbox("Disable something #2", disableSomething2, onDisableSomething2Changed) as UICheckBox;
			disableSomething3Toggle = maintenanceGroup.AddCheckbox("Disable something #3", disableSomething3, onDisableSomething3Changed) as UICheckBox;
			disableSomething4Toggle = maintenanceGroup.AddCheckbox("Disable something #4", disableSomething4, onDisableSomething4Changed) as UICheckBox;
			disableSomething5Toggle = maintenanceGroup.AddCheckbox("Disable something #5", disableSomething5, onDisableSomething5Changed) as UICheckBox;
			pathCostMultiplicatorField = maintenanceGroup.AddTextfield("Pathcost multiplicator (mult)", String.Format("{0:0.##}", pathCostMultiplicator), onPathCostMultiplicatorChanged) as UITextField;
			pathCostMultiplicator2Field = maintenanceGroup.AddTextfield("Pathcost multiplicator (div)", String.Format("{0:0.##}", pathCostMultiplicator2), onPathCostMultiplicator2Changed) as UITextField;
			someValueField = maintenanceGroup.AddTextfield("Some value #1", String.Format("{0:0.##}", someValue), onSomeValueChanged) as UITextField;
			someValue2Field = maintenanceGroup.AddTextfield("Some value #2", String.Format("{0:0.##}", someValue2), onSomeValue2Changed) as UITextField;
			someValue3Field = maintenanceGroup.AddTextfield("Some value #3", String.Format("{0:0.##}", someValue3), onSomeValue3Changed) as UITextField;
			someValue4Field = maintenanceGroup.AddTextfield("Some value #4", String.Format("{0:0.##}", someValue4), onSomeValue4Changed) as UITextField;
#endif
		}
Beispiel #18
0
        internal static void MakeSettings_Maintenance(UITabstrip tabStrip, int tabIndex)
        {
            Options.AddOptionTab(tabStrip, T("Maintenance"));
            tabStrip.selectedIndex = tabIndex;

            var currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel;

            currentPanel.autoLayout              = true;
            currentPanel.autoLayoutDirection     = LayoutDirection.Vertical;
            currentPanel.autoLayoutPadding.top   = 5;
            currentPanel.autoLayoutPadding.left  = 10;
            currentPanel.autoLayoutPadding.right = 10;

            var          panelHelper      = new UIHelper(currentPanel);
            UIHelperBase maintenanceGroup = panelHelper.AddGroup(T("Maintenance"));

            _resetStuckEntitiesBtn = maintenanceGroup.AddButton(
                T("Reset_stuck_cims_and_vehicles"),
                onClickResetStuckEntities) as UIButton;

            _removeParkedVehiclesBtn = maintenanceGroup.AddButton(
                T("Remove_parked_vehicles"),
                onClickRemoveParkedVehicles) as UIButton;
#if DEBUG
            _resetSpeedLimitsBtn = maintenanceGroup.AddButton(
                T("Reset_custom_speed_limits"),
                onClickResetSpeedLimits) as UIButton;
#endif
            _reloadGlobalConfBtn = maintenanceGroup.AddButton(
                T("Reload_global_configuration"),
                onClickReloadGlobalConf) as UIButton;
            _resetGlobalConfBtn = maintenanceGroup.AddButton(
                T("Reset_global_configuration"),
                onClickResetGlobalConf) as UIButton;

#if QUEUEDSTATS
            _showPathFindStatsToggle = maintenanceGroup.AddCheckbox(
                T("Show_path-find_stats"),
                Options.showPathFindStats,
                onShowPathFindStatsChanged) as UICheckBox;
#endif

            var featureGroup = panelHelper.AddGroup(T("Activated_features")) as UIHelper;
            EnablePrioritySignsToggle = featureGroup.AddCheckbox(
                T("Priority_signs"),
                Options.prioritySignsEnabled,
                OnPrioritySignsEnabledChanged) as UICheckBox;
            EnableTimedLightsToggle = featureGroup.AddCheckbox(
                T("Timed_traffic_lights"),
                Options.timedLightsEnabled,
                OnTimedLightsEnabledChanged) as UICheckBox;
            _enableCustomSpeedLimitsToggle = featureGroup.AddCheckbox(
                T("Speed_limits"),
                Options.customSpeedLimitsEnabled,
                OnCustomSpeedLimitsEnabledChanged) as UICheckBox;
            _enableVehicleRestrictionsToggle
                = featureGroup.AddCheckbox(
                      T("Vehicle_restrictions"),
                      Options.vehicleRestrictionsEnabled,
                      OnVehicleRestrictionsEnabledChanged) as UICheckBox;
            _enableParkingRestrictionsToggle
                = featureGroup.AddCheckbox(
                      T("Parking_restrictions"),
                      Options.parkingRestrictionsEnabled,
                      OnParkingRestrictionsEnabledChanged) as UICheckBox;
            _enableJunctionRestrictionsToggle
                = featureGroup.AddCheckbox(
                      T("Junction_restrictions"),
                      Options.junctionRestrictionsEnabled,
                      OnJunctionRestrictionsEnabledChanged) as UICheckBox;
            _turnOnRedEnabledToggle = featureGroup.AddCheckbox(
                T("Turn_on_red"),
                Options.turnOnRedEnabled,
                OnTurnOnRedEnabledChanged) as UICheckBox;
            _enableLaneConnectorToggle = featureGroup.AddCheckbox(
                T("Lane_connector"),
                Options.laneConnectorEnabled,
                OnLaneConnectorEnabledChanged) as UICheckBox;

            Options.Indent(_turnOnRedEnabledToggle);
        }
 public void OnSettingsUI(UIHelperBase helper)
 {
     helper.AddOptionsGroup <Options>();
     helper.AddButton("Refresh Sub-Buildings Editor Definitions",
                      SubBuildingsEnablerFormat.InitializeBuildingsWithSubBuildings);
 }
 public void OnSettingsUI(UIHelperBase helper)
 {
     helper.AddButton(UNLOCK_ALL_TILES_FOR_FREE, UnlockAllCheat.UnlockAllAreas);
 }
        internal static void MakeSettings_Maintenance(UITabstrip tabStrip, int tabIndex)
        {
            Options.AddOptionTab(tabStrip, T("Tab:Maintenance"));
            tabStrip.selectedIndex = tabIndex;

            var currentPanel = tabStrip.tabContainer.components[tabIndex] as UIPanel;

            currentPanel.autoLayout              = true;
            currentPanel.autoLayoutDirection     = LayoutDirection.Vertical;
            currentPanel.autoLayoutPadding.top   = 5;
            currentPanel.autoLayoutPadding.left  = 10;
            currentPanel.autoLayoutPadding.right = 10;

            var          panelHelper      = new UIHelper(currentPanel);
            UIHelperBase maintenanceGroup = panelHelper.AddGroup(T("Tab:Maintenance"));

            _resetStuckEntitiesBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Reset stuck cims and vehicles"),
                onClickResetStuckEntities) as UIButton;

            _removeParkedVehiclesBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Remove parked vehicles"),
                OnClickRemoveParkedVehicles) as UIButton;

            _removeAllExistingTrafficLightsBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Remove all existing traffic lights"),
                OnClickRemoveAllExistingTrafficLights) as UIButton;
#if DEBUG
            _resetSpeedLimitsBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Reset custom speed limits"),
                OnClickResetSpeedLimits) as UIButton;
#endif
            _reloadGlobalConfBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Reload global configuration"),
                OnClickReloadGlobalConf) as UIButton;
            _resetGlobalConfBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Reset global configuration"),
                OnClickResetGlobalConf) as UIButton;

#if QUEUEDSTATS
            _showPathFindStatsToggle = maintenanceGroup.AddCheckbox(
                T("Maintenance.Checkbox:Show path-find stats"),
                Options.showPathFindStats,
                OnShowPathFindStatsChanged) as UICheckBox;
#endif

            var featureGroup =
                panelHelper.AddGroup(T("Maintenance.Group:Activated features")) as UIHelper;
            EnablePrioritySignsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Priority signs"),
                Options.prioritySignsEnabled,
                OnPrioritySignsEnabledChanged) as UICheckBox;
            EnableTimedLightsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Timed traffic lights"),
                Options.timedLightsEnabled,
                OnTimedLightsEnabledChanged) as UICheckBox;
            _enableCustomSpeedLimitsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Speed limits"),
                Options.customSpeedLimitsEnabled,
                OnCustomSpeedLimitsEnabledChanged) as UICheckBox;
            _enableVehicleRestrictionsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Vehicle restrictions"),
                Options.vehicleRestrictionsEnabled,
                OnVehicleRestrictionsEnabledChanged) as
                                               UICheckBox;
            _enableParkingRestrictionsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Parking restrictions"),
                Options.parkingRestrictionsEnabled,
                OnParkingRestrictionsEnabledChanged) as
                                               UICheckBox;
            _enableJunctionRestrictionsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Junction restrictions"),
                Options.junctionRestrictionsEnabled,
                OnJunctionRestrictionsEnabledChanged) as
                                                UICheckBox;
            _turnOnRedEnabledToggle = featureGroup.AddCheckbox(
                T("Maintenance.Checkbox:Turn on red"),
                Options.turnOnRedEnabled,
                OnTurnOnRedEnabledChanged) as UICheckBox;
            _enableLaneConnectorToggle = featureGroup.AddCheckbox(
                T("Maintenance.Checkbox:Lane connector"),
                Options.laneConnectorEnabled,
                OnLaneConnectorEnabledChanged) as UICheckBox;

            Options.Indent(_turnOnRedEnabledToggle);
        }
        internal static void MakeSettings_Maintenance(ExtUITabstrip tabStrip)
        {
            UIHelper     panelHelper      = tabStrip.AddTabPage(Translation.Options.Get("Tab:Maintenance"));
            UIHelperBase maintenanceGroup = panelHelper.AddGroup(T("Tab:Maintenance"));

            _resetStuckEntitiesBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Reset stuck cims and vehicles"),
                onClickResetStuckEntities) as UIButton;

            _removeParkedVehiclesBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Remove parked vehicles"),
                OnClickRemoveParkedVehicles) as UIButton;

            _removeAllExistingTrafficLightsBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Remove all existing traffic lights"),
                OnClickRemoveAllExistingTrafficLights) as UIButton;
#if DEBUG
            _resetSpeedLimitsBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Reset custom speed limits"),
                OnClickResetSpeedLimits) as UIButton;
#endif
            _reloadGlobalConfBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Reload global configuration"),
                OnClickReloadGlobalConf) as UIButton;
            _resetGlobalConfBtn = maintenanceGroup.AddButton(
                T("Maintenance.Button:Reset global configuration"),
                OnClickResetGlobalConf) as UIButton;

#if QUEUEDSTATS
            _showPathFindStatsToggle = maintenanceGroup.AddCheckbox(
                T("Maintenance.Checkbox:Show path-find stats"),
                Options.showPathFindStats,
                OnShowPathFindStatsChanged) as UICheckBox;
#endif

            var featureGroup =
                panelHelper.AddGroup(T("Maintenance.Group:Activated features")) as UIHelper;
            EnablePrioritySignsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Priority signs"),
                Options.prioritySignsEnabled,
                OnPrioritySignsEnabledChanged) as UICheckBox;
            EnableTimedLightsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Timed traffic lights"),
                Options.timedLightsEnabled,
                OnTimedLightsEnabledChanged) as UICheckBox;
            _enableCustomSpeedLimitsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Speed limits"),
                Options.customSpeedLimitsEnabled,
                OnCustomSpeedLimitsEnabledChanged) as UICheckBox;
            _enableVehicleRestrictionsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Vehicle restrictions"),
                Options.vehicleRestrictionsEnabled,
                OnVehicleRestrictionsEnabledChanged) as
                                               UICheckBox;
            _enableParkingRestrictionsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Parking restrictions"),
                Options.parkingRestrictionsEnabled,
                OnParkingRestrictionsEnabledChanged) as
                                               UICheckBox;
            _enableJunctionRestrictionsToggle = featureGroup.AddCheckbox(
                T("Checkbox:Junction restrictions"),
                Options.junctionRestrictionsEnabled,
                OnJunctionRestrictionsEnabledChanged) as
                                                UICheckBox;
            _turnOnRedEnabledToggle = featureGroup.AddCheckbox(
                T("Maintenance.Checkbox:Turn on red"),
                Options.turnOnRedEnabled,
                OnTurnOnRedEnabledChanged) as UICheckBox;
            _enableLaneConnectorToggle = featureGroup.AddCheckbox(
                T("Maintenance.Checkbox:Lane connector"),
                Options.laneConnectorEnabled,
                OnLaneConnectorEnabledChanged) as UICheckBox;

            Options.Indent(_turnOnRedEnabledToggle);

            // TODO [issue ##959] remove when TTL is implemented in asset editor.
            bool inEditor = (SerializableDataExtension.StateLoading || LoadingExtension.IsGameLoaded) &&
                            LoadingExtension.AppMode != AppMode.Game;
            if (inEditor)
            {
                EnableTimedLightsToggle.isChecked = false;
                EnableTimedLightsToggle.isEnabled = false;
                // since this is temprory I don't want to go through the trouble of creating translation key.
                EnableTimedLightsToggle.tooltip = "TTL is not yet supported in asset editor";
            }
        }
        public void OnSettingsUI(UIHelperBase helper)
        {
            AutobudgetManager am = Singleton <AutobudgetManager> .instance;

            #region Electricity

            UIHelperBase electricityGroup = helper.AddGroup("Electricity");

            UI_Electricity_Enabled = (UICheckBox)electricityGroup.AddCheckbox("Enable", am.container.AutobudgetElectricity.Enabled, delegate(bool isChecked)
            {
                if (freezeUI)
                {
                    return;
                }
                am.container.AutobudgetElectricity.Enabled = isChecked;
                BudgetControlsManager.UpdateControls();
            });

            addLabelToSlider(UI_Electricity_Buffer = (UISlider)electricityGroup.AddSlider("Buffer", 0, 100, 1, am.container.AutobudgetElectricity.AutobudgetBuffer, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetElectricity.AutobudgetBuffer = (int)val;
                }
            }), "%");
            UI_Electricity_Buffer.tooltip = "Set how much production should exceed consumption";

            addLabelToSlider(UI_Electricity_MaxBudget = (UISlider)electricityGroup.AddSlider("Maximum budget", 50, 150, 1, am.container.AutobudgetElectricity.BudgetMaxValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetElectricity.BudgetMaxValue = (int)val;
                }
            }), "%");
            UI_Electricity_MaxBudget.tooltip = "Budget will not be raised higher then this value";

            UI_Electricity_AutoPause = (UICheckBox)electricityGroup.AddCheckbox("Autopause when budget is too high", am.container.AutobudgetElectricity.PauseWhenBudgetTooHigh, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetElectricity.PauseWhenBudgetTooHigh = isChecked;
                }
            });
            UI_Electricity_AutoPause.tooltip = "Pause and switch to the electricity info view mode when the autobudget raises up to the maximum value";

            helper.AddSpace(20);

            #endregion


            #region Water, sewage, and heating

            UIHelperBase waterGroup = helper.AddGroup("Water, sewage, and heating");

            UI_Water_Enabled = (UICheckBox)waterGroup.AddCheckbox("Enable", am.container.AutobudgetWater.Enabled, delegate(bool isChecked)
            {
                if (freezeUI)
                {
                    return;
                }
                am.container.AutobudgetWater.Enabled = isChecked;
                BudgetControlsManager.UpdateControls();
            });

            addLabelToSlider(UI_Water_Buffer = (UISlider)waterGroup.AddSlider("Buffer", 0, 100, 1, am.container.AutobudgetWater.AutobudgetBuffer, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetWater.AutobudgetBuffer = (int)val;
                }
            }), "%");
            UI_Water_Buffer.tooltip = "Set how much production should exceed consumption";

            addLabelToSlider(UI_Water_MaxBudget = (UISlider)waterGroup.AddSlider("Maximum budget", 50, 150, 1, am.container.AutobudgetWater.BudgetMaxValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetWater.BudgetMaxValue = (int)val;
                }
            }), "%");
            UI_Water_MaxBudget.tooltip = "Budget will not be raised higher then this value";

            UI_Water_AutoPause = (UICheckBox)waterGroup.AddCheckbox("Autopause when budget is too high", am.container.AutobudgetWater.PauseWhenBudgetTooHigh, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetWater.PauseWhenBudgetTooHigh = isChecked;
                }
            });
            UI_Water_AutoPause.tooltip = "Pause and switch to the water and sewage info view mode when the autobudget raises up to the maximum value";

            addLabelToSlider(UI_Water_StorageAmount = (UISlider)waterGroup.AddSlider("Target water storage", 0, 100, 1, am.container.AutobudgetWater.TargetWaterStorageRatio, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetWater.TargetWaterStorageRatio = (int)val;
                }
            }), "%");
            UI_Water_StorageAmount.tooltip = "When water storage tanks are filled more than this value, water consumption will not influence the budget";

            UI_Water_UseHeating = (UICheckBox)waterGroup.AddCheckbox("Increase budget if not enough heating", am.container.AutobudgetWater.UseHeatingAutobudget, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetWater.UseHeatingAutobudget = isChecked;
                }
            });
            UI_Water_UseHeating.tooltip = "The budget increases when some of your buildings have heating problems";

            addLabelToSlider(UI_Water_MaxHeatingBudget = (UISlider)waterGroup.AddSlider("Max heating budget", 50, 150, 1, am.container.AutobudgetWater.HeatingBudgetMaxValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetWater.HeatingBudgetMaxValue = (int)val;
                }
            }), "%");
            UI_Water_MaxHeatingBudget.tooltip = "Budget rising due to heating problems will never exceed this value";

            helper.AddSpace(20);

            #endregion


            #region Garbage disposal

            UIHelperBase garbageGroup = helper.AddGroup("Garbage disposal");

            UI_Garbage_Enabled = (UICheckBox)garbageGroup.AddCheckbox("Enable", am.container.AutobudgetGarbage.Enabled, delegate(bool isChecked)
            {
                if (freezeUI)
                {
                    return;
                }
                am.container.AutobudgetGarbage.Enabled = isChecked;
                BudgetControlsManager.UpdateControls();
            });

            addLabelToSlider(UI_Garbage_MaxBudget = (UISlider)garbageGroup.AddSlider("Maximum budget", 50, 150, 1, am.container.AutobudgetGarbage.BudgetMaxValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetGarbage.BudgetMaxValue = (int)val;
                }
            }), "%");
            UI_Garbage_MaxBudget.tooltip = "Budget will not be raised higher then this value";

            addLabelToSlider(UI_Garbage_MaxAmount = (UISlider)garbageGroup.AddSlider("Max garbage amount", 0, 100, 1, am.container.AutobudgetGarbage.MaximumGarbageAmount, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetGarbage.MaximumGarbageAmount = (int)val;
                }
            }), "%");
            UI_Garbage_MaxAmount.tooltip = "When at least one of the recycling centers or incineration plants is piled with garbage more than this value, the budget will be raised to the maximum";

            helper.AddSpace(20);

            #endregion


            #region Healthcare

            UIHelperBase healthcareGroup = helper.AddGroup("Healthcare and Deathcare");

            UI_Healthcare_Enabled = (UICheckBox)healthcareGroup.AddCheckbox("Enable", am.container.AutobudgetHealthcare.Enabled, delegate(bool isChecked)
            {
                if (freezeUI)
                {
                    return;
                }
                am.container.AutobudgetHealthcare.Enabled = isChecked;
                BudgetControlsManager.UpdateControls();
            });

            addLabelToSlider(UI_Healthcare_MinBudget = (UISlider)healthcareGroup.AddSlider("Minimum budget", 50, 150, 1, am.container.AutobudgetHealthcare.BudgetMinValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetHealthcare.BudgetMinValue = (int)val;
                }
            }), "%");
            UI_Healthcare_MinBudget.tooltip = "Budget will not be lowered below this value";

            addLabelToSlider(UI_Healthcare_MaxBudget = (UISlider)healthcareGroup.AddSlider("Maximum budget", 50, 150, 1, am.container.AutobudgetHealthcare.BudgetMaxValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetHealthcare.BudgetMaxValue = (int)val;
                }
            }), "%");
            UI_Healthcare_MaxBudget.tooltip = "Budget will not be raised higher then this value";

            helper.AddSpace(20);

            #endregion


            #region Education

            UIHelperBase educationGroup = helper.AddGroup("Education");

            UI_Education_Enabled = (UICheckBox)educationGroup.AddCheckbox("Enable", am.container.AutobudgetEducation.Enabled, delegate(bool isChecked)
            {
                if (freezeUI)
                {
                    return;
                }
                am.container.AutobudgetEducation.Enabled = isChecked;
                BudgetControlsManager.UpdateControls();
            });

            UI_Education_ElementaryRate = (UISlider)educationGroup.AddSlider("Elementary education", 10, 100, 5, am.container.AutobudgetEducation.ElementaryEducationTargetRate, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetEducation.ElementaryEducationTargetRate = (int)val;
                }
            });
            addLabelToSlider(UI_Education_ElementaryRate, "%");
            UI_Education_ElementaryRate.tooltip = "Target elementary education rate";

            UI_Education_HighRate = (UISlider)educationGroup.AddSlider("High school education", 10, 100, 5, am.container.AutobudgetEducation.HighEducationTargetRate, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetEducation.HighEducationTargetRate = (int)val;
                }
            });
            addLabelToSlider(UI_Education_HighRate, "%");
            UI_Education_HighRate.tooltip = "Target high school education rate";

            UI_Education_MaxBudget = (UISlider)educationGroup.AddSlider("Maximum budget", 50, 150, 1, am.container.AutobudgetEducation.BudgetMaxValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetEducation.BudgetMaxValue = (int)val;
                }
            });
            addLabelToSlider(UI_Education_MaxBudget, "%");
            UI_Education_MaxBudget.tooltip = "Budget will not be raised higher then this value";

            helper.AddSpace(20);

            #endregion


            #region Police

            UIHelperBase policeGroup = helper.AddGroup("Police");

            UI_Police_Enabled = (UICheckBox)policeGroup.AddCheckbox("Enable", am.container.AutobudgetPolice.Enabled, delegate(bool isChecked)
            {
                if (freezeUI)
                {
                    return;
                }
                am.container.AutobudgetPolice.Enabled = isChecked;
                BudgetControlsManager.UpdateControls();
            });

            addLabelToSlider(UI_Police_MinBudget = (UISlider)policeGroup.AddSlider("Minimum budget", 50, 150, 1, am.container.AutobudgetPolice.BudgetMinValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetPolice.BudgetMinValue = (int)val;
                }
            }), "%");
            UI_Police_MinBudget.tooltip = "Budget will not be lowered below this value";

            addLabelToSlider(UI_Police_MaxBudget = (UISlider)policeGroup.AddSlider("Maximum budget", 50, 150, 1, am.container.AutobudgetPolice.BudgetMaxValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetPolice.BudgetMaxValue = (int)val;
                }
            }), "%");
            UI_Police_MaxBudget.tooltip = "Budget will not be raised higher then this value";

            helper.AddSpace(20);

            #endregion


            #region Fire

            UIHelperBase fireGroup = helper.AddGroup("Fire service");

            UI_Fire_Enabled = (UICheckBox)fireGroup.AddCheckbox("Enable", am.container.AutobudgetFire.Enabled, delegate(bool isChecked)
            {
                if (freezeUI)
                {
                    return;
                }
                am.container.AutobudgetFire.Enabled = isChecked;
                BudgetControlsManager.UpdateControls();
            });

            addLabelToSlider(UI_Fire_MinBudget = (UISlider)fireGroup.AddSlider("Minimum budget", 50, 150, 1, am.container.AutobudgetFire.BudgetMinValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetFire.BudgetMinValue = (int)val;
                }
            }), "%");
            UI_Fire_MinBudget.tooltip = "Budget will not be lowered below this value";

            addLabelToSlider(UI_Fire_MaxBudget = (UISlider)fireGroup.AddSlider("Maximum budget", 50, 150, 1, am.container.AutobudgetFire.BudgetMaxValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetFire.BudgetMaxValue = (int)val;
                }
            }), "%");
            UI_Fire_MaxBudget.tooltip = "Budget will not be raised higher then this value";

            addLabelToSlider(UI_Fire_TrucksExcessNum = (UISlider)fireGroup.AddSlider("Minimum trucks waiting", 1, 5, 1, am.container.AutobudgetFire.FireTrucksExcessNum, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetFire.FireTrucksExcessNum = (int)val;
                }
            }), " trucks");
            UI_Fire_TrucksExcessNum.tooltip = "Minimum number of trucks waiting in each of the fire stations";

            helper.AddSpace(20);

            #endregion


            #region Roads

            UIHelperBase roadGroup = helper.AddGroup("Road maintenance and snow dumps");

            UI_Road_Enabled = (UICheckBox)roadGroup.AddCheckbox("Enable", am.container.AutobudgetRoad.Enabled, delegate(bool isChecked)
            {
                if (freezeUI)
                {
                    return;
                }
                am.container.AutobudgetRoad.Enabled = isChecked;
                BudgetControlsManager.UpdateControls();
            });

            addLabelToSlider(UI_Road_MinBudget = (UISlider)roadGroup.AddSlider("Minimum budget", 50, 150, 1, am.container.AutobudgetRoad.BudgetMinValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetRoad.BudgetMinValue = (int)val;
                }
            }), "%");
            UI_Road_MinBudget.tooltip = "Budget will not be lowered below this value";

            addLabelToSlider(UI_Road_MaxBudget = (UISlider)roadGroup.AddSlider("Maximum budget", 50, 150, 1, am.container.AutobudgetRoad.BudgetMaxValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetRoad.BudgetMaxValue = (int)val;
                }
            }), "%");
            UI_Road_MaxBudget.tooltip = "Budget will not be raised higher then this value";

            helper.AddSpace(20);

            #endregion


            #region Post

            UIHelperBase postGroup = helper.AddGroup("Post offices");

            UI_Post_Enabled = (UICheckBox)postGroup.AddCheckbox("Enable", am.container.AutobudgetPost.Enabled, delegate(bool isChecked)
            {
                if (freezeUI)
                {
                    return;
                }
                am.container.AutobudgetPost.Enabled = isChecked;
                BudgetControlsManager.UpdateControls();
            });

            addLabelToSlider(UI_Post_MaxBudget = (UISlider)postGroup.AddSlider("Maximum budget", 50, 150, 1, am.container.AutobudgetPost.BudgetMaxValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetPost.BudgetMaxValue = (int)val;
                }
            }), "%");
            UI_Post_MaxBudget.tooltip = "Budget will not be raised higher then this value";

            helper.AddSpace(20);

            #endregion


            #region Taxi

            UIHelperBase taxiGroup = helper.AddGroup("Taxi");

            UI_Taxi_Enabled = (UICheckBox)taxiGroup.AddCheckbox("Enable", am.container.AutobudgetTaxi.Enabled, delegate(bool isChecked)
            {
                if (freezeUI)
                {
                    return;
                }
                am.container.AutobudgetTaxi.Enabled = isChecked;
                BudgetControlsManager.UpdateControls();
            });

            addLabelToSlider(UI_Taxi_MaxBudget = (UISlider)taxiGroup.AddSlider("Maximum budget", 50, 150, 1, am.container.AutobudgetTaxi.BudgetMaxValue, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetTaxi.BudgetMaxValue = (int)val;
                }
            }), "%");
            UI_Taxi_MaxBudget.tooltip = "Budget will not be raised higher then this value";

            addLabelToSlider(UI_Taxi_DepotVehiclesExcessNum = (UISlider)taxiGroup.AddSlider("Taxis waiting at depots", 1, 5, 1, am.container.AutobudgetTaxi.TargetNumberOfVehiclesWaitingAtDepot, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetTaxi.TargetNumberOfVehiclesWaitingAtDepot = (int)val;
                }
            }), " taxis");
            UI_Taxi_DepotVehiclesExcessNum.tooltip = "Target number of taxis waiting in depots";

            addLabelToSlider(UI_Taxi_StandVehiclesExcessNum = (UISlider)taxiGroup.AddSlider("Taxis waiting at stands", 1, 5, 1, am.container.AutobudgetTaxi.TargetNumberOfVehiclesWaitingAtStand, delegate(float val)
            {
                if (!freezeUI)
                {
                    am.container.AutobudgetTaxi.TargetNumberOfVehiclesWaitingAtStand = (int)val;
                }
            }), " taxis");
            UI_Taxi_StandVehiclesExcessNum.tooltip = "Target number of taxis waiting at taxi stands";

            helper.AddSpace(20);

            #endregion


            helper.AddCheckbox("Create controls on the budget panel", am.container.IsCreateControlsOnBudgetPanel, delegate(bool isChecked)
            {
                if (freezeUI)
                {
                    return;
                }
                am.container.IsCreateControlsOnBudgetPanel = isChecked;
            });
            helper.AddSpace(20);


            // Save buttons
            helper.AddButton("Save as default for new games", delegate()
            {
                am.container.Save();
            });
            helper.AddButton("Reset to the last saved values", delegate()
            {
                am.ReadValuesFromFile();
                TotalAutobudgetOptionsUpdateUI();
            });
            helper.AddButton("Reset to the mod default values", delegate()
            {
                am.ResetToDefaultValues();
                TotalAutobudgetOptionsUpdateUI();
            });
            helper.AddSpace(20);
        }
Beispiel #24
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            customStormDistribution      = new StormDistributionIO();
            customDepthDurationFrequency = new DepthDurationFrequencyIO();


            UIHelperBase group = helper.AddGroup("General Options");

            ChirpForecastCheckBox   = group.AddCheckbox("#RainForecast Chirps", ModSettings.ChirpForecasts, OnChirpForecastCheckBoxChanged) as UICheckBox;
            ChirpRainTweetsCheckBox = group.AddCheckbox("#Rainfall Chirps", ModSettings.ChirpRainTweets, OnChirpRainTweetsCheckBoxChanged) as UICheckBox;
            //EasyModeCheckBox = group.AddCheckbox("Easy/Casual Mode", ModSettings.EasyMode, OnEasyModeCheckBoxChanged) as UICheckBox;
            //DistrictControlCheckBox = group.AddCheckbox("District Control", ModSettings.DistrictControl, OnDistrictControlCheckBoxChanged) as UICheckBox;
            StormDrainAssetControlDropDown = group.AddDropdown("Storm Drain Asset Control", StormDrainAssetControlDropDownOptions, ModSettings.StormDrainAssetControlOption, OnStormDrainAssetControlDropDownChanged) as UIDropDown;
            SimulatePollutionCheckBox      = group.AddCheckbox("Simulate Pollution", ModSettings.SimulatePollution, OnSimulatePollutionCheckBoxChanged) as UICheckBox;
            //ImprovedInletMechanicsCheckBox = group.AddCheckbox("Improved Inlet Mechanics", ModSettings.ImprovedInletMechanics, OnImprovedInletMechanicsCheckBoxChanged) as UICheckBox;
            PreventRainBeforeMilestoneCheckBox = group.AddCheckbox("Prevent Rain Before Milestone", ModSettings.PreventRainBeforeMilestone, OnPreventRainBeforeMilestoneCheckBoxChanged) as UICheckBox;

            FreezeLandvaluesCheckBox                = group.AddCheckbox("Prevent Building Upgrades from Increased Landvalue due to Rainwater", ModSettings.FreezeLandvalues, OnFreezeLandvaluesCheckBoxChanged) as UICheckBox;
            PreviousStormDropDown                   = group.AddDropdown("Previous Storm Options (IE Loading after you saved during a storm)", previousStormDropDownOptions, ModSettings.PreviousStormOption, OnPreviousStormOptionChanged) as UIDropDown;
            GravityDrainageDropDown                 = group.AddDropdown("Gravity Drainage Options", gravityDrainageDropDownOptions, ModSettings.GravityDrainageOption, OnGravityDrainageOptionChanged) as UIDropDown;
            DifficultySlider                        = group.AddSlider("Difficulty", 0f, (float)ModSettings._maxDifficulty, (float)ModSettings._difficultyStep, (float)ModSettings.Difficulty, OnDifficultyChanged) as UISlider;
            DifficultySlider.tooltip                = ModSettings.Difficulty.ToString() + "%";
            DifficultySlider.width                 += 100;
            RefreshRateSlider                       = group.AddSlider("Refresh Rate", 1f, (float)ModSettings._maxRefreshRate, 1f, (float)ModSettings.RefreshRate, OnRefreshRateChanged) as UISlider;
            RefreshRateSlider.tooltip               = ModSettings.RefreshRate.ToString() + " seconds";
            RefreshRateSlider.width                += 100;
            BuildingFloodingToleranceSlider         = group.AddSlider("Building Flooding Tol.", (float)ModSettings._minFloodTolerance, (float)ModSettings._maxFloodTolerance, (float)ModSettings._floodToleranceStep, (float)ModSettings.BuildingFloodingTolerance, OnBuildingFloodingToleranceChanged) as UISlider;
            BuildingFloodingToleranceSlider.tooltip = ((float)ModSettings.BuildingFloodingTolerance / 100f).ToString() + " units";
            BuildingFloodingToleranceSlider.width  += 100;
            BuildingFloodedToleranceSlider          = group.AddSlider("Building Flooded Tol.", (float)ModSettings._minFloodTolerance, (float)ModSettings._maxFloodTolerance, (float)ModSettings._floodToleranceStep, (float)ModSettings.BuildingFloodedTolerance, OnBuildingFloodedToleranceChanged) as UISlider;
            BuildingFloodedToleranceSlider.tooltip  = ((float)ModSettings.BuildingFloodedTolerance / 100f).ToString() + " units";
            BuildingFloodedToleranceSlider.width   += 100;
            RoadwayFloodingToleranceSlider          = group.AddSlider("Roadway Flooding Tol.", (float)ModSettings._minFloodTolerance, (float)ModSettings._maxFloodTolerance, (float)ModSettings._floodToleranceStep, (float)ModSettings.RoadwayFloodingTolerance, OnRoadwayFloodingToleranceChanged) as UISlider;
            RoadwayFloodingToleranceSlider.tooltip  = ((float)ModSettings.RoadwayFloodingTolerance / 100f).ToString() + " units";
            RoadwayFloodingToleranceSlider.width   += 100;
            RoadwayFloodedToleranceSlider           = group.AddSlider("Roadway Flooded Tol.", (float)ModSettings._minFloodTolerance, (float)ModSettings._maxFloodTolerance, (float)ModSettings._floodToleranceStep, (float)ModSettings.RoadwayFloodedTolerance, OnRoadwayFloodedToleranceChanged) as UISlider;
            RoadwayFloodedToleranceSlider.tooltip   = ((float)ModSettings.RoadwayFloodedTolerance / 100f).ToString() + " units";
            RoadwayFloodedToleranceSlider.width    += 100;

            PedestrianPathFloodingToleranceSlider         = group.AddSlider("Ped. Path Flooding Tol.", (float)ModSettings._minFloodTolerance, (float)ModSettings._maxFloodTolerance, (float)ModSettings._floodToleranceStep, (float)ModSettings.PedestrianPathFloodingTolerance, OnPedestrianPathFloodingToleranceChanged) as UISlider;
            PedestrianPathFloodingToleranceSlider.tooltip = ((float)ModSettings.PedestrianPathFloodingTolerance / 100f).ToString() + " units";
            PedestrianPathFloodingToleranceSlider.width  += 100;
            PedestrianPathFloodedToleranceSlider          = group.AddSlider("Ped. Path Flooded Tol.", (float)ModSettings._minFloodTolerance, (float)ModSettings._maxFloodTolerance, (float)ModSettings._floodToleranceStep, (float)ModSettings.PedestrianPathFloodedTolerance, OnPedestrianPathFloodedToleranceChanged) as UISlider;
            PedestrianPathFloodedToleranceSlider.tooltip  = ((float)ModSettings.PedestrianPathFloodedTolerance / 100f).ToString() + " units";
            PedestrianPathFloodedToleranceSlider.width   += 100;
            UIHelperBase StormWaterSimulationGroup = helper.AddGroup("Stormwater Simulation Settings");

            AutomaticallyPickStormDistributionCheckBox = StormWaterSimulationGroup.AddCheckbox("Automatically Select Storm Distribution", ModSettings.AutomaticStormDistribution, OnAutomaticStormDistributionCheckBoxChanged) as UICheckBox;
            cityNames                          = getCityNamesDropDownOptions();
            CityNameDropDown                   = StormWaterSimulationGroup.AddDropdown("City used for Depth-Duration-Frequency Data", cityNames, getCityNameIndex(ModSettings.CityName), OnCityNameDropDownChanged) as UIDropDown;
            stormDistributionNames             = getStormDistributionDropDownOptions();
            StormDistributionDropDown          = StormWaterSimulationGroup.AddDropdown("Storm Distribution", stormDistributionNames, getStormDistributionIndex(ModSettings.StormDistributionName), OnStormDistributionDropDownChanged) as UIDropDown;
            TimeScaleDropDown                  = StormWaterSimulationGroup.AddDropdown("Storm Simulation Time Scale Multiplier", TimeScalesString, getTimeScaleIndex(ModSettings.TimeScale), OnTimeScaleChanged) as UIDropDown;
            MinimumStormDurationSlider         = StormWaterSimulationGroup.AddSlider("Min. Storm Duration", ModSettings._minStormDuration, ModSettings._maxStormDuration, ModSettings._stormDurationStep, (float)ModSettings.MinimumStormDuration, onMinimumStormDurationChanged) as UISlider;
            MinimumStormDurationSlider.tooltip = convertMinToHourMin((float)ModSettings.MinimumStormDuration);
            MinimumStormDurationSlider.width  += 100;
            MaximumStormDurationSlider         = StormWaterSimulationGroup.AddSlider("Max. Storm Duration", ModSettings._minStormDuration, ModSettings._maxStormDuration, ModSettings._stormDurationStep, (float)ModSettings.MaximumStormDuration, onMaximumStormDurationChanged) as UISlider;

            MaximumStormDurationSlider.tooltip  = convertMinToHourMin((float)ModSettings.MaximumStormDuration);
            MaximumStormDurationSlider.width   += 100;
            MaximumStormIntensitySlider         = StormWaterSimulationGroup.AddSlider("Max. Intensity", ModSettings._minStormIntensity, ModSettings._maxStormIntensity, ModSettings._stormIntenistyStep, (float)ModSettings.MaximumStormIntensity, onMaximumStormIntensityChanged) as UISlider;
            MaximumStormIntensitySlider.tooltip = ModSettings.MaximumStormIntensity.ToString() + " Units/Hour";
            MaximumStormIntensitySlider.width  += 100;
            UIHelperBase PublicBuildingsRunOffCoefficientsGroup = helper.AddGroup("Public Buildings Runoff Coefficient Settings");

            initializeRunoffCoefficientSliders();
            createRunoffCoefficientSliders(PublicBuildingsRunOffCoefficientsGroup, PublicBuildingsRunoffCoefficientSliders);

            UIHelperBase PrivateBuildingsRunoffCoefficientsGroup = helper.AddGroup("Private Buildings Runoff Coefficient Settings");

            createRunoffCoefficientSliders(PrivateBuildingsRunoffCoefficientsGroup, PrivateBuildingsRunoffCoefficientSliders);

            UIHelperBase ResetGroup = helper.AddGroup("Reset");

            ResetAllButton = ResetGroup.AddButton("Reset All", resetAllSettings) as UIButton;

            UIHelperBase SafelyRemoveRainfallGroup = helper.AddGroup("Safely Remove Rainfall");

            DeleteAssetsButton = SafelyRemoveRainfallGroup.AddButton("Delete Rainfall Assets", deleteAllAssets) as UIButton;
            CleanUpCycleButton = SafelyRemoveRainfallGroup.AddButton("Clean Up Cycle", cleanUpCycle) as UIButton;
            EndStormButton     = SafelyRemoveRainfallGroup.AddButton("End Storm", endStorm) as UIButton;
        }
Beispiel #25
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                UIHelperBase group = helper.AddGroup(Name);
                UIPanel      panel = ((UIPanel)((UIHelper)group).self) as UIPanel;

                UICheckBox checkBox = (UICheckBox)group.AddCheckbox("Hide tips", MoveItTool.hideTips.value, (b) =>
                {
                    MoveItTool.hideTips.value = b;
                    if (UITipsWindow.instance != null)
                    {
                        UITipsWindow.instance.isVisible = false;
                    }
                });
                checkBox.tooltip = "Check this if you don't want to see the tips.";

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox("Auto-close Align Tools menu", MoveItTool.autoCloseAlignTools.value, (b) =>
                {
                    MoveItTool.autoCloseAlignTools.value = b;
                    if (UIAlignTools.AlignToolsPanel != null)
                    {
                        UIAlignTools.AlignToolsPanel.isVisible = false;
                    }
                });
                checkBox.tooltip = "Check this to close the Align Tools menu after choosing a tool.";

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox("Prefer fast, low-detail moving (hold Shift to temporarily switch)", MoveItTool.fastMove.value, (b) =>
                {
                    MoveItTool.fastMove.value = b;
                });
                checkBox.tooltip = "Helps you position objects when your frame-rate is poor.";

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox("Select pylons and pillars by holding Alt only", MoveItTool.altSelectNodeBuildings.value, (b) =>
                {
                    MoveItTool.altSelectNodeBuildings.value = b;
                });

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox("Use cardinal movements", MoveItTool.useCardinalMoves.value, (b) =>
                {
                    MoveItTool.useCardinalMoves.value = b;
                });
                checkBox.tooltip = "If checked, Up will move in the North direction, Down is South, Left is West, Right is East.";

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox("Right click cancels cloning", MoveItTool.rmbCancelsCloning.value, (b) =>
                {
                    MoveItTool.rmbCancelsCloning.value = b;
                });
                checkBox.tooltip = "If checked, Right click will cancel cloning instead of rotating 45°.";

                group.AddSpace(15);

                ((UIPanel)((UIHelper)group).self).gameObject.AddComponent <OptionsKeymappingMain>();

                group.AddSpace(15);

                UIButton button = (UIButton)group.AddButton("Remove Ghost Nodes", _cleanGhostNodes);
                button.tooltip = "Use this button when in-game to remove ghost nodes (nodes with no segments attached). Note: this will clear Move It's undo history!";

                group.AddSpace(20);

                checkBox = (UICheckBox)group.AddCheckbox("Disable debug messages logging", DebugUtils.hideDebugMessages.value, (b) =>
                {
                    DebugUtils.hideDebugMessages.value = b;
                });
                checkBox.tooltip = "If checked, debug messages won't be logged.";

                checkBox = (UICheckBox)group.AddCheckbox("Show Move It debug panel\n", MoveItTool.showDebugPanel.value, (b) =>
                {
                    MoveItTool.showDebugPanel.value = b;
                    if (MoveItTool.m_debugPanel != null)
                    {
                        MoveItTool.m_debugPanel.Visible(b);
                    }
                });
                checkBox.name = "MoveIt_DebugPanel";

                UILabel debugLabel = panel.AddUIComponent <UILabel>();
                debugLabel.name = "debugLabel";
                debugLabel.text = "Shows information about the last highlighted object. Slightly decreases\nperformance, do not enable unless you have a specific reason.\n ";

                group.AddSpace(5);

                if (!MoveItTool.HidePO)
                {
                    group = helper.AddGroup("Procedural Objects");
                    panel = ((UIPanel)((UIHelper)group).self) as UIPanel;

                    UILabel poLabel = panel.AddUIComponent <UILabel>();
                    poLabel.name = "poLabel";
                    poLabel.text = PO_Manager.getVersionText();

                    UILabel poWarning = panel.AddUIComponent <UILabel>();
                    poWarning.name = "poWarning";
                    poWarning.text = "Procedural Objects (PO) support is in beta. At present you can not clone PO objects, \n" +
                                     "redo Convert-to-PO actions or undo Bulldoze actions. This means if you delete PO objects \n" +
                                     "with Move It, they are immediately PERMANENTLY gone.\n ";

                    checkBox = (UICheckBox)group.AddCheckbox("Limit Move It to only PO objects selected in PO", MoveItTool.POOnlySelectedAreVisible.value, (b) =>
                    {
                        MoveItTool.POOnlySelectedAreVisible.value = b;
                        if (MoveItTool.PO != null)
                        {
                            MoveItTool.PO.ToolEnabled();
                        }
                    });
                    checkBox.tooltip = "If you have a lot of PO objects (250 or more), this is recommended.";

                    checkBox = (UICheckBox)group.AddCheckbox("Highlight unselected visible PO objects", MoveItTool.POHighlightUnselected.value, (b) =>
                    {
                        MoveItTool.POHighlightUnselected.value = b;
                        if (MoveItTool.PO != null)
                        {
                            MoveItTool.PO.ToolEnabled();
                        }
                    });
                    checkBox.tooltip = "Show a faded purple circle around PO objects that aren't selected.";

                    group.AddSpace(15);

                    panel.gameObject.AddComponent <OptionsKeymappingPO>();

                    group.AddSpace(15);
                }
            }
            catch (Exception e)
            {
                DebugUtils.Log("OnSettingsUI failed");
                DebugUtils.LogException(e);
            }
        }
Beispiel #26
0
        public static void Create(UIHelperBase helper)
        {
            if (helper.AddButton(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_SaveToDisk), new OnButtonClicked(() => UserModSettings.Save())) is UIButton saveToDiskButton)
            {
                saveToDiskButton.tooltip = LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_SaveToDisk_Tooltip);
            }

            helper.AddSpace(10);

            var core = helper.AddGroup(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Group_Core));
            {
                core.AddDropdown(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Core_Language), LocalisationHolder.Localisations.Select(localisation => localisation.ReadableName).ToArray(), LocalisationHolder.CurrentLocalisationIndex, new OnDropdownSelectionChanged(index => UserModSettings.Settings.Language = LocalisationHolder.Localisations[index].ReadableName));
                core.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Core_Enabled), UserModSettings.Settings.Enabled, new OnCheckChanged(value => UserModSettings.Settings.Enabled = value));
                core.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Core_ModifyCitizenBehaviour), UserModSettings.Settings.Citizens_Override, new OnCheckChanged(value => UserModSettings.Settings.Citizens_Override = value));
                core.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Core_ModifyTouristBehaviour), UserModSettings.Settings.Tourists_Override, new OnCheckChanged(value => UserModSettings.Settings.Tourists_Override = value));
            }

            var time = helper.AddGroup(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Group_Time));
            {
                time.AddSliderWithTooltip(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_SimulationSpeed), 0, 5, 1, 5f - (float)Math.Log((1f / UserModSettings.Settings.Simulation_Speed), 2), new OnValueChanged(value => UserModSettings.Settings.Simulation_Speed = 1f / (float)Math.Pow(2, (5 - value))), value =>
                {
                    var speed = Math.Pow(2, (5 - value));
                    return(speed > 1 ? $"1/{speed}x" : $"{1 / speed}x");
                });
                time.AddSpace(5);
                time.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Time_ModifyDateTimeBar), UserModSettings.Settings.DateTimeBar_Modify, new OnCheckChanged(value => UserModSettings.Settings.DateTimeBar_Modify = value));
                time.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Time_24hrTime), UserModSettings.Settings.Time_24Hour, new OnCheckChanged(value => UserModSettings.Settings.Time_24Hour = value));
            }

            var schoolHours = helper.AddGroup(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Group_School));
            {
                schoolHours.AddTimeSpanHoursSlider(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_School_StartTime), TimeSpan.FromHours(6), TimeSpan.FromHours(11), UserModSettings.Settings.StartTime_Schools, new OnValueChanged(value => UserModSettings.Settings.StartTime_Schools = TimeSpan.FromHours(value)));
                schoolHours.AddTimeSpanHoursSlider(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_School_Duration), TimeSpan.FromHours(5), TimeSpan.FromHours(15), UserModSettings.Settings.Duration_Schools, new OnValueChanged(value => UserModSettings.Settings.Duration_Schools    = TimeSpan.FromHours(value)), LocalisationHolder.CurrentLocalisation.Settings_School_DurationFormat);
            }

            var universityHours = helper.AddGroup(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Group_University));
            {
                universityHours.AddTimeSpanHoursSlider(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_University_StartTime), TimeSpan.FromHours(6), TimeSpan.FromHours(11), UserModSettings.Settings.StartTime_University, new OnValueChanged(value => UserModSettings.Settings.StartTime_University = TimeSpan.FromHours(value)));
                universityHours.AddTimeSpanHoursSlider(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_University_Duration), TimeSpan.FromHours(5), TimeSpan.FromHours(15), UserModSettings.Settings.Duration_University, new OnValueChanged(value => UserModSettings.Settings.Duration_University    = TimeSpan.FromHours(value)), LocalisationHolder.CurrentLocalisation.Settings_University_DurationFormat);
            }

            var workHours = helper.AddGroup(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Group_Work));
            {
                workHours.AddTimeSpanHoursSlider(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Work_StartTime), TimeSpan.FromHours(6), TimeSpan.FromHours(11), UserModSettings.Settings.StartTime_Work, new OnValueChanged(value => UserModSettings.Settings.StartTime_Work = TimeSpan.FromHours(value)));
                workHours.AddTimeSpanHoursSlider(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Work_Duration), TimeSpan.FromHours(5), TimeSpan.FromHours(15), UserModSettings.Settings.Duration_Work, new OnValueChanged(value => UserModSettings.Settings.Duration_Work    = TimeSpan.FromHours(value)), LocalisationHolder.CurrentLocalisation.Settings_Work_DurationFormat);
                workHours.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Work_AllowLeisure), UserModSettings.Settings.Citizens_AllowLeisureAfterWork, new OnCheckChanged(value => { UserModSettings.Settings.Citizens_AllowLeisureAfterWork = value; }));
            }

            var citizens = helper.AddGroup(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Group_Citizens));
            {
                citizens.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Citizens_ReactToWeather), UserModSettings.Settings.Citizens_ReactToWeather, new OnCheckChanged(value => { UserModSettings.Settings.Citizens_ReactToWeather = value; }));
            }

            var dangerZone = helper.AddGroup(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Group_DangerZone));
            {
                if (dangerZone.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_DangerZone_IgnoreVehiclePercentages), UserModSettings.Settings.Citizens_IgnoreVehicleCount, new OnCheckChanged(value => UserModSettings.Settings.Citizens_IgnoreVehicleCount = value)) is UICheckBox ignoreVehiclePercentagesCheckbox)
                {
                    ignoreVehiclePercentagesCheckbox.tooltip = LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_DangerZone_IgnoreVehiclePercentages_Tooltip);
                }

                if (dangerZone.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_DangerZone_EnableMessageBoxes), UserModSettings.Settings.MessageBoxes_Enabled, new OnCheckChanged(value => UserModSettings.Settings.MessageBoxes_Enabled = value)) is UICheckBox enableMessageBoxesCheckbox)
                {
                    enableMessageBoxesCheckbox.tooltip = string.Format(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_DangerZone_EnableMessageBoxes_Tooltip), Details.BaseModName);
                }
            }

            var logging = helper.AddGroup(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Group_Logging));
            {
                logging.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Logging_LogCitizenStatus), UserModSettings.Settings.Log_Citizen_Status, new OnCheckChanged(value => UserModSettings.Settings.Log_Citizen_Status = value));
                logging.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Logging_LogToFile), UserModSettings.Settings.Logging_ToFile, new OnCheckChanged(value => UserModSettings.Settings.Logging_ToFile          = value));
                logging.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Logging_LogToDebugPanel), UserModSettings.Settings.Logging_ToDebug, new OnCheckChanged(value => UserModSettings.Settings.Logging_ToDebug  = value));
                logging.AddCheckbox(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Logging_LogToConsole), UserModSettings.Settings.Logging_ToConsole, new OnCheckChanged(value => UserModSettings.Settings.Logging_ToConsole = value));
                logging.AddTimeSpanSecondsSlider(LocalisationHolder.Translate(LocalisationHolder.CurrentLocalisation.Settings_Logging_LogToFileInterval), TimeSpan.FromSeconds(1), TimeSpan.FromMinutes(2), UserModSettings.Settings.Logging_ToFile_Duration, new OnValueChanged(value => UserModSettings.Settings.Logging_ToFile_Duration = TimeSpan.FromSeconds(value)), LocalisationHolder.CurrentLocalisation.Settings_Logging_LogToFileIntervalFormat);
            }
        }
        public void OnSettingsUI(UIHelperBase helper)
        {
            DisastersContainer c = Singleton <EnhancedDisastersManager> .instance.container;

            UI_ForestFire_Enabled = (UICheckBox)helper.AddCheckbox("Enable Forest Fire", c.ForestFire.Enabled, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.ForestFire.Enabled = isChecked;
                }
            });
            UI_Thunderstorm_Enabled = (UICheckBox)helper.AddCheckbox("Enable Thunderstorm", c.Thunderstorm.Enabled, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.Thunderstorm.Enabled = isChecked;
                }
            });
            UI_Sinkhole_Enabled = (UICheckBox)helper.AddCheckbox("Enable Sinkhole", c.Sinkhole.Enabled, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.Sinkhole.Enabled = isChecked;
                }
            });
            UI_Tornado_Enabled = (UICheckBox)helper.AddCheckbox("Enable Tornado", c.Tornado.Enabled, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.Tornado.Enabled = isChecked;
                }
            });
            UI_Tsunami_Enabled = (UICheckBox)helper.AddCheckbox("Enable Tsunami", c.Tsunami.Enabled, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.Tsunami.Enabled = isChecked;
                }
            });
            UI_Earthquake_Enabled = (UICheckBox)helper.AddCheckbox("Enable Earthquake", c.Earthquake.Enabled, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.Earthquake.Enabled = isChecked;
                }
            });
            UI_MeteorStrike_Enabled = (UICheckBox)helper.AddCheckbox("Enable Meteor Strike", c.MeteorStrike.Enabled, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.MeteorStrike.Enabled = isChecked;
                }
            });

            helper.AddGroup(" "); // Adds horizontal line

            #region ForestFire

            UIHelperBase forestFireGroup = helper.AddGroup("Forest Fire disaster");

            ForestFireMaxProbabilityUI = (UISlider)forestFireGroup.AddSlider("Max probability", 1, 50, 1, c.ForestFire.BaseOccurrencePerYear, delegate(float val)
            {
                if (!freezeUI)
                {
                    c.ForestFire.BaseOccurrencePerYear = val;
                }
            });
            addLabelToSlider(ForestFireMaxProbabilityUI, " times per year");
            ForestFireMaxProbabilityUI.tooltip = "Occurrence (per year) in case of a long period without rain";

            UI_ForestFire_WarmupDays = (UISlider)forestFireGroup.AddSlider("Warmup period", 0, 360, 10, c.ForestFire.WarmupDays, delegate(float val)
            {
                if (!freezeUI)
                {
                    c.ForestFire.WarmupDays = (int)val;
                }
            });
            addLabelToSlider(UI_ForestFire_WarmupDays, " days");
            UI_ForestFire_WarmupDays.tooltip = "No-rain period during wich the probability of Forest Fire increases";

            helper.AddSpace(20);

            #endregion

            #region Thunderstorm

            UIHelperBase thunderstormGroup = helper.AddGroup("Thunderstorm disaster");

            UI_Thunderstorm_MaxProbability = (UISlider)thunderstormGroup.AddSlider("Max probability", 0.1f, 10f, 0.1f, c.Thunderstorm.BaseOccurrencePerYear, delegate(float val)
            {
                if (!freezeUI)
                {
                    c.Thunderstorm.BaseOccurrencePerYear = val;
                }
            });
            addLabelToSlider(UI_Thunderstorm_MaxProbability, " times per year");
            UI_Thunderstorm_MaxProbability.tooltip = "Occurrence (per year) in thunderstorm season";

            UI_Thunderstorm_MaxProbabilityMonth = (UIDropDown)thunderstormGroup.AddDropdown("Thunderstorm season peak",
                                                                                            Helper.GetMonths(),
                                                                                            c.Thunderstorm.MaxProbabilityMonth - 1,
                                                                                            delegate(int sel)
            {
                if (!freezeUI)
                {
                    c.Thunderstorm.MaxProbabilityMonth = sel + 1;
                }
            });

            UI_Thunderstorm_RainFactor = (UISlider)thunderstormGroup.AddSlider("Rain factor", 1f, 5f, 0.1f, c.Thunderstorm.RainFactor, delegate(float val)
            {
                if (!freezeUI)
                {
                    c.Thunderstorm.RainFactor = val;
                }
            });
            addLabelToSlider(UI_Thunderstorm_RainFactor);
            UI_Thunderstorm_RainFactor.tooltip = "Thunderstorm probability increases by this factor during rain.";

            helper.AddSpace(20);

            #endregion

            #region Sinkhole

            UIHelperBase sinkholeGroup = helper.AddGroup("Sinkhole disaster");

            UI_Sinkhole_MaxProbability = (UISlider)sinkholeGroup.AddSlider("Max probability", 0.1f, 10, 0.1f, c.Sinkhole.BaseOccurrencePerYear, delegate(float val)
            {
                if (!freezeUI)
                {
                    c.Sinkhole.BaseOccurrencePerYear = val;
                }
            });
            addLabelToSlider(UI_Sinkhole_MaxProbability, " times per year");
            UI_Sinkhole_MaxProbability.tooltip = "Occurrence (per year) in case of a long period of rain";

            UI_Sinkhole_GroundwaterCapacity = (UISlider)sinkholeGroup.AddSlider("Groundwater capacity", 1, 100, 1, c.Sinkhole.GroundwaterCapacity, delegate(float val)
            {
                if (!freezeUI)
                {
                    c.Sinkhole.GroundwaterCapacity = val;
                }
            });
            addLabelToSlider(UI_Sinkhole_GroundwaterCapacity);
            UI_Sinkhole_GroundwaterCapacity.tooltip = "Set how fast groundwater fills up during rain and causes a sinkhole to appear.";

            helper.AddSpace(20);

            #endregion

            #region Tornado

            UIHelperBase tornadoGroup = helper.AddGroup("Tornado disaster");

            UI_Tornado_MaxProbability = (UISlider)tornadoGroup.AddSlider("Max probability", 0.1f, 10f, 0.1f, c.Tornado.BaseOccurrencePerYear, delegate(float val)
            {
                if (!freezeUI)
                {
                    c.Tornado.BaseOccurrencePerYear = val;
                }
            });
            addLabelToSlider(UI_Tornado_MaxProbability, " times per year");
            UI_Tornado_MaxProbability.tooltip = "Occurrence (per year) in Tornado season";

            UI_Tornado_MaxProbabilityMonth = (UIDropDown)tornadoGroup.AddDropdown("Tornado season peak",
                                                                                  Helper.GetMonths(),
                                                                                  c.Tornado.MaxProbabilityMonth - 1,
                                                                                  delegate(int sel)
            {
                if (!freezeUI)
                {
                    c.Tornado.MaxProbabilityMonth = sel + 1;
                }
            });

            UI_Tornado_NoDuringFog = (UICheckBox)tornadoGroup.AddCheckbox("No Tornado during fog", c.Tornado.NoTornadoDuringFog, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.Tornado.NoTornadoDuringFog = isChecked;
                }
            });
            UI_Tornado_NoDuringFog.tooltip = "Tornado does not occur during foggy weather";

            helper.AddSpace(20);

            #endregion

            #region Tsunami

            UIHelperBase tsunamiGroup = helper.AddGroup("Tsunami disaster");

            UI_Tsunami_MaxProbability = (UISlider)tsunamiGroup.AddSlider("Max probability", 0.1f, 10, 0.1f, c.Tsunami.BaseOccurrencePerYear, delegate(float val)
            {
                if (!freezeUI)
                {
                    c.Tsunami.BaseOccurrencePerYear = val;
                }
            });
            addLabelToSlider(UI_Tsunami_MaxProbability, " times per year");
            UI_Tsunami_MaxProbability.tooltip = "Maximum occurrence (per year) after a long period without tsunamis";

            UI_Tsunami_WarmupYears = (UISlider)tsunamiGroup.AddSlider("Charge period", 0, 20, 0.5f, c.Tsunami.WarmupYears, delegate(float val)
            {
                if (!freezeUI)
                {
                    c.Tsunami.WarmupYears = val;
                }
            });
            addLabelToSlider(UI_Tsunami_WarmupYears, " years");
            UI_Tsunami_WarmupYears.tooltip = "The probability of tsunami increases to the maximum during this period";

            helper.AddSpace(20);

            #endregion

            #region Earthquake

            UIHelperBase earthquakeGroup = helper.AddGroup("Earthquake disaster");

            UI_Earthquake_MaxProbability = (UISlider)earthquakeGroup.AddSlider("Max probability", 0.1f, 10, 0.1f, c.Earthquake.BaseOccurrencePerYear, delegate(float val)
            {
                if (!freezeUI)
                {
                    c.Earthquake.BaseOccurrencePerYear = val;
                }
            });
            addLabelToSlider(UI_Earthquake_MaxProbability, " times per year");
            UI_Earthquake_MaxProbability.tooltip = "Maximum occurrence (per year) after a long period without earthquakes";

            UI_Earthquake_WarmupYears = (UISlider)earthquakeGroup.AddSlider("Charge period", 0, 20, 0.5f, c.Earthquake.WarmupYears, delegate(float val)
            {
                if (!freezeUI)
                {
                    c.Earthquake.WarmupYears = val;
                }
            });
            addLabelToSlider(UI_Earthquake_WarmupYears, " years");
            UI_Earthquake_WarmupYears.tooltip = "The probability of earthquake increases to the maximum during this period";

            UI_Earthquake_AftershocksEnabled = (UICheckBox)earthquakeGroup.AddCheckbox("Enable aftershocks", c.Earthquake.AftershocksEnabled, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.Earthquake.AftershocksEnabled = isChecked;
                }
            });
            UI_Earthquake_AftershocksEnabled.tooltip = "Several aftershocks may occur after a big earthquake. Aftershocks strike the same place.";

            UI_Earthquake_NoCrack = (UICheckBox)earthquakeGroup.AddCheckbox("No cracks in the ground", c.Earthquake.NoCracks, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.Earthquake.NoCracks = isChecked;
                }
                c.Earthquake.UpdateDisasterProperties(true);
            });
            UI_Earthquake_NoCrack.tooltip = "If checked, the earthquake does not put a crack in the ground.";

            helper.AddSpace(20);

            #endregion

            #region MeteorStrike

            UIHelperBase meteorStrikeGroup = helper.AddGroup("Meteor Strike disaster");

            UI_MeteorStrike_MaxProbability = (UISlider)meteorStrikeGroup.AddSlider("Max probability", 1f, 50, 1f, c.MeteorStrike.BaseOccurrencePerYear, delegate(float val)
            {
                if (!freezeUI)
                {
                    c.MeteorStrike.BaseOccurrencePerYear = val;
                }
            });
            addLabelToSlider(UI_MeteorStrike_MaxProbability, " times per year");
            UI_MeteorStrike_MaxProbability.tooltip = "Maximum occurrence of meteor strike per year per one meteor when it approaches the Earth";

            UI_MeteorStrike_Meteor1Enabled = (UICheckBox)meteorStrikeGroup.AddCheckbox("Enable long period (9 years) meteor", c.MeteorStrike.GetEnabled(0), delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.MeteorStrike.SetEnabled(0, isChecked);
                }
            });

            UI_MeteorStrike_Meteor2Enabled = (UICheckBox)meteorStrikeGroup.AddCheckbox("Enable medium period (5 years) meteor", c.MeteorStrike.GetEnabled(1), delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.MeteorStrike.SetEnabled(1, isChecked);
                }
            });

            UI_MeteorStrike_Meteor3Enabled = (UICheckBox)meteorStrikeGroup.AddCheckbox("Enable short period (2 years) meteor", c.MeteorStrike.GetEnabled(2), delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.MeteorStrike.SetEnabled(2, isChecked);
                }
            });

            helper.AddSpace(20);

            #endregion


            // Save buttons
            helper.AddButton("Save as default for new games", delegate()
            {
                Singleton <EnhancedDisastersManager> .instance.container.Save();
            });
            helper.AddButton("Reset to the last saved values", delegate()
            {
                Singleton <EnhancedDisastersManager> .instance.ReadValuesFromFile();
                EnhancedDisastersOptionsUpdateUI();
            });
            helper.AddButton("Reset to the mod default values", delegate()
            {
                Singleton <EnhancedDisastersManager> .instance.ResetToDefaultValues();
                EnhancedDisastersOptionsUpdateUI();
            });
            helper.AddSpace(20);

            UI_ScaleMaxIntensityWithPopilation = (UICheckBox)helper.AddCheckbox("Scale max intensity with population", c.ScaleMaxIntensityWithPopilation, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.ScaleMaxIntensityWithPopilation = isChecked;
                }
            });
            UI_ScaleMaxIntensityWithPopilation.tooltip = "Maximum intensity for all disasters is set to the minimum at the beginning of the game and gradually increases as the city grows.";

            UI_RecordDisasterEventsChkBox = (UICheckBox)helper.AddCheckbox("Record disaster events", c.RecordDisasterEvents, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.RecordDisasterEvents = isChecked;
                }
            });
            UI_RecordDisasterEventsChkBox.tooltip = "Write out disaster name, date of occurrence, and intencity into Disasters.csv file";

            UI_ShowDisasterPanelButton = (UICheckBox)helper.AddCheckbox("Show Disasters Panel toggle button", c.ShowDisasterPanelButton, delegate(bool isChecked)
            {
                if (!freezeUI)
                {
                    c.ShowDisasterPanelButton = isChecked;
                }

                Singleton <EnhancedDisastersManager> .instance.UpdateDisastersPanelToggleBtn();
            });

            helper.AddSpace(20);
        }
        public void OnSettingsUI(UIHelperBase helper)
        {
            Debug.Log("Settings initializing");
            ModLoader.config = Configuration.Deserialize(ModLoader.configFile);
            if (ModLoader.config == null)
            {
                ModLoader.config = new Configuration();
            }
            ModLoader.SaveConfig();
            Debug.Log("Config loaded.");

            #region RoadThemSelector
            packs = Singleton <RoadThemeManager> .instance.GetAvailablePacks();

            packNames = new List <string>();
            packNames.Add("Vanilla");
            packNames.AddRange(from pack in packs select pack.themeName);
            filteredPackNames = new List <string>();
            filteredPackNames = packNames;

            UIHelperBase uIHelperBase2 = helper.AddGroup("Road Themes");
            panel1   = (UIPanel)((UIPanel)((UIHelper)uIHelperBase2).self).parent;
            dropdown = (UIDropDown)uIHelperBase2.AddDropdown("Select Road Theme", RoadsUnited_CoreMod.filteredPackNames.ToArray(), ModLoader.config.selected_pack, delegate(int selectedIndex)
            {
                if (selectedIndex == 0)
                {
                    ModLoader.config.use_custom_textures = false;
                    RoadsUnited_Core.ApplyVanillaDictionary();
                    ModLoader.config.selected_pack = selectedIndex;
                    ModLoader.SaveConfig();
                }

                if (selectedIndex > 0)
                {
                    ModLoader.config.use_custom_textures = true;
                    ModLoader.config.selected_pack       = selectedIndex;
                    ModLoader.SaveConfig();
                    //RoadsUnited_CoreMod.infoText.text = RoadThemesUtil.GetDescription(RoadsUnited_CoreMod.packs.Find((RoadThemePack pack) => pack.themeName == RoadsUnited_CoreMod.filteredPackNames[RoadsUnited_CoreMod.dropdown.selectedIndex]));
                    //Debug.Log("Got description");
                    Singleton <RoadThemeManager> .instance.ActivePack = packs.Find((RoadThemePack pack) => pack.themeName == filteredPackNames[selectedIndex]);
                    Debug.Log("Set active pack");
                    ModLoader.SaveConfig();

                    //RoadsUnited_CoreMod.panel2.isVisible = true;
                }
                else
                {
                    Singleton <RoadThemeManager> .instance.ActivePack = null;
                    //RoadsUnited_CoreMod.panel2.isVisible = false;
                }
                RoadsUnited_CoreMod.selectedPackID = selectedIndex;
            });
            RoadsUnited_CoreMod.dropdown.width = 600f;
            if (RoadsUnited_CoreMod.dropdown.selectedIndex == 0)
            {
                //RoadsUnited_CoreMod.panel2.isVisible = false;
            }
            #endregion

            UIHelperBase uIHelperGeneralSettings = helper.AddGroup("General Settings");
            //uIHelperGeneralSettings.AddCheckbox("Use mods Vanilla roads texture replacements", ModLoader.config.use_custom_textures, EventCheckUseCustomTextures);
            uIHelperGeneralSettings.AddCheckbox("Disable road arrows pointing to the left, front and right.", ModLoader.config.disable_optional_arrow_lfr, EventDisableOptionalArrow_LFR);
            uIHelperGeneralSettings.AddCheckbox("Disable road arrows pointing left and right.", ModLoader.config.disable_optional_arrow_lr, EventDisableOptionalArrow_LR);

            //uIHelperGeneralSettings.AddCheckbox("Create Vanilla road texture backup on level load.", ModLoader.config.create_vanilla_dictionary, EventCheckCreateVanillaDictionary);
            //uIHelperGeneralSettings.AddButton("Mess with RgbAtlas", EventAtlas);
            //uIHelperGeneralSettings.AddButton("Revert to Vanilla textures (in-game only)", EventRevertVanillaTextures);
            //uIHelperGeneralSettings.AddButton("Reload selected mod's textures (in-game only)", EventReloadTextures);


            uIHelperGeneralSettings.AddButton("Reset all sliders and configuration next level load. ", EventResetConfig);

            //UIHelperBase uIHelperCrackedRoadsSettings = helper.AddGroup("Cracked roads");
            //uIHelperCrackedRoadsSettings.AddCheckbox("Use cracked roads.", ModLoader.config.use_cracked_roads, EventCheckCrack);
            //uIHelperCrackedRoadsSettings.AddSlider("Crack intensity", 0, 1f, 0.125f, ModLoader.config.crackIntensity, new OnValueChanged(EventSlideCrack));
            //uIHelperCrackedRoadsSettings.AddButton("Apply changes. Changes take time and use additional RAM.", EventReloadTextures);

            UIHelperBase uIHelperParkingSpaceSettings = helper.AddGroup("Parking space marking");
            uIHelperParkingSpaceSettings.AddDropdown("Small roads", new string[] { "No marking", "Parking spots" }, ModLoader.config.basic_road_parking, EventSmallRoadParking);
            uIHelperParkingSpaceSettings.AddDropdown("Medium roads", new string[] { "No marking", "Parking spots" }, ModLoader.config.medium_road_parking, EventMediumRoadParking);
            uIHelperParkingSpaceSettings.AddDropdown("Medium roads grass", new string[] { "No marking", "Parking spots" }, ModLoader.config.medium_road_grass_parking, EventMediumRoadGrassParking);
            uIHelperParkingSpaceSettings.AddDropdown("Medium roads trees", new string[] { "No marking", "Parking spots" }, ModLoader.config.medium_road_trees_parking, EventMediumRoadTreesParking);
            uIHelperParkingSpaceSettings.AddDropdown("Medium roads buslane", new string[] { "No marking", "Parking spots" }, ModLoader.config.medium_road_bus_parking, EventMediumRoadBusParking);
            uIHelperParkingSpaceSettings.AddDropdown("Large roads", new string[] { "No marking", "Parking spots" }, ModLoader.config.large_road_parking, EventLargeRoadParking);
            uIHelperParkingSpaceSettings.AddDropdown("Large roads buslane", new string[] { "No marking", "Parking spots" }, ModLoader.config.large_road_bus_parking, EventLargeRoadBusParking);
            uIHelperParkingSpaceSettings.AddDropdown("Large Oneways", new string[] { "No marking", "Parking spots" }, ModLoader.config.large_oneway_parking, EventLargeOnewayParking);
            uIHelperParkingSpaceSettings.AddSpace(10);

            UIHelperBase uIHelperRoadColorSettings = helper.AddGroup("Road brightness settings");
            uIHelperRoadColorSettings.AddCheckbox("Use the road brightness sliders below. Changes only visible after next level loading.", ModLoader.config.use_custom_colors, EventCheckUseCustomColors);

            UIHelperBase uIHelperSmallRoads = helper.AddGroup("Small Roads");
            uIHelperSmallRoads.AddSlider("Standard", 0.2f, 0.8f, 0.05f, ModLoader.config.small_road_brightness, new OnValueChanged(EventSmallRoadBrightness));
            uIHelperSmallRoads.AddSlider("Decoration (grass and trees)", 0.2f, 0.8f, 0.05f, ModLoader.config.small_road_decoration, new OnValueChanged(EventSmallRoadDecorationBrightness));

            UIHelperBase uIHelperMediumRoads = helper.AddGroup("Medium Roads");
            uIHelperMediumRoads.AddSlider("Standard", 0.2f, 0.8f, 0.05f, ModLoader.config.medium_road_brightness, new OnValueChanged(EventMediumRoadBrightness));
            uIHelperMediumRoads.AddSlider("Decoration (grass and trees)", 0.2f, 0.8f, 0.05f, ModLoader.config.medium_road_decoration_brightness, new OnValueChanged(EventMediumRoadDecorationBrightness));

            UIHelperBase uIHelperLargeRoads = helper.AddGroup("Large Roads");
            uIHelperLargeRoads.AddSlider("Standard", 0.2f, 0.8f, 0.05f, ModLoader.config.large_road_brightness, new OnValueChanged(EventLargeRoadBrightness));
            uIHelperLargeRoads.AddSlider("Decoration (grass and trees)", 0.2f, 0.8f, 0.05f, ModLoader.config.large_road_decoration_brightness, new OnValueChanged(EventLargeRoadDecorationBrightness));

            UIHelperBase uIHelperHighways = helper.AddGroup("Highways");
            uIHelperHighways.AddSlider("Standard", 0.2f, 0.8f, 0.05f, ModLoader.config.highway_brightness, new OnValueChanged(EventHighwayBrightness));
            uIHelperHighways.AddSlider("NExt National Road", 0.2f, 0.8f, 0.05f, ModLoader.config.highway_national_brightness, new OnValueChanged(EventHighwayNationalBrightness));
        }
Beispiel #29
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);
            }
        }