/// <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(); }); }
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(); }
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); }
public void BuildUI(UIHelper helper) { UIHelperBase group = helper.AddGroup("Shortcuts:"); UIPanel panel = CreateRowPanel((UIPanel)((UIHelper)group).self); CreateLabel(panel, "Open Mod Menu", 0.6f); CreateKeybindButton(panel, ModSettings.instance.MainKey, 0.3f); UIHelperBase group2 = helper.AddGroup("Other"); UIPanel panel2 = CreateRowPanel((UIPanel)((UIHelper)group2).self); CreateResetMenuPosition(panel2); }
public static void MakeSettings(UIHelper helper, Options options) { { var group = helper.AddGroup("Settings"); { var cb = (UICheckBox)group.AddCheckbox("Keep Info Mode", options.KeepInfoMode.value, c => options.KeepInfoMode.value = c); cb.tooltip = "If enabled, activating the junction tool keeps the current view (underground or overground). Otherwise the last used view is used."; } } { var group = helper.AddGroup("Keymapping"); var pnl = UISettingsPanel.AddTo((UIComponent)((UIHelper)group).self, options); } }
public static void makeSettings(UIHelperBase helper) { // tabbing code is borrowed from RushHour mod // https://github.com/PropaneDragon/RushHour/blob/release/RushHour/Options/OptionHandler.cs 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("ShortCut")); 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); var generalGroup = panelHelper.AddGroup(Localization.Get("ShortCut")) as UIHelper; var panel = generalGroup.self as UIPanel; panel.gameObject.AddComponent <OptionsKeymappingRoadTool>(); var generalGroup1 = panelHelper.AddGroup(Localization.Get("OtherOption")) as UIHelper; generalGroup1.AddCheckbox(Localization.Get("NeedMoney"), isMoneyNeeded, (index) => isMoneyNeededEnable(index)); generalGroup1.AddCheckbox(Localization.Get("NOSHADERPREVIEW"), dontUseShaderPreview, (index) => dontUseShaderPreviewEnable(index)); nodeGapSlider = generalGroup1.AddSlider(Localization.Get("NODEGAP") + "(" + nodeGap.ToString() + "U)", 5, 10, 1, nodeGap, onNodeGapChanged) as UISlider; SaveSetting(); }
/* * enable toggles for various undesired buildings for both tourists and residents * percentage of population on which to base the amount of tourists to create */ public void OnSettingsUI(UIHelperBase helper) { UIHelper uiHelper = helper as UIHelper; UIHelper save = (UIHelper)uiHelper.AddGroup("Save to XML file"); save.AddButton("Save", new OnButtonClicked(this.Save)); }
public void OnSettingsUI(UIHelperBase helper) { UIHelper concrete = helper as UIHelper; if (File.Exists(LoadingExtension.currentFileLocation)) { // Load in from XML - Designed to be flat file for ease WG_XMLBaseVersion reader = new XML_VersionOne(); XmlDocument doc = new XmlDocument(); try { doc.Load(LoadingExtension.currentFileLocation); int version = Convert.ToInt32(doc.DocumentElement.Attributes["version"].InnerText); reader.readXML(doc, DataStore.getInstance()); } catch (Exception) { } } UIHelperBase group = concrete.AddGroup("Population modifiers"); group.AddButton("Save", EventSave); group.AddTextfield("Res Height", Convert.ToString(DataStore.getInstance().resHeightLimit), newResHeight); }
/// <summary> /// This method is invoked by CS internally /// </summary> public void CreateUI() { var modSettingsGroup = _uiHelper.AddGroup(UITexts.ModSettingsGroupLabel); modSettingsGroup.AddCheckbox(UITexts.ModSettingsDebugLoggingOption, _configuration.DebugLogging, b => _configuration.DebugLogging = b); _rootPanel.eventVisibilityChanged += rootPanel_eventVisibilityChanged; }
internal static void MakeSettings_Keybinds(ExtUITabstrip tabStrip) { string keybindsTabText = Translation.Options.Get("Tab:Keybinds"); UIHelper panelHelper = tabStrip.AddTabPage(keybindsTabText, false); UIHelperBase keyboardGroup = panelHelper.AddGroup(keybindsTabText); ((UIPanel)((UIHelper)keyboardGroup).self).gameObject.AddComponent <KeybindSettingsPage>(); }
/// <summary> /// Creates a group. /// </summary> /// <param name="parentHelper">The parent <see cref="UIHelper"/>.</param> /// <param name="title">The title of the group.</param> /// <returns>A <see cref="UIHelper"/> object of the newly created group.</returns> public static UIHelper AddGroup2(this UIHelper parentHelper, string title) { UIHelper groupHelper = (UIHelper)parentHelper.AddGroup(title); ((UIComponent)groupHelper.self).parent.width = ((UIComponent)parentHelper.self).width - 20; ((UIComponent)groupHelper.self).width = ((UIComponent)groupHelper.self).parent.width; return(groupHelper); }
public static void MakeSettings(UIHelper helper, Options options) { { var group = helper.AddGroup("Settings"); { var cb = (UICheckBox)group.AddCheckbox("Keep Info Mode", options.KeepInfoMode.value, c => options.KeepInfoMode.value = c); cb.tooltip = "If enabled, activating the junction tool keeps the current view (underground or overground). Otherwise the last used view is used."; } } { var group = helper.AddGroup("Keymapping"); var pnl = UIShortcutSettingsPanel.AddTo((UIComponent)((UIHelper)group).self, options); } { var group = helper.AddGroup("Advanced Settings"); { var groupBtn = group.AddGroup("Displace TTL Button"); { { var c = (UIComponent)(((UIHelper)groupBtn).self); var lbl = c.parent.Find <UILabel>("Label"); if (lbl != null) { lbl.tooltip = "To see the button moving:\n" + "* Ingame, open the Roads Building Menu\n" + "* open the Pause Menu by clicking on the gear icon in the upper right corner\n" + "* Open options and move into the TTL section\n" + "* The TTL button is visible (although blured) in the background and changing its offset is directly reflected"; } } var horizontalOffset = AddSlider((UIHelper)groupBtn, "Horizontal offset", -210.0f, +180.0f, 1.0f, options.TTLButtonHorizontalOffset.value, o => OnOffsetChanged(o, null, options)); var verticalOffset = AddSlider((UIHelper)groupBtn, "Vertical offset", -80.0f, +35.0f, 1.0f, options.TTLButtonVerticalOffset.value, o => OnOffsetChanged(null, o, options)); void OnOffsetReset() { horizontalOffset.value = 0.0f; verticalOffset.value = 0.0f; } groupBtn.AddButton("Reset", OnOffsetReset); } } } }
/// <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 VisualOptionsPanel(UITabstrip tabStrip, int tabIndex) { // Add tab and helper. UIPanel panel = PanelUtils.AddTab(tabStrip, Translations.Translate("BOB_OPT_VIS"), tabIndex); UIHelper helper = new UIHelper(panel); panel.autoLayout = true; // Ruining. UIHelperBase ruinGroup = helper.AddGroup(Translations.Translate("BOB_OPT_RUI") + " - " + Translations.Translate("BOB_OPT_RGL")); 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); // Electrical wire thickness. UIHelperBase wiresGroup = helper.AddGroup(Translations.Translate("BOB_OPT_WIR")); wiresGroup.AddCheckbox(Translations.Translate("BOB_OPT_WTH"), ModSettings.ThinnerWires, (value) => ModSettings.ThinnerWires = value); }
public static void Init(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; AddOptionTab(tabStrip, Localize.ShortCut); 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); var generalGroup = panelHelper.AddGroup(Localize.ShortCut) as UIHelper; var panel = generalGroup.self as UIPanel; panel.gameObject.AddComponent <KeyMapping>(); var otherOptionGroup = panelHelper.AddGroup(Localize.OtherOption) as UIHelper; }
public static void OnSettingsUI(UIHelper helper) { { helper.AddButton("Reset Exemptions", () => DCRConfig.Reset()); var g = helper.AddGroup("Automation"); g.AddToggle( text: "Generate junction medians", tooltip: "Generates medians for roads that don't have it (unsupported roads are skipped. see log)", fieldName: nameof(DCRConfig.GenerateMedians), OnRefresh: RefreshDC); g.AddToggle( text: "Remove median angle restrictions", tooltip: "Removes the 'Maximum Turn Angle' for roads that already have a continues junction median.", fieldName: nameof(DCRConfig.RemoveDCRestrictionsAngle), OnRefresh: RefreshDCFlags); g.AddToggle( text: "Remove Traffic light restrictions", tooltip: "Removes the traffic light requirement for roads that already have a continues junction median.", fieldName: nameof(DCRConfig.RemoveDCRestrictionsTL), OnRefresh: RefreshDCFlags); g.AddToggle( text: "Remove 'Transition' restrictions", tooltip: "Removes the 'urban to highway transition' requirement for roads that already have a continues junction median.", fieldName: nameof(DCRConfig.RemoveDCRestrictionsTransition), OnRefresh: RefreshDCFlags); } { var g2 = helper.AddGroup("Refreh"); g2.AddToggle( text: "Auto refresh all road junctions on startup (turn on if you see blue textures)", tooltip: "this might take a while so only turn this on if you see blue textures.", fieldName: nameof(DCRConfig.RefreshOnStartup), OnRefresh: null); g2.AddButton("Refresh all road junctions (Resolve blue clippings)", "might take a while", RefreshNetworks); g2.AddButton("Regenerate meshes", "might take a while", RefreshDC); } }
/// <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); }
public static void OnSettingsUI(UIHelper helper) { try { Log.Debug(Environment.StackTrace); //var showCheckBox2 = helper.AddCheckbox( // "Handle ESC key (esc key exits current tool if any).", // HandleESC, // val => { // HandleESC.value = val; // Log.Info("HandleESC set to " + val); // }) as UICheckBox; if (!Helpers.InStartupMenu) { var g1 = helper.AddGroup("Conflicts") as UIHelper; if (!Helpers.InStartupMenu) { (g1.self as UIComponent).eventVisibilityChanged += (c, __) => { if (c.isVisible) { Collisions(g1); } }; Collisions(g1); } } helper.AddCheckbox("Switch to previous tool on disable", MainPanel.SwitchToPrevTool.value, val => MainPanel.SwitchToPrevTool.value = val); helper.AddCheckbox("Clear info panels when tool changes", MainPanel.ClearInfoPanelsOnToolChanged.value, val => MainPanel.ClearInfoPanelsOnToolChanged.value = val); var hideCheckBox = helper.AddCheckbox( "Hide original activation buttons", HideOriginalButtons, val => { HideOriginalButtons.value = val; Log.Info("HideOriginalButtons set to " + val); if (MainPanel.Exists) { MainPanel.Instance.DoRefreshButtons(); } }) as UICheckBox; } catch (Exception e) { Log.Exception(e); } }
internal static void MakeSettings_Keybinds(UITabstrip tabStrip, int tabIndex) { Options.AddOptionTab(tabStrip, T("Keybinds")); 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 keyboardGroup = panelHelper.AddGroup(T("Keybinds")); ((UIPanel)((UIHelper)keyboardGroup).self).gameObject.AddComponent <KeybindSettingsPage>(); }
protected void PopulateTabContainer() { // Parse all the available sounds first var sliders = new Dictionary <string, Dictionary <string, List <ISound> > >(); foreach (var sound in SoundManager.instance.Sounds.Values) { if ((DlcUtils.InstalledDlcs & sound.RequiredDlc) != sound.RequiredDlc) { continue; } if (!sliders.ContainsKey(sound.CategoryName)) { sliders.Add(sound.CategoryName, new Dictionary <string, List <ISound> >()); } if (!sliders[sound.CategoryName].ContainsKey(sound.SubCategoryName)) { sliders[sound.CategoryName].Add(sound.SubCategoryName, new List <ISound>()); } sliders[sound.CategoryName][sound.SubCategoryName].Add(sound); } // Populate the tab container foreach (var tabGroup in sliders) { UIHelper tabHelper = this.RootHelper; /*.AddScrollingTab(tabstrip, buttonWidth, tabGroup.Key);*/ //TODO(earalov): fix! foreach (var group in tabGroup.Value) { UIHelperBase groupHelper = tabHelper.AddGroup(group.Key); //TODO(earalov): fix! // UIHelper groupHelper = tabHelper.AddGroup2(group.Key); // ((UIComponent)groupHelper.self).parent.width -= 10; // Fix some overlap with the scrollbar // ((UIComponent)groupHelper.self).width -= 10; // Fix some overlap with the scrollbar foreach (var sound in group.Value) { this.CreateSoundSlider(groupHelper, sound); } } } }
public static void makeSettings(UIHelperBase helper) { // tabbing code is borrowed from RushHour mod // https://github.com/PropaneDragon/RushHour/blob/release/RushHour/Options/OptionHandler.cs 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, "ShortCut"); 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); var generalGroup = panelHelper.AddGroup("ShortCut") as UIHelper; var panel = generalGroup.self as UIPanel; panel.gameObject.AddComponent <OptionsKeymappingFunction>(); }
public static void makeSettings(UIHelperBase helper) { // tabbing code is borrowed from RushHour mod // https://github.com/PropaneDragon/RushHour/blob/release/RushHour/Options/OptionHandler.cs 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("WeekDayPlan")); 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); var generalGroup = panelHelper.AddGroup(Localization.Get("MorningRushHour")) as UIHelper; generalGroup.AddDropdown(Localization.Get("MorningBudget"), new string[] { "30%", "60%", "90%", "120%", "150%", "180%", "210%" }, morningBudgetWeekDay, (index) => GetMorningBudgetWeekDay(index)); var generalGroup1 = panelHelper.AddGroup(Localization.Get("EveningRushHour")) as UIHelper; generalGroup1.AddDropdown(Localization.Get("EveningBudget"), new string[] { "30%", "60%", "90%", "120%", "150%", "180%", "210%" }, eveningBudgetWeekDay, (index) => GetEveningBudgetWeekDay(index)); var generalGroup2 = panelHelper.AddGroup(Localization.Get("DeepNight")) as UIHelper; generalGroup2.AddDropdown(Localization.Get("DeepNightBudget"), new string[] { "30%", "60%", "90%", "120%", "150%", "180%", "210%" }, deepNightBudgetWeekDay, (index) => GetDeepNightBudgetWeekDay(index)); var generalGroup3 = panelHelper.AddGroup(Localization.Get("OtherTime")) as UIHelper; generalGroup3.AddDropdown(Localization.Get("OtherTimeBudget"), new string[] { "30%", "60%", "90%", "120%", "150%", "180%", "210%" }, otherBudgetWeekDay, (index) => GetOtherBudgetWeekDay(index)); ++tabIndex; AddOptionTab(tabStrip, Localization.Get("WeekEndPlan")); 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); generalGroup = panelHelper.AddGroup(Localization.Get("MorningRushHour")) as UIHelper; generalGroup.AddDropdown(Localization.Get("MorningBudget"), new string[] { "30%", "60%", "90%", "120%", "150%", "180%", "210%" }, morningBudgetWeekEnd, (index) => GetMorningBudgetWeekEnd(index)); generalGroup1 = panelHelper.AddGroup(Localization.Get("EveningRushHour")) as UIHelper; generalGroup1.AddDropdown(Localization.Get("EveningBudget"), new string[] { "30%", "60%", "90%", "120%", "150%", "180%", "210%" }, eveningBudgetWeekEnd, (index) => GetEveningBudgetWeekEnd(index)); generalGroup2 = panelHelper.AddGroup(Localization.Get("DeepNight")) as UIHelper; generalGroup2.AddDropdown(Localization.Get("DeepNightBudget"), new string[] { "30%", "60%", "90%", "120%", "150%", "180%", "210%" }, deepNightBudgetWeekEnd, (index) => GetDeepNightBudgetWeekEnd(index)); generalGroup3 = panelHelper.AddGroup(Localization.Get("OtherTime")) as UIHelper; generalGroup3.AddDropdown(Localization.Get("OtherTimeBudget"), new string[] { "30%", "60%", "90%", "120%", "150%", "180%", "210%" }, otherBudgetWeekEnd, (index) => GetOtherBudgetWeekEnd(index)); SaveSetting(); }
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"; } }
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); }
internal static void MakeSettings_General(UITabstrip tabStrip, int tabIndex) { Options.AddOptionTab(tabStrip, T("General")); 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 generalGroup = panelHelper.AddGroup(T("General")); string[] languageLabels = new string[Translation.AvailableLanguageCodes.Count + 1]; languageLabels[0] = T("Game_language"); for (int i = 0; i < Translation.AvailableLanguageCodes.Count; ++i) { languageLabels[i + 1] = Translation.LanguageLabels[Translation.AvailableLanguageCodes[i]]; } int languageIndex = 0; string curLangCode = GlobalConfig.Instance.LanguageCode; if (curLangCode != null) { languageIndex = Translation.AvailableLanguageCodes.IndexOf(curLangCode); if (languageIndex < 0) { languageIndex = 0; } else { ++languageIndex; } } _languageDropdown = generalGroup.AddDropdown( T("Language") + ":", languageLabels, languageIndex, OnLanguageChanged) as UIDropDown; _lockButtonToggle = generalGroup.AddCheckbox( T("Lock_main_menu_button_position"), GlobalConfig.Instance.Main.MainMenuButtonPosLocked, OnLockButtonChanged) as UICheckBox; _lockMenuToggle = generalGroup.AddCheckbox( T("Lock_main_menu_position"), GlobalConfig.Instance.Main.MainMenuPosLocked, OnLockMenuChanged) as UICheckBox; _tinyMenuToggle = generalGroup.AddCheckbox( T("Compact_main_menu"), GlobalConfig.Instance.Main.TinyMainMenu, OnCompactMainMenuChanged) as UICheckBox; _guiTransparencySlider = generalGroup.AddSlider( T("Window_transparency") + ":", 0, 90, 5, GlobalConfig.Instance.Main.GuiTransparency, OnGuiTransparencyChanged) as UISlider; _guiTransparencySlider.parent.Find <UILabel>("Label").width = 500; _overlayTransparencySlider = generalGroup.AddSlider( T("Overlay_transparency") + ":", 0, 90, 5, GlobalConfig.Instance.Main.OverlayTransparency, OnOverlayTransparencyChanged) as UISlider; _overlayTransparencySlider.parent.Find <UILabel>("Label").width = 500; _enableTutorialToggle = generalGroup.AddCheckbox( T("Enable_tutorial_messages"), GlobalConfig.Instance.Main.EnableTutorial, OnEnableTutorialsChanged) as UICheckBox; _showCompatibilityCheckErrorToggle = generalGroup.AddCheckbox( T("Notify_me_if_there_is_an_unexpected_mod_conflict"), GlobalConfig.Instance.Main.ShowCompatibilityCheckErrorMessage, OnShowCompatibilityCheckErrorChanged) as UICheckBox; _scanForKnownIncompatibleModsToggle = generalGroup.AddCheckbox( T("Scan_for_known_incompatible_mods_on_startup"), GlobalConfig.Instance.Main.ScanForKnownIncompatibleModsAtStartup, OnScanForKnownIncompatibleModsChanged) as UICheckBox; _ignoreDisabledModsToggle = generalGroup.AddCheckbox( T("Ignore_disabled_mods"), GlobalConfig.Instance.Main.IgnoreDisabledMods, OnIgnoreDisabledModsChanged) as UICheckBox; Options.Indent(_ignoreDisabledModsToggle); // General: Speed Limits SetupSpeedLimitsPanel(generalGroup); // General: Simulation UIHelperBase simGroup = panelHelper.AddGroup(T("Simulation")); _instantEffectsToggle = simGroup.AddCheckbox( T("Customizations_come_into_effect_instantaneously"), Options.instantEffects, OnInstantEffectsChanged) as UICheckBox; }
public void BuildUi() { var relevantSortedModNames = this.netInfoGroupViewReadModel.Where(x => x.PrefabFound).Select(x => x.ModName).Distinct().OrderBy(x => x).ToList(); if (relevantSortedModNames.Count == 0) { var mainGroupUiHelper = this.uIHelperBase.AddGroup(this.modFullTitle) as UIHelper; var mainPanel = mainGroupUiHelper.self as UIPanel; var mainLabel = mainPanel.AddUIComponent <UILabel>(); mainLabel.text = "Did not find any roads that are supported."; return; } this.modPanels = new UIPanel[relevantSortedModNames.Count]; var mainHelper = this.uIHelperBase as UIHelper; var mainGroupHelper = this.uIHelperBase.AddGroup(this.modFullTitle) as UIHelper; var mainGroupPanel = mainGroupHelper.self as UIPanel; mainGroupPanel.backgroundSprite = null; var modDropDown = mainGroupHelper.AddDropdown("Mod", relevantSortedModNames.ToArray(), 0, (index) => this.ShowModPanel(index)) as UIDropDown; modDropDown.textFieldPadding = new RectOffset(8, 8, 8, 8); modDropDown.width = modDropDown.CalculatePopupWidth(0); mainGroupHelper.AddSpace(10); for (var i = 0; i < relevantSortedModNames.Count; i++) { var modPanel = mainGroupPanel.AddUIComponent <UIPanel>(); modPanel.isVisible = false; modPanel.width = mainGroupPanel.width - 20; modPanel.name = "RRT_UIPanel_" + relevantSortedModNames[i]; var modPanelHelper = new UIHelper(modPanel); this.modPanels[i] = modPanel; var modNetInfoGroupViewReadModel = this.netInfoGroupViewReadModel .Where(x => x.PrefabFound && x.ModName == relevantSortedModNames[i] ); var roadUiCategories = modNetInfoGroupViewReadModel.Select(x => x.RoadUiCategory).Distinct().OrderBy(x => x); foreach (var roadUiCategory in roadUiCategories) { var subGroupHelper = modPanelHelper.AddGroup(Enum.GetName(typeof(RoadUiCategory), roadUiCategory)) as UIHelper; var subGroupPanel = subGroupHelper.self as UIPanel; var offset = 10; var netInfoGroupPanelHeight = 48; var roadUiCategoryNetInfoGroupViewReadModels = modNetInfoGroupViewReadModel.Where(x => x.RoadUiCategory == roadUiCategory); foreach (var netInfoGroupViewReadModel in roadUiCategoryNetInfoGroupViewReadModels) { var netInfoGroupPanel = subGroupPanel.AddUIComponent <UIPanel>(); netInfoGroupPanel.height = netInfoGroupPanelHeight; netInfoGroupPanel.width = subGroupPanel.width - 60; netInfoGroupPanel.relativePosition = new Vector3(0, offset); offset += netInfoGroupPanelHeight; var label = netInfoGroupPanel.AddUIComponent <UILabel>(); label.text = netInfoGroupViewReadModel.DisplayNameOriginal; label.relativePosition = new Vector3(0, 8); if (netInfoGroupViewReadModel.IsRedundant) { label.text += " (Redundant)"; label.textColor = new Color32(200, 100, 100, 255); } var netInfoGroupHelper = new UIHelper(netInfoGroupPanel); var netGroupDemolishButton = netInfoGroupHelper.AddButton("Demolish", () => this.gameEngineService.DemolishSegmentGroup(netInfoGroupViewReadModel)) as UIButton; netGroupDemolishButton.textHorizontalAlignment = UIHorizontalAlignment.Center; netGroupDemolishButton.relativePosition = new Vector3(netInfoGroupPanel.width - netGroupDemolishButton.width, 0); if (netInfoGroupViewReadModel.HasAnyReplacements) { var netGroupReplaceButton = netInfoGroupHelper.AddButton("Replace", () => this.gameEngineService.UpgradeSegmentGroup(netInfoGroupViewReadModel)) as UIButton; netGroupReplaceButton.tooltip = "with " + netInfoGroupViewReadModel.DisplayNameReplacement; netGroupReplaceButton.textHorizontalAlignment = UIHorizontalAlignment.Center; netGroupReplaceButton.relativePosition = new Vector3(netInfoGroupPanel.width - netGroupDemolishButton.width - netGroupReplaceButton.width - 10, 0); } } modPanel.autoFitChildrenVertically = true; modPanel.autoLayoutDirection = LayoutDirection.Vertical; modPanel.autoLayout = true; } } this.ShowModPanel(0); //select first element }
public static void MakeSettings(UIHelperBase helper) { // tabbing code is borrowed from RushHour mod // https://github.com/PropaneDragon/RushHour/blob/release/RushHour/Options/OptionHandler.cs 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("Lane_ShortCut")); 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); var generalGroup = panelHelper.AddGroup(Localization.Get("Lane_Button_ShortCut")) as UIHelper; var panel = generalGroup.self as UIPanel; panel.gameObject.AddComponent <OptionsKeymappingLane>(); var generalGroup1 = panelHelper.AddGroup(Localization.Get("ShortCuts_Control")) as UIHelper; generalGroup1.AddCheckbox(Localization.Get("ShortCuts_Control_TIPS"), isShortCutsToPanel, (index) => isShortCutsToPanelEnable(index)); // Function_ShortCut ++tabIndex; AddOptionTab(tabStrip, Localization.Get("Function_ShortCut")); 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); generalGroup = panelHelper.AddGroup(Localization.Get("Function_Button_ShortCut")) as UIHelper; panel = generalGroup.self as UIPanel; panel.gameObject.AddComponent <OptionsKeymappingFunction>(); ++tabIndex; AddOptionTab(tabStrip, Localization.Get("Experimental_Function")); 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("Experimental_Function")) as UIHelper; generalGroup2.AddCheckbox(Localization.Get("Debug_Mode"), isDebug, (index) => isDebugEnable(index)); generalGroup2.AddCheckbox(Localization.Get("DisableZone"), disableZone, (index) => isDisableZoneEnable(index)); generalGroup2.AddCheckbox(Localization.Get("UpdateZone"), disableZoneUpdateAll, (index) => isDisableZoneUpdateAllEnable(index)); generalGroup2.AddCheckbox(Localization.Get("EnablePillar"), enablePillar, (index) => isEnablePillarEnable(index)); generalGroup2.AddCheckbox(Localization.Get("AlignZone"), alignZone, (index) => isAlignZoneEnable(index)); generalGroup2.AddCheckbox(Localization.Get("FixLargeJunction"), fixLargeJunction, (index) => isFixLargeJunctionEnable(index)); generalGroup2.AddCheckbox(Localization.Get("NOJunction"), noJunction, (index) => isNoJunctionEnable(index)); generalGroup2.AddDropdown(Localization.Get("Lane_Smooth_Level"), new string[] { Localization.Get("Low"), Localization.Get("Medium"), Localization.Get("High") }, smoothLevel, (index) => GetSmoothLevel(index)); SaveSetting(); }
internal static void MakeSettings_VehicleRestrictions(ExtUITabstrip tabStrip) { UIHelper panelHelper = tabStrip.AddTabPage(Translation.Options.Get("Tab:Policies & Restrictions")); UIHelperBase atJunctionsGroup = panelHelper.AddGroup( Translation.Options.Get("VR.Group:At junctions")); #if DEBUG _allRelaxedToggle = atJunctionsGroup.AddCheckbox( Translation.Options.Get("VR.Checkbox:All vehicles may ignore lane arrows"), Options.allRelaxed, OnAllRelaxedChanged) as UICheckBox; #endif _relaxedBussesToggle = atJunctionsGroup.AddCheckbox( Translation.Options.Get("VR.Checkbox:Buses may ignore lane arrows"), Options.relaxedBusses, OnRelaxedBussesChanged) as UICheckBox; _allowEnterBlockedJunctionsToggle = atJunctionsGroup.AddCheckbox( Translation.Options.Get("VR.Checkbox:Vehicles may enter blocked junctions"), Options.allowEnterBlockedJunctions, OnAllowEnterBlockedJunctionsChanged) as UICheckBox; _allowUTurnsToggle = atJunctionsGroup.AddCheckbox( Translation.Options.Get("VR.Checkbox:Vehicles may do u-turns at junctions"), Options.allowUTurns, OnAllowUTurnsChanged) as UICheckBox; _allowNearTurnOnRedToggle = atJunctionsGroup.AddCheckbox( Translation.Options.Get("VR.Checkbox:Vehicles may turn on red"), Options.allowNearTurnOnRed, OnAllowNearTurnOnRedChanged) as UICheckBox; _allowFarTurnOnRedToggle = atJunctionsGroup.AddCheckbox( Translation.Options.Get("VR.Checkbox:Also apply to left/right turns between one-way streets"), Options.allowFarTurnOnRed, OnAllowFarTurnOnRedChanged) as UICheckBox; Options.Indent(_allowFarTurnOnRedToggle); _allowLaneChangesWhileGoingStraightToggle = atJunctionsGroup.AddCheckbox( Translation.Options.Get("VR.Checkbox:Vehicles going straight may change lanes at junctions"), Options.allowLaneChangesWhileGoingStraight, OnAllowLaneChangesWhileGoingStraightChanged) as UICheckBox; _trafficLightPriorityRulesToggle = atJunctionsGroup.AddCheckbox( Translation.Options.Get("VR.Checkbox:Vehicles follow priority rules at junctions with timedTL"), Options.trafficLightPriorityRules, OnTrafficLightPriorityRulesChanged) as UICheckBox; _automaticallyAddTrafficLightsIfApplicableToggle = atJunctionsGroup.AddCheckbox( Translation.Options.Get("VR.Checkbox:Automatically add traffic lights if applicable"), Options.automaticallyAddTrafficLightsIfApplicable, OnAutomaticallyAddTrafficLightsIfApplicableChanged) as UICheckBox; DedicatedTurningLanes.AddUI(atJunctionsGroup); 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); }
/// <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 GrowableOptions(UITabstrip tabStrip, int tabIndex) { // Add tab and helper. UIPanel panel = PanelUtils.AddTab(tabStrip, Translations.Translate("PRR_OPTION_GRO"), tabIndex, true); UIHelper helper = new UIHelper(panel); // Add plop growables checkboxes. UIHelperBase plopGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_PLP")); plopGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RGR"), ModSettings.plopRico, isChecked => { ModSettings.plopRico = isChecked; SettingsUtils.SaveSettings(); }); plopGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.plopOther, isChecked => { ModSettings.plopOther = isChecked; SettingsUtils.SaveSettings(); }); // Add no zone checks checkboxes. UIHelperBase zoneGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_ZON")); zoneGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RGR"), ModSettings.noZonesRico, isChecked => { ModSettings.noZonesRico = isChecked; SettingsUtils.SaveSettings(); }); zoneGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.noZonesOther, isChecked => { ModSettings.noZonesOther = isChecked; SettingsUtils.SaveSettings(); }); // Add no specialisation checks checkboxes. UIHelperBase specGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_SPC")); specGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RGR"), ModSettings.noSpecRico, isChecked => { ModSettings.noSpecRico = isChecked; SettingsUtils.SaveSettings(); }); specGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.noSpecOther, isChecked => { ModSettings.noSpecOther = isChecked; SettingsUtils.SaveSettings(); }); // Add 'make plopped growables historical' checkboxes. UIHelperBase histGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_HST")); histGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RGR"), ModSettings.historicalRico, isChecked => { ModSettings.historicalRico = isChecked; SettingsUtils.SaveSettings(); }); histGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.historicalOther, isChecked => { ModSettings.historicalOther = isChecked; SettingsUtils.SaveSettings(); }); // Add level control checkboxes. UIHelperBase levelGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_BLC")); // If we haven't already, check for Advanced Building Level Control. if (ModUtils.ablcLockBuildingLevel == null) { ModUtils.ABLCReflection(); } // Is it (still) null? if (ModUtils.ablcLockBuildingLevel != null) { // ABLC installed; display checkboxes. levelGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RGR"), ModSettings.lockLevelRico, isChecked => { ModSettings.lockLevelRico = isChecked; SettingsUtils.SaveSettings(); }); levelGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.lockLevelOther, isChecked => { ModSettings.lockLevelOther = isChecked; SettingsUtils.SaveSettings(); }); } }
public static void makeSettings(UIHelperBase helper) { // tabbing code is borrowed from RushHour mod // https://github.com/PropaneDragon/RushHour/blob/release/RushHour/Options/OptionHandler.cs 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("ShortCut")); 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); var generalGroup = panelHelper.AddGroup(Localization.Get("ShortCut")) as UIHelper; var panel = generalGroup.self as UIPanel; panel.gameObject.AddComponent <OptionsKeymappingRoadTool>(); var generalGroup1 = panelHelper.AddGroup(Localization.Get("OtherOption")) as UIHelper; generalGroup1.AddCheckbox(Localization.Get("NeedMoney"), isMoneyNeeded, (index) => isMoneyNeededEnable(index)); generalGroup1.AddCheckbox(Localization.Get("NOSHADERPREVIEW"), dontUseShaderPreview, (index) => dontUseShaderPreviewEnable(index)); SaveSetting(); // Function_ShortCut /*++tabIndex; * * AddOptionTab(tabStrip, "ShortCut"); * 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); * * generalGroup = panelHelper.AddGroup("Beta function") as UIHelper; * panel = generalGroup.self as UIPanel; * * var generalGroup1 = panelHelper.AddGroup("Beta function") as UIHelper; * generalGroup1.AddCheckbox("Allow road tools to make road more like a circle(may impact performance)", isMoreRound, (index) => isMoreRoundEnable(index)); * SaveSetting();*/ }
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); }