예제 #1
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                AdvancedVehicleOptions.LoadConfig();

                UICheckBox   checkBox;
                UIHelperBase group = helper.AddGroup(Name);

                checkBox = (UICheckBox)group.AddCheckbox("Hide the user interface", AdvancedVehicleOptions.config.hideGUI, (b) =>
                {
                    if (AdvancedVehicleOptions.config.hideGUI != b)
                    {
                        AdvancedVehicleOptions.hideGUI = b;
                        AdvancedVehicleOptions.SaveConfig();
                    }
                });
                checkBox.tooltip = "Hide the UI completely if you feel like you are done with it\nand want to save the little bit of memory it takes\nEverything else will still be functional";

                checkBox = (UICheckBox)group.AddCheckbox("Disable warning at map loading", !AdvancedVehicleOptions.config.onLoadCheck, (b) =>
                {
                    if (AdvancedVehicleOptions.config.onLoadCheck == b)
                    {
                        AdvancedVehicleOptions.config.onLoadCheck = !b;
                        AdvancedVehicleOptions.SaveConfig();
                    }
                });
                checkBox.tooltip = "Disable service vehicle availability check at the loading of a map";
            }
            catch (Exception e)
            {
                DebugUtils.Log("OnSettingsUI failed");
                DebugUtils.LogException(e);
            }
        }
예제 #2
0
        public static void OnSettingsUI(UIHelperBase helper)
        {
            LoadSetting();
            UIHelperBase roadColorGroup = helper.AddGroup(Localization.Get("road_color_setting"));

            ColorRSlider = roadColorGroup.AddSlider("R" + "(" + colorR.ToString() + ")", 0, 255, 1, colorR, OnRedSliderChanged) as UISlider;
            ColorRSlider.parent.Find <UILabel>("Label").width = 500f;
            ColorGSlider = roadColorGroup.AddSlider("G" + "(" + colorG.ToString() + ")", 0, 255, 1, colorG, OnGreenSliderChanged) as UISlider;
            ColorGSlider.parent.Find <UILabel>("Label").width = 500f;
            ColorBSlider = roadColorGroup.AddSlider("B" + "(" + colorB.ToString() + ")", 0, 255, 1, colorB, OnBlueSliderChanged) as UISlider;
            ColorBSlider.parent.Find <UILabel>("Label").width = 500f;
            roadColorGroup.AddCheckbox(Localization.Get("change_all_sliders"), grayscale, (index) => OnGrayscaleSet(index));
            roadColorGroup.AddCheckbox(Localization.Get("change_other_color"), changeAllRoadColor, (index) => OnChangeAllRoadColorSet(index));
            UIHelperBase roadSkinGroup = helper.AddGroup(Localization.Get("road_prop_setting"));

            roadSkinGroup.AddDropdown(Localization.Get("road_arrows"), RoadSkins.roadArrowsAvailable, RoadSkins.iroadArrow, (index) => OnRoadArrowSet(index));
            roadSkinGroup.AddDropdown(Localization.Get("traffic_lights"), RoadSkins.trafficLightsAvailable, RoadSkins.itrafficLight, (index) => OnTrafficLightSet(index));
            roadSkinGroup.AddDropdown(Localization.Get("median_signs"), RoadSkins.medianSignsAvailable, RoadSkins.imedianSign, (index) => OnMedianSignSet(index));
            roadSkinGroup.AddCheckbox(Localization.Get("traffic_cameras"), RoadSkins.useCamera, (index) => OnCameraSet(index));


            UIHelperBase policyToggleGroup = helper.AddGroup(Localization.Get("district_policy_setting"));

            policyToggleGroup.AddCheckbox(Localization.Get("tip1"),
                                          RoadSkins.policyToggleExpressWalls, (index) => OnToggleExpressWallsSet(index));
            policyToggleGroup.AddCheckbox(Localization.Get("tip2"),
                                          RoadSkins.policyInvertUnderground, (index) => OnPolicyInvertUndergroundSet(index));


            SaveSetting();
        }
예제 #3
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            Version  version = typeof(Localization).Assembly.GetName().Version;
            DateTime date    = new DateTime(2000, 1, 1)
                               .AddDays(version.Build)
                               .AddSeconds(version.Revision * 2);
            UIHelperBase group = helper.AddGroup($"{Name} (v{version} - {date.ToString("MMMM dd, yyyy")})");

            group.AddDropdown("Display", Enum.GetNames(typeof(ModConfig.DisplayCategory)), (int)ModConfig.Instance.Display, sel =>
            {
                ModConfig.Instance.Display = (ModConfig.DisplayCategory)sel;
                ModConfig.Instance.Save();
            });
            group.AddSlider("Opacity", 0.5f, 1f, 0.05f, ModConfig.Instance.Opacity, sel =>
            {
                ModConfig.Instance.Opacity = sel;
                ModConfig.Instance.Save();
            });
            helper.AddCheckbox("Enable random building names", ModConfig.Instance.EnableNames, enableName =>
            {
                ModConfig.Instance.EnableNames = enableName;
                ModConfig.Instance.Save();
            });
            helper.AddCheckbox("Enable random building descriptions", ModConfig.Instance.EnableDescriptions, enableDesc =>
            {
                ModConfig.Instance.EnableDescriptions = enableDesc;
                ModConfig.Instance.Save();
            });
        }
        public void OnSettingsUI(UIHelperBase helper)
        {
            this.InitConfigFile();
            UIHelperBase group = helper.AddGroup(Translation.GetString("Settings"));

            group.AddCheckbox(Translation.GetString("RemoveConfusedVehicles"), ModConf.RemoveConfusedVehicles, delegate(bool isChecked)
            {
                Identity.ModConf.RemoveConfusedVehicles = isChecked;
                if (isChecked)
                {
                    Remover._baselined = false;
                }
                ModConfiguration.Serialize(Identity.configPath, Identity.ModConf);
            });
            group.AddCheckbox(Translation.GetString("RemoveBlockedVehicles"), ModConf.RemoveBlockedVehicles, delegate(bool isChecked)
            {
                Identity.ModConf.RemoveBlockedVehicles = isChecked;
                if (isChecked)
                {
                    Remover._baselined = false;
                }
                ModConfiguration.Serialize(Identity.configPath, Identity.ModConf);
            });
            group.AddCheckbox(Translation.GetString("RemoveConfusedCitizensVehicles"), ModConf.RemoveConfusedCitizensVehicles, delegate(bool isChecked)
            {
                Identity.ModConf.RemoveConfusedCitizensVehicles = isChecked;
                if (isChecked)
                {
                    Remover._baselined = false;
                }
                ModConfiguration.Serialize(Identity.configPath, Identity.ModConf);
            });
        }
예제 #5
0
        private void AddOptionsUI(UIHelperBase helper)
        {
            ModOptions options = ModOptions.Instance;

            helper.AddCheckbox("Enable playlist*",
                               options.EnableCustomUI,
                               new OnCheckChanged((bool isChecked) =>
            {
                options.EnableCustomUI = isChecked;
            }));
            helper.AddCheckbox("Improved radio station selection (needs reload)",
                               options.EnableImprovedRadioStationList,
                               new OnCheckChanged((bool isChecked) =>
            {
                options.EnableImprovedRadioStationList = isChecked;
            }));
            helper.AddCheckbox("Open station directory button (needs reload)",
                               options.EnableOpenStationDirButton,
                               new OnCheckChanged((bool isChecked) =>
            {
                options.EnableOpenStationDirButton = isChecked;
            }));
            helper.AddCheckbox("Checkboxes to disable content",
                               options.ImprovedDisableContentUI,
                               new OnCheckChanged((bool isChecked) =>
            {
                options.ImprovedDisableContentUI = isChecked;
            }));
        }
예제 #6
0
        /// <summary>
        /// Called by the game when the mod options panel is setup.
        /// </summary>
        public void OnSettingsUI(UIHelperBase helper)
        {
            // Read configuration file.
            SettingsFile settingsFile = Configuration<SettingsFile>.Load();

            // Add logging checkbox.
            helper.AddCheckbox(Translations.Translate("PRR_OPTION_MOREDEBUG"), settingsFile.DebugLogging, isChecked =>
            {
                Settings.debugLogging = isChecked;
                settingsFile.DebugLogging = isChecked;
                Configuration<SettingsFile>.Save();
            });

            // Add reset on load checkbox.
            helper.AddCheckbox(Translations.Translate("PRR_OPTION_FORCERESET"), settingsFile.ResetOnLoad, isChecked =>
            {
                settingsFile.ResetOnLoad = isChecked;
                Configuration<SettingsFile>.Save();
            });

            // Add thumbnail background checkbox.
            helper.AddCheckbox(Translations.Translate("PRR_OPTION_PLAINTHUMBS"), settingsFile.PlainThumbs, isChecked =>
            {
                Settings.plainThumbs = isChecked;
                settingsFile.PlainThumbs = isChecked;
                Configuration<SettingsFile>.Save();
            });

            // Add regenerate thumbnails button.
            helper.AddButton(Translations.Translate("PRR_OPTION_REGENTHUMBS"), () => PloppableTool.Instance.RebuildButtons());
        }
예제 #7
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            float ScrollSpeedf = (float)MyConfig.ConfigHolder.Config.ScrollSpeed;

            UIHelperBase group = helper.AddGroup("ChirpBanner+ Options");

            group.AddCheckbox("Hide built-in Chirper", MyConfig.ConfigHolder.Config.DestroyBuiltinChirper, CheckHideChirper);
            group.AddCheckbox("Filter out unimportant Chirps", MyConfig.ConfigHolder.Config.FilterChirps, CheckFilterChirper);
            group.AddCheckbox("Make important Chirps red", MyConfig.ConfigHolder.Config.ColorChirps, CheckColorChirper);
            group.AddSlider("Scroll Speed", 50, 200, 1.0f, ScrollSpeedf, CheckScrollSpeed);
            //group.AddSlider ("Chirp Size", 5, 100, 1.0f, ChirpyBanner.CurrentConfig.TextSize, CheckChirpSize);
            group.AddSlider("Transparency", 0.1f, 1, 0.10f, MyConfig.ConfigHolder.Config.BackgroundAlpha, CheckTransparency);
            //group.AddSlider ("Banner Width", 0, 1, 0.10f, MyConfig.ConfigHolder.Config.BannerWidth, CheckWidth);

            UIHelperBase colors = helper.AddGroup("Colors must start with # and be in 8-digit hex form");

            colors.AddTextfield("Name Color", MyConfig.ConfigHolder.Config.NameColor, CheckChirpNameColor, CheckChirpNameColor);
            colors.AddTextfield("Chirp Color", MyConfig.ConfigHolder.Config.MessageColor, CheckChirpMsgColor, CheckChirpMsgColor);

            //UIHelperBase version = helper.AddGroup ("v2.5.0");

            //group.AddSlider("My Slider", 0, 1, 0.01f, 0.5f, EventSlide);
            //group.AddDropdown("My Dropdown", new string[] { "First Entry", "Second Entry", "Third Entry" }, -1, EventSel);
            //group.AddSpace(250);
            //group.AddButton("My Button", EventClick);
            //group.AddTextfield ("My Textfield", "Default value", EventTextChanged, EventTextSubmitted);
        }
예제 #8
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                UICheckBox   checkBox;
                UIHelperBase group = helper.AddGroup(Name);

                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.";

                group.AddSpace(10);

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

                checkBox = (UICheckBox)group.AddCheckbox("Disable warning at map loading", !AdvancedVehicleOptions.onLoadCheck.value, (b) =>
                {
                    AdvancedVehicleOptions.onLoadCheck.value = !b;
                });
                checkBox.tooltip = "Disable service vehicle availability check at the loading of a map";
            }
            catch (Exception e)
            {
                DebugUtils.Log("OnSettingsUI failed");
                DebugUtils.LogException(e);
            }
        }
예제 #9
0
 public void OnSettingsUI(UIHelperBase helper)
 {
     helper.AddCheckbox("Use Blacklists", Settings.UseBlacklists, (isChecked) => Settings.UseBlacklists = isChecked);
     helper.AddCheckbox("Use Namelists", Settings.UseNamelists, (isChecked) => Settings.UseNamelists    = isChecked);
     helper.AddButton("Export Complete Namelist", NameListManager.PrintLocale);
     helper.AddButton("Apply Changes", LocaleManager.ForceReload);
 }
예제 #10
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            UIHelperBase group_enable = helper.AddGroup("Enable Settings");

            group_enable.AddCheckbox("Enable Mod", BMParameters.instance.m_enable_mod, (isChecked) => {
                BMParameters.instance.m_enable_mod = isChecked;
            });
            group_enable.AddCheckbox("Enable Water Budget", BMParameters.instance.m_enable_water, (isChecked) =>
            {
                BMParameters.instance.m_enable_water = isChecked;
            });
            group_enable.AddCheckbox("Enable Electricity Budget", BMParameters.instance.m_enable_electricity, (isChecked) =>
            {
                BMParameters.instance.m_enable_electricity = isChecked;
            });
            group_enable.AddCheckbox("Enable Education Budget", BMParameters.instance.m_enable_electricity, (isChecked) =>
            {
                BMParameters.instance.m_enable_electricity = isChecked;
            });

            UIHelperBase group_offsets = helper.AddGroup("Offset Controls");

            group_offsets.AddSlider("Water Offset", -1.0f, +1.0f, 0.01f, (float)BMParameters.instance.WaterOffset, (value) =>
            {
                BMParameters.instance.WaterOffset = value;
            });
            group_offsets.AddSlider("Electricity Offset", -1.0f, +1.0f, 0.01f, (float)BMParameters.instance.ElectricityOffset, (value) =>
            {
                BMParameters.instance.ElectricityOffset = value;
            });
            group_offsets.AddSlider("Education Offset", -1.0f, +1.0f, 0.01f, (float)BMParameters.instance.EducationOffset, (value) =>
            {
                BMParameters.instance.EducationOffset = value;
            });
        }
예제 #11
0
        public static float someValue9 = 0.8f;              // 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") + " (BETA feature)", 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;
#if DEBUG
            //if (SystemInfo.processorCount >= DYNAMIC_RECALC_MIN_PROCESSOR_COUNT)
            dynamicPathRecalculationToggle = aiGroup.AddCheckbox(Translation.GetString("Enable_dynamic_path_calculation"), dynamicPathRecalculation, onDynamicPathRecalculationChanged) as UICheckBox;
#endif
            highwayRulesToggle = aiGroup.AddCheckbox(Translation.GetString("Enable_highway_specific_lane_merging/splitting_rules"), highwayRules, onHighwayRulesChanged) as UICheckBox;
#if DEBUG
            preferOuterLaneToggle = aiGroup.AddCheckbox(Translation.GetString("Prefer_outer_lane") + " (BETA feature)", preferOuterLane, onPreferOuterLaneChanged) as UICheckBox;
#endif
            //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;
            connectedLanesOverlayToggle      = overlayGroup.AddCheckbox(Translation.GetString("Connected_lanes"), connectedLanesOverlay, onConnectedLanesOverlayChanged) as UICheckBox;
            nodesOverlayToggle = overlayGroup.AddCheckbox(Translation.GetString("Nodes_and_segments"), nodesOverlay, onNodesOverlayChanged) as UICheckBox;
            showLanesToggle    = overlayGroup.AddCheckbox(Translation.GetString("Lanes"), showLanes, onShowLanesChanged) as UICheckBox;
#if DEBUG
            vehicleOverlayToggle = overlayGroup.AddCheckbox(Translation.GetString("Vehicles"), vehicleOverlay, onVehicleOverlayChanged) as UICheckBox;
#endif
            maintenanceGroup       = helper.AddGroup(Translation.GetString("Maintenance"));
            forgetTrafficLightsBtn = maintenanceGroup.AddButton(Translation.GetString("Forget_toggled_traffic_lights"), onClickForgetToggledLights) as UIButton;
#if DEBUG
            resetSpeedLimitsBtn         = maintenanceGroup.AddButton(Translation.GetString("Reset_custom_speed_limits"), onClickResetSpeedLimits) as UIButton;
            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;
            someValue5Field = maintenanceGroup.AddTextfield("Some value #5", String.Format("{0:0.##}", someValue5), onSomeValue5Changed) as UITextField;
            someValue6Field = maintenanceGroup.AddTextfield("Some value #6", String.Format("{0:0.##}", someValue6), onSomeValue6Changed) as UITextField;
            someValue7Field = maintenanceGroup.AddTextfield("Some value #7", String.Format("{0:0.##}", someValue7), onSomeValue7Changed) as UITextField;
            someValue8Field = maintenanceGroup.AddTextfield("Some value #8", String.Format("{0:0.##}", someValue8), onSomeValue8Changed) as UITextField;
            someValue9Field = maintenanceGroup.AddTextfield("Some value #9", String.Format("{0:0.##}", someValue9), onSomeValue9Changed) as UITextField;
#endif
        }
예제 #12
0
        /// <summary>
        /// Adds growable options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        internal ComplaintOptions(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab and helper.
            UIPanel  panel  = PanelUtils.AddTab(tabStrip, Translations.Translate("PRR_OPTION_COM"), tabIndex);
            UIHelper helper = new UIHelper(panel);

            panel.autoLayout = true;

            // Add 'ignore low value complaint' checkboxes.
            UIHelperBase valueGroup      = helper.AddGroup(Translations.Translate("PRR_OPTION_VAL"));
            UICheckBox   noValueRicoPlop = (UICheckBox)valueGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RPL"), ModSettings.noValueRicoPlop, isChecked =>
            {
                ModSettings.noValueRicoPlop = isChecked;
                SettingsUtils.SaveSettings();
            });

            valueGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RCO"), ModSettings.noValueRicoGrow, isChecked =>
            {
                ModSettings.noValueRicoGrow = isChecked;
                SettingsUtils.SaveSettings();

                // If this is active, then the checkbox above also needs to be checked if it isn't already.
                if (isChecked && !noValueRicoPlop.isChecked)
                {
                    noValueRicoPlop.isChecked = true;
                }
            });
            valueGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.noValueOther, isChecked =>
            {
                ModSettings.noValueOther = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Add 'ignore too few services complaint' checkboxes.
            UIHelperBase servicesGroup      = helper.AddGroup(Translations.Translate("PRR_OPTION_SVC"));
            UICheckBox   noServicesRicoPlop = (UICheckBox)servicesGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RPL"), ModSettings.noServicesRicoPlop, isChecked =>
            {
                ModSettings.noServicesRicoPlop = isChecked;
                SettingsUtils.SaveSettings();
            });

            servicesGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RCO"), ModSettings.noServicesRicoGrow, isChecked =>
            {
                ModSettings.noServicesRicoGrow = isChecked;
                SettingsUtils.SaveSettings();

                // If this is active, then the checkbox above also needs to be checked if it isn't already.
                if (isChecked && !noServicesRicoPlop.isChecked)
                {
                    noServicesRicoPlop.isChecked = true;
                }
            });
            servicesGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.noServicesOther, isChecked =>
            {
                ModSettings.noServicesOther = isChecked;
                SettingsUtils.SaveSettings();
            });
        }
예제 #13
0
        public void CreateSettings(UIHelperBase helper)
        {
            UIHelperBase group = helper.AddGroup("Traffic++ V2 Options");

            group.AddCheckbox(
                "Road Customizer Tool",
                TrafficMod.Options.IsFlagSet(ModOptions.RoadCustomizerTool),
                isChecked =>
            {
                if (isChecked)
                {
                    TrafficMod.Options |= ModOptions.RoadCustomizerTool;
                }
                else
                {
                    TrafficMod.Options &= ~ModOptions.RoadCustomizerTool;
                }

                Save();
            });

            group.AddCheckbox(
                "No Despawn by CBeTHaX",
                TrafficMod.Options.IsFlagSet(ModOptions.NoDespawn),
                isChecked =>
            {
                if (isChecked)
                {
                    TrafficMod.Options |= ModOptions.NoDespawn;
                }
                else
                {
                    TrafficMod.Options &= ~ModOptions.NoDespawn;
                }

                Save();
            });

            group.AddCheckbox(
                "Realistic Speeds",
                TrafficMod.Options.IsFlagSet(ModOptions.UseRealisticSpeeds),
                isChecked =>
            {
                if (isChecked)
                {
                    TrafficMod.Options |= ModOptions.UseRealisticSpeeds;
                }
                else
                {
                    TrafficMod.Options &= ~ModOptions.UseRealisticSpeeds;
                }

                Save();
            });
        }
 public void AddOptions(UIHelperBase group)
 {
     LoadSettings();
     foreach (var id in exportables.Keys)
     {
         Exportable exp = exportables [id];
         group.AddCheckbox(exp.Description, exp.GetEnabled(), exp.SetEnabled);
     }
     group.AddSlider("Multiplier", 0.0f, 2.0f, 0.05f, multiplier, MultiplierSliderChanged);
     group.AddCheckbox("Debug Mode", ExportElectricityMod.Debugger.enabled, SetDebug);
 }
예제 #15
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            UIHelperBase group = helper.AddGroup("Building Themes");

            group.AddCheckbox("Unlock Policies Panel From Start", PolicyPanelEnabler.Unlock, delegate(bool c) { PolicyPanelEnabler.Unlock = c; });
            group.AddCheckbox("Create Prefab Duplicates (required for some themes)", BuildingVariationManager.Enabled, delegate(bool c) { BuildingVariationManager.Enabled = c; });
            group.AddGroup("Warning: When you disable this option, spawned duplicates will disappear!");

            group.AddCheckbox("Warning message when selecting an invalid theme", UIThemePolicyItem.showWarning, delegate(bool c) { UIThemePolicyItem.showWarning = c; });
            group.AddCheckbox("Generate Debug Output", Debugger.Enabled, delegate(bool c) { Debugger.Enabled = c; });
        }
        internal static void MakeSettings_VehicleRestrictions(ExtUITabstrip tabStrip)
        {
            UIHelper panelHelper = tabStrip.AddTabPage(Translation.Options.Get("Tab:Policies & Restrictions"));

            PoliciesTab_AtJunctionsGroup.AddUI(panelHelper);

            UIHelperBase onRoadsGroup =
                panelHelper.AddGroup(Translation.Options.Get("VR.Group:On roads"));

            _vehicleRestrictionsAggressionDropdown
                = onRoadsGroup.AddDropdown(
                      Translation.Options.Get("VR.Dropdown:Vehicle restrictions aggression") + ":",
                      new[] {
                Translation.Options.Get("VR.Dropdown.Option:Low Aggression"),
                Translation.Options.Get("VR.Dropdown.Option:Medium Aggression"),
                Translation.Options.Get("VR.Dropdown.Option:High Aggression"),
                Translation.Options.Get("VR.Dropdown.Option:Strict"),
            },
                      (int)Options.vehicleRestrictionsAggression,
                      OnVehicleRestrictionsAggressionChanged) as UIDropDown;
            _banRegularTrafficOnBusLanesToggle
                = onRoadsGroup.AddCheckbox(
                      Translation.Options.Get("VR.Checkbox:Ban private cars and trucks on bus lanes"),
                      Options.banRegularTrafficOnBusLanes,
                      OnBanRegularTrafficOnBusLanesChanged) as UICheckBox;
            _highwayRulesToggle
                = onRoadsGroup.AddCheckbox(
                      Translation.Options.Get("VR.Checkbox:Enable highway merging/splitting rules"),
                      Options.highwayRules,
                      OnHighwayRulesChanged) as UICheckBox;
            _preferOuterLaneToggle
                = onRoadsGroup.AddCheckbox(
                      Translation.Options.Get("VR.Checkbox:Heavy trucks prefer outer lanes on highways"),
                      Options.preferOuterLane,
                      OnPreferOuterLaneChanged) as UICheckBox;

            if (SteamHelper.IsDLCOwned(SteamHelper.DLC.NaturalDisastersDLC))
            {
                UIHelperBase inCaseOfEmergencyGroup =
                    panelHelper.AddGroup(
                        Translation.Options.Get("VR.Group:In case of emergency/disaster"));

                _evacBussesMayIgnoreRulesToggle
                    = inCaseOfEmergencyGroup.AddCheckbox(
                          Translation.Options.Get("VR.Checkbox:Evacuation buses may ignore traffic rules"),
                          Options.evacBussesMayIgnoreRules,
                          OnEvacBussesMayIgnoreRulesChanged) as UICheckBox;
            }

            NoDoubleCrossings.AddUI(onRoadsGroup);

            OptionsMassEditTab.MakePanel_MassEdit(panelHelper);
        }
예제 #17
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.AddCheckbox(Localization.Get("ENABLE_RANDOM_EVENT"), RealCity.randomEvent, (index) => randomEventEnable(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"));
            }

            SaveSetting();
        }
        public static void OnSettingsUI(UIHelperBase helper)
        {
#if DEBUG
            Debug.Log("Make settings was called");
#endif
            helper.AddCheckbox("overwrite terrain appearance", EraseClipping, (isChecked) => { EraseClipping.value = isChecked; SubstituteTextureManager.RegenerateCache(); });
            var modeDropdown = helper.AddDropdown("operating mode", Enum.GetNames(typeof(Modes)), Mode.value, (value) => { Mode.value = value; SubstituteTextureManager.RegenerateCache(); }) as UIDropDown;
            void OnStrengthChanged(int strength, bool apply)
            {
                strengthSlider.value = strength;
                strengthNumber.text  = strength.ToString();
                if (apply && strength != Strength.value)
                {
                    Strength.value = strength;
                    if ((Modes)Mode.value != Modes.Erase)
                    {
                        SubstituteTextureManager.RegenerateCache();
                    }
                }
            }

            var mainPanel     = modeDropdown.parent.parent as UIScrollablePanel;
            var strengthPanel = mainPanel.AddUIComponent <UIPanel>();
            strengthPanel.autoLayout = true;
            strengthPanel.autoFitChildrenHorizontally = true;
            strengthPanel.autoFitChildrenVertically   = true;
            strengthPanel.autoLayoutDirection         = LayoutDirection.Vertical;
            var strengthLabel = strengthPanel.AddUIComponent <UILabel>();
            strengthLabel.text      = "strength";
            strengthLabel.textScale = 1.125f;
            var strengthRow = strengthPanel.AddUIComponent <UIPanel>();
            strengthRow.autoLayout = true;
            strengthRow.autoFitChildrenHorizontally = true;
            strengthRow.autoFitChildrenVertically   = true;
            strengthRow.autoLayoutDirection         = LayoutDirection.Horizontal;
            strengthRow.autoLayoutPadding           = new RectOffset(0, 8, 0, 0);
            strengthSlider = createSlider(helper, 0, MaxStrength, 1, Strength, (value) => { OnStrengthChanged(Mathf.RoundToInt(value), false); });
            strengthRow.AttachUIComponent(strengthSlider.gameObject);
            strengthNumber = createTextField(helper, Strength.value.ToString(), (_) => { }, (value) => { OnStrengthChanged(Util.LenientStringToInt(value, 0, MaxStrength, Strength.value), true); });
            strengthRow.AttachUIComponent(strengthNumber.gameObject);
            strengthNumber.numericalOnly    = true;
            strengthNumber.allowFloats      = false;
            strengthNumber.allowNegative    = false;
            strengthNumber.maxLength        = 4;
            strengthNumber.width           /= 3;
            strengthSlider.height           = strengthNumber.height;
            strengthSlider.eventMouseUp    += (_, __) => OnStrengthChanged(Mathf.RoundToInt(strengthSlider.value), true);
            strengthSlider.eventMouseLeave += (_, __) => OnStrengthChanged(Mathf.RoundToInt(strengthSlider.value), true);
            strengthSlider.eventLeaveFocus += (_, __) => OnStrengthChanged(Mathf.RoundToInt(strengthSlider.value), true);
            strengthSlider.eventLostFocus  += (_, __) => OnStrengthChanged(Mathf.RoundToInt(strengthSlider.value), true);
            helper.AddCheckbox("temporarily disable the mod (for quick comparison)", TempDisable, (isChecked) => { TempDisable = isChecked; SubstituteTextureManager.RegenerateCache(); });
        }
예제 #19
0
        /// <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 RuiningOptionsPanel(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab and helper.
            UIPanel  panel  = PanelUtils.AddTab(tabStrip, Translations.Translate("BOB_OPT_RUI"), tabIndex);
            UIHelper helper = new UIHelper(panel);

            panel.autoLayout = true;

            UIHelperBase ruinGroup = helper.AddGroup(Translations.Translate("BOB_OPT_RGL"));

            // Checkboxes.
            ruinGroup.AddCheckbox(Translations.Translate("BOB_OPT_RRT"), ModSettings.StopTreeRuining, (value) => ModSettings.StopTreeRuining = value);
            ruinGroup.AddCheckbox(Translations.Translate("BOB_OPT_RRP"), ModSettings.StopPropRuining, (value) => ModSettings.StopPropRuining = value);
        }
예제 #20
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            UIHelperBase group = helper.AddGroup("AutoBudget Settings");

            AddSlider(group, ItemClass.Service.Electricity);
            AddSlider(group, ItemClass.Service.Water);
            AddSlider(group, ItemClass.Service.Garbage);

            updateFrequencySlider = group.AddSlider("Update frequency (ms)", 0, 5000, 100, AutoBudgetSettings.instance.updateFrequency, OnFrequencyChange) as UISlider;
            group.AddCheckbox("Manage Garbage", AutoBudgetSettings.instance.manageGarbage, onGarbageCheckboxChange);
            group.AddCheckbox("Debug", AutoBudgetSettings.instance.debug, onDebugCheckboxChange);

            updateFrequencySlider.tooltip = AutoBudgetSettings.instance.updateFrequency.ToString();
        }
예제 #21
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            UIHelperBase keybindingsGroup = helper.AddGroup("Keybindings");

            keybindingsGroup.AddCheckbox("Ctrl", false, (check) =>
            {
            });

            keybindingsGroup.AddCheckbox("Alt", false, (check) =>
            {
            });

            keybindingsGroup.AddCheckbox("Shift", false, (check) =>
            {
            });
        }
예제 #22
0
 private void AddCheckbox(UIHelperBase group, GoodsTransfer transfer, string settingTitle)
 {
     group.AddCheckbox(settingTitle, settings.Get(transfer.Id), value => {
         settings.Set(transfer.Id, value);
         settings.SaveSettings();
     });
 }
        public void OnSettingsUI(UIHelperBase helper)
        {
            UIHelperBase group = helper.AddGroup("Set Start Money value from 70,000 to 21,000,000");

            Instructions           = (UITextField)group.AddTextfield("Instructions", "Check to enable, select the value you want for start money.", EventTextChanged, EventTextSubmitted);
            Instructions.readOnly  = true;
            Instructions.multiline = true;
            Instructions.width    += 250;
            Instructions.height   += 30;
            group.AddSpace(30);

            group.AddCheckbox("Enable Start Money", us.Enabled, EventCheck);

            StartMoney          = (UITextField)group.AddTextfield("Current Value:", us.StartMoney.ToString(), EventTextChanged, EventTextSubmitted);
            StartMoney.readOnly = true;

            MyDropDown = (UIDropDown)group.AddDropdown("Use the list of values", vals, GetSelection(), EventSel);

            NewMoney = (UITextField)group.AddTextfield("Or enter a value. (70k - 21m)", us.StartMoney.ToString(), EventTextChanged, EventTextSubmitted);

            Validate         = (UIButton)group.AddButton("Validate manually entered value", Validate_Clicked);
            Validate.enabled = false;

            MyDropDown.isVisible = us.Enabled;
            StartMoney.isVisible = us.Enabled;
            Validate.isVisible   = us.Enabled;

            group.AddSpace(150);
            Save = (UIButton)group.AddButton("Save", EventClick);
        }
예제 #24
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                AmericanRoadsignsTool.LoadConfig();

                //  Mod options:
                UIHelperBase group = helper.AddGroup(Name);
                group.AddSpace(10);
                //  Select Options (Road signs):
                group.AddDropdown("Select your preferred keyboard shortcut for toggling the mod panel", new[] { "Shift + A", "Ctrl + A", "Alt + A" }, AmericanRoadsignsTool.config.keyboardshortcut, OnKeyboardShortcutChanged);
                group.AddSpace(10);
                //  Select Options (Road signs):
                group.AddDropdown("Select the road signs pack you want to use in-game", new[] { "Vanilla", "American" }, AmericanRoadsignsTool.config.roadsignpack, OnRoadsignPackChanged);
                group.AddSpace(5);
                group.AddGroup("NOTE: changing the road sign pack you want to use requires a restart of your city.");
                group.AddSpace(10);
                //  Toggle Options (Misc.):
                group.AddCheckbox("Write additional data to debug log", AmericanRoadsignsTool.config.enable_debug, new OnCheckChanged(OnEnableDebugChanged));
                group.AddSpace(5);
                group.AddGroup("WARNING: enabling debug data may increase loading times!\nEnabling this setting is only recommended when you experience problems.");
                group.AddSpace(20);
            }
            catch (Exception e)
            {
                DebugUtils.LogException(e);
            }
        }
        private static void AddCheckbox(string caption, bool enabled, UIHelperBase group)
        {
            UICheckBox box = (UICheckBox)group.AddCheckbox(caption, enabled, (bool _) => { });

            box.readOnly = true;
            box.opacity  = enabled ? 1f : 0.4f;
        }
예제 #26
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            this.InitConfigFile();
            UIHelperBase group = helper.AddGroup(Translation.GetString("Settings"));

            group.AddCheckbox(Translation.GetString("PrioritizeTargetsWithRedSigns"), ModConf.PrioritizeTargetWithRedSigns, delegate(bool isChecked)
            {
                Identity.ModConf.PrioritizeTargetWithRedSigns = isChecked;
                ModConfiguration.Serialize(Identity.configPath, Identity.ModConf);
            });
            group.AddCheckbox(Translation.GetString("MinimizeGarbageTrucks"), ModConf.MinimizeGarbageTrucks, delegate(bool isChecked)
            {
                Identity.ModConf.MinimizeGarbageTrucks = isChecked;
                ModConfiguration.Serialize(Identity.configPath, Identity.ModConf);
            });
        }
예제 #27
0
 public void OnSettingsUI(UIHelperBase helper)
 {
     helper.AddSpace(10);
     Instance.SavePerCityCheckBox = (UICheckBox)helper.AddCheckbox(Instance.CheckboxText, Settings.SavePerCity, (b) =>
     {
         Settings.SavePerCity = b;
         Settings.Save();
     });
     Instance.SavePerCityCheckBox.parent.Find <UILabel>("Label").disabledTextColor = Color.gray;
     helper.AddSpace(10);
     Instance.ResetAllButton = (UIButton)helper.AddButton(Instance.ButtonText, () =>
     {
         SimulationManager.instance.AddAction(() =>
         {
             for (uint i = 0; i < PrefabCollection <BuildingInfo> .LoadedCount(); i++)
             {
                 var building = PrefabCollection <BuildingInfo> .GetLoaded(i);
                 if (building == null || building.m_buildingAI == null || !(building.m_buildingAI.GetType().IsSubclassOf(typeof(PlayerBuildingAI))))
                 {
                     continue;
                 }
                 CustomizeIt.instance.ResetBuilding(building);
             }
         });
     });
     Instance.ToggleOptionPanelControls(false);
 }
        private static UIComponent ProcessProperty <T>(this UIHelperBase group, string name, string description)
        {
            var checkboxAttribute = OptionsWrapper <T> .Options.GetAttribute <T, CheckboxAttribute>(name);

            if (checkboxAttribute != null)
            {
                return(group.AddCheckbox <T>(description, name, checkboxAttribute));
            }
            var textfieldAttribute = OptionsWrapper <T> .Options.GetAttribute <T, TextfieldAttribute>(name);

            if (textfieldAttribute != null)
            {
                return(group.AddTextfield <T>(description, name, textfieldAttribute));
            }
            var dropDownAttribute = OptionsWrapper <T> .Options.GetAttribute <T, DropDownAttribute>(name);

            if (dropDownAttribute != null)
            {
                return(group.AddDropdown <T>(description, name, dropDownAttribute));
            }
            var sliderAttribute = OptionsWrapper <T> .Options.GetAttribute <T, SliderAttribute>(name);

            if (sliderAttribute != null)
            {
                return(group.AddSlider <T>(description, name, sliderAttribute));
            }
            //TODO: more control types
            return(null);
        }
예제 #29
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            // create a new group heading
            UIHelperBase group = helper.AddGroup("Game Day Timer Settings");

            // add a check box to show/hide the timings
            GameDayTimerConfiguration config = Configuration <GameDayTimerConfiguration> .Load();

            group.AddCheckbox("Show timings", config.PanelIsVisible, (bool isChecked) =>
            {
                // save the visibility in the config file
                GameDayTimerConfiguration.SavePanelIsVisible(isChecked);

                // if there is a panel, show or hide it
                if (Panel != null)
                {
                    Panel.isVisible = isChecked;
                }
            });

            // add a button to reset the panel position
            group.AddButton("Reset Position", () =>
            {
                // save the default position in the config file
                GameDayTimerConfiguration.SavePanelPosition(GameDayTimerPanel.DefaultPanelPositionX, GameDayTimerPanel.DefaultPanelPositionY);

                // if there is a panel, move it to the default position
                if (Panel != null)
                {
                    Panel.MovePanelToPosition(GameDayTimerPanel.DefaultPanelPositionX, GameDayTimerPanel.DefaultPanelPositionY);
                }
            });
        }
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                RealisticVehicleSpeed.LoadConfig();
                Detour.RandomSpeed.highwaySpeed = RealisticVehicleSpeed.config.highwaySpeed;

                UICheckBox highway = null;

                UIHelperBase group = helper.AddGroup(Name);

                highway = (UICheckBox)group.AddCheckbox("Realistic highway speeds", Detour.RandomSpeed.highwaySpeed, (b) =>
                {
                    if (Detour.RandomSpeed.highwaySpeed != b)
                    {
                        Detour.RandomSpeed.highwaySpeed = b;
                        RealisticVehicleSpeed.SaveConfig();
                    }
                });
                highway.tooltip = "On highways, vehicles will go faster in the inside lane and slower in the outside lane\n\nWARNING: It might slow down the simulation";

                //highway.enabled = Detour.RandomSpeed.enabled;
            }
            catch (Exception e)
            {
                DebugUtils.Log("OnSettingsUI failed");
                Debug.LogException(e);
            }
        }
        public virtual void OnSettingsUI(UIHelperBase helper)
        {
            foreach (var part in Parts.OfType<IActivablePart>())
            {
                var partLocal = part;

                helper.AddCheckbox(
                    part.DisplayName,
                    part is IShortDescriptor ? ((IShortDescriptor)part).ShortDescription :
                    part is IDescriptor ? ((IDescriptor)part).Description :
                    null,
                    part.IsEnabled,
                    isChecked =>
                    {
                        partLocal.IsEnabled = isChecked;
                        FireSaveSettingsNeeded();
                    },
                    true);
            }
        }
 public override void OnSettingsUI(UIHelperBase helper)
 {
     helper.AddCheckbox(
         "Road Zone Modifier",
         "Press SHIFT (or SHIFT+CTRL) on the Upgrade Road tool to use",
         s_activeOptions.IsFlagSet(ModOptions.RoadZoneModifier), 
         isChecked =>
         {
             if (isChecked)
             {
                 s_activeOptions = s_activeOptions | ModOptions.RoadZoneModifier;
             }
             else
             {
                 s_activeOptions = s_activeOptions & ~ModOptions.RoadZoneModifier;
             }
             FireSaveSettingsNeeded();
         },
         true);
 }
 public override void OnSettingsUI(UIHelperBase helper)
 {
     base.OnSettingsUI(helper);
     
     helper.AddCheckbox(
         "Congestion Avoidance", 
         "Vehicles will actively avoid congestions",
         s_activeOptions.IsFlagSet(Options.CongestionAvoidance),
         isChecked =>
         {
             if (isChecked)
             {
                 s_activeOptions = s_activeOptions | Options.CongestionAvoidance;
             }
             else
             {
                 s_activeOptions = s_activeOptions & ~Options.CongestionAvoidance;
             }
             FireSaveSettingsNeeded();
         },
         true);
 } 
예제 #34
0
		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
		}
예제 #35
0
        /// <summary>
        /// Adds the hidden service controls.
        /// </summary>
        /// <param name="group">The group.</param>
        /// <param name="settings">The settings.</param>
        /// <param name="canService">If set to <c>true</c> this service can be enabled.</param>
        private void AddHiddenServiceControls(UIHelperBase group, Settings.HiddenServiceSettings settings, bool canService)
        {
            if (canService)
            {
                group.AddCheckbox(
                    "Dispatch " + settings.VehicleNamePlural.ToLower(),
                    settings.DispatchVehicles,
                    value =>
                    {
                        try
                        {
                            if (settings.DispatchVehicles != value)
                            {
                                settings.DispatchVehicles = value;
                                Global.Settings.Save();
                                Global.ReInitializeHandlers();
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Error(this, "CreateWreckingRecoveryGroup", ex, settings.VehicleNamePlural, "DispatchVehicles", value);
                        }
                    });
            }
            else
            {
                UIComponent checkBox = group.AddCheckbox(
                    "Dispatch " + settings.VehicleNamePlural.ToLower(),
                    false,
                    value =>
                    {
                    }) as UIComponent;
                checkBox.Disable();
            }

            group.AddExtendedSlider(
                settings.VehicleNameSingular + " delay",
                0.0f,
                60.0f * 24.0f,
                0.01f,
                (float)settings.DelayMinutes,
                true,
                value =>
                {
                    try
                    {
                        if (settings.DelayMinutes != (double)value)
                        {
                            settings.DelayMinutes = (double)value;
                            Global.BuildingUpdateNeeded = true;
                            Global.Settings.Save();
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error(this, "CreateWreckingRecoveryGroup", ex, settings.VehicleNamePlural, "DelayMinutes", value);
                    }
                });
        }