public void OnSettingsUI(UIHelperBase helper) { try { UIHelper group = helper.AddGroup(Name) as UIHelper; UIPanel panel = group.self as UIPanel; UICheckBox skipVanillaVehicles = (UICheckBox)group.AddCheckbox("Skip prop conversion for all vanilla vehicles", Settings.skipVanillaVehicles, (b) => { Settings.skipVanillaVehicles = b; XMLUtils.SaveSettings(); }); skipVanillaVehicles.tooltip = "Generated vanilla vehicle props will disappear next time when a save file is loaded"; group.AddSpace(10); UICheckBox skipVanillaTrees = (UICheckBox)group.AddCheckbox("Skip prop conversion for all vanilla trees", Settings.skipVanillaTrees, (b) => { Settings.skipVanillaTrees = b; XMLUtils.SaveSettings(); }); skipVanillaVehicles.tooltip = "Generated vanilla tree props will disappear next time when a save file is loaded"; group.AddSpace(10); // show path to TVPropPatchConfig.xml string path = Path.Combine(DataLocation.executableDirectory, "TVPropPatchConfig.xml"); UITextField customTagsFilePath = (UITextField)group.AddTextfield("Configuration File - TVPropPatchConfig.xml", path, _ => { }, _ => { }); customTagsFilePath.width = panel.width - 30; group.AddButton("Show in File Explorer", () => UnityEngine.Application.OpenURL(DataLocation.executableDirectory)); } catch (Exception e) { Debug.Log("OnSettingsUI failed"); Debug.LogException(e); } }
public static void Make(ExtUITabstrip tabStrip) { UIHelper panelHelper = tabStrip.AddTabPage("Logging"); panelHelper.AddCheckbox( "Log asset loading times", ConfigUtil.Config.LogAssetLoadingTimes, val => { ConfigUtil.Config.LogAssetLoadingTimes = val; ConfigUtil.SaveConfig(); logAssetLoadingTimesToggle_.isEnabled = val; }); logAssetLoadingTimesToggle_ = panelHelper.AddCheckbox( "Per Mod", ConfigUtil.Config.LogPerModAssetLoadingTimes, val => { ConfigUtil.Config.LogPerModAssetLoadingTimes = val; ConfigUtil.SaveConfig(); }) as UIComponent; Settings.Indent(logAssetLoadingTimesToggle_); logAssetLoadingTimesToggle_ = panelHelper.AddCheckbox( "Log per mod OnCreated() times", ConfigUtil.Config.LogPerModOnCreatedTimes, val => { ConfigUtil.Config.LogPerModOnCreatedTimes = val; ConfigUtil.SaveConfig(); }) as UIComponent; }
public void OnSettingsUI(UIHelperBase helper) { try { UIHelper group = helper.AddGroup(Name) as UIHelper; UIPanel panel = group.self as UIPanel; UICheckBox checkBox = (UICheckBox)group.AddCheckbox("Hide tips", MoveItTool.hideTips.value, (b) => { MoveItTool.hideTips.value = b; if (UITipsWindow.instance != null) { UITipsWindow.instance.isVisible = false; } }); checkBox.tooltip = "Check this if you don't want to see the tips.\n"; checkBox = (UICheckBox)group.AddCheckbox("Use cardinal movements", MoveItTool.useCardinalMoves.value, (b) => { MoveItTool.useCardinalMoves.value = b; }); checkBox.tooltip = "If checked, Up will move in the North direction, Down is South, Left is West, Right is East.\n"; group.AddSpace(10); panel.gameObject.AddComponent <OptionsKeymapping>(); group.AddSpace(10); } catch (Exception e) { DebugUtils.Log("OnSettingsUI failed"); DebugUtils.LogException(e); } }
public static void MakeGlobalSettings(UIHelperBase helper) { UIHelper group = helper.AddGroup("Global settings") as UIHelper; UIPanel panel = group.self as UIPanel; var keymappings = panel.gameObject.AddComponent <KeymappingsPanel>(); keymappings.AddKeymapping("Activation Shortcut", NodeControllerTool.ActivationShortcut); UICheckBox snapToggle = group.AddCheckbox( "Snap to middle node", NodeControllerTool.SnapToMiddleNode.value, val => NodeControllerTool.SnapToMiddleNode.value = val) as UICheckBox; snapToggle.tooltip = "when you click near a middle node:\n" + " - [checked] => Node controller modifies the node\n" + " - [unchceked] => Node controller moves the node to hovered position."; FixTooltipAlignment(snapToggle); UICheckBox TMPE_Overlay = group.AddCheckbox( "Hide TMPE overlay on the selected node", NodeControllerTool.Hide_TMPE_Overlay.value, val => NodeControllerTool.Hide_TMPE_Overlay.value = val) as UICheckBox; TMPE_Overlay.tooltip = "Holding control hides all TMPE overlay.\n" + "but if this is checked, you don't have to (excluding Corssings/Uturn)"; FixTooltipAlignment(TMPE_Overlay); }
public void OnSettingsUI(UIHelperBase helper) { try { if (FindIt.instance == null) { AssetTagList.instance = new AssetTagList(); } UIHelper group = helper.AddGroup(Name) as UIHelper; UIPanel panel = group.self as UIPanel; UICheckBox 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("Center the main toolbar", FindIt.centerToolbar.value, (b) => { FindIt.centerToolbar.value = b; if (FindIt.instance != null) { FindIt.instance.UpdateMainToolbar(); } }); checkBox.tooltip = "The main toolbar will be centered if it exceed a certain length."; checkBox = (UICheckBox)group.AddCheckbox("Unlock all", FindIt.unlockAll.value, (b) => { FindIt.unlockAll.value = b; }); checkBox.tooltip = "Let you select and place items even when locked."; group.AddSpace(10); UICheckBox fixProps = (UICheckBox)group.AddCheckbox("Fix bad props next loaded save", false, (b) => { FindIt.fixBadProps = b; }); fixProps.tooltip = "Remove all props causing issue\nCheck the option and load your save"; group.AddSpace(10); panel.gameObject.AddComponent <OptionsKeymapping>(); group.AddSpace(10); } catch (Exception e) { DebugUtils.Log("OnSettingsUI failed"); DebugUtils.LogException(e); } }
public static void Make(ExtUITabstrip tabStrip) { UIHelper panelHelper = tabStrip.AddTabPage("Startup"); panelHelper.AddLabel("restart required to take effect.", textColor: Color.yellow); panelHelper.AddSpace(10); panelHelper.AddButton("Reset load orders", OnResetLoadOrdersClicked); panelHelper.AddCheckbox( "remove ad panels", ConfigUtil.Config.TurnOffSteamPanels, val => { ConfigUtil.Config.TurnOffSteamPanels = val; ConfigUtil.SaveConfig(); }); var c2 = panelHelper.AddCheckbox( "Improve content manager", ConfigUtil.Config.FastContentManager, val => { ConfigUtil.Config.FastContentManager = val; ConfigUtil.SaveConfig(); }) as UIComponent; c2.tooltip = "faster content manager"; var c3 = panelHelper.AddCheckbox( "Add harmony resolver", ConfigUtil.Config.AddHarmonyResolver, val => { ConfigUtil.Config.AddHarmonyResolver = val; ConfigUtil.SaveConfig(); }) as UICheckBox; var c4 = panelHelper.AddCheckbox( "Cache asset details for the tool.", ConfigUtil.Config.UGCCache, val => { ConfigUtil.Config.UGCCache = val; ConfigUtil.SaveConfig(); }) as UICheckBox; var c5 = panelHelper.AddCheckbox( "Hide steam download errors (Ignorance is bliss!)", ConfigUtil.Config.IgnoranceIsBliss, val => { ConfigUtil.Config.IgnoranceIsBliss = val; ConfigUtil.SaveConfig(); }) as UICheckBox; }
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); } }
public static void makeSettings(UIHelperBase helper) { UIHelper actualHelper = helper as UIHelper; UIComponent container = actualHelper.self as UIComponent; enableGridToggle = actualHelper.AddCheckbox("Enable Grid", GlobalConfig.Instance.EnableVehicleManagerGrid, onEnableGridChanged) as UICheckBox; }
public void OnSettingsUI(UIHelperBase helper) { /* * NoBuoysModConfig config = Configuration<NoBuoysModConfig>.Load(); * * bool isEnabled = config.NoBuoysEnabled; * * helper.AddCheckbox( "Remove buoys", isEnabled, sel => { * config.NoBuoysEnabled = sel; * Configuration<NoBuoysModConfig>.Save(); * } ); */ UIHelper group = helper.AddGroup(Name) as UIHelper; UIPanel panel = group.self as UIPanel; UICheckBox checkBox = (UICheckBox)group.AddCheckbox(translation.GetTranslation("NBM_REMOVE_BUOYS"), NoBuoysMod.noBuoysEnabled.value, (b) => { NoBuoysMod.noBuoysEnabled.value = b; }); checkBox.tooltip = translation.GetTranslation("NBM_REMOVE_BUOYS_TOOLTIP"); panel.gameObject.AddComponent <OptionsKeymapping>(); group.AddSpace(10); }
public void OnSettingsUI(UIHelperBase helper) { try { UIHelper group = helper.AddGroup(Name) as UIHelper; UICheckBox checkBox = (UICheckBox)group.AddCheckbox("Disable button capture", MoreShortcuts.disableCapture.value, (b) => { MoreShortcuts.disableCapture.value = b; }); checkBox.tooltip = "If checked, you will not be able to add new shortcuts.\nThe capture key will no longer highlight buttons.\n"; group.AddSpace(10); UIDropDown dropDown = (UIDropDown)group.AddDropdown("Capture key:", new string[] { "Alt", "Ctrl", "Shift", "Alt + Ctrl", "Alt + Shift", "Ctrl + Shift", "Ctrl + Alt + Shift" }, MoreShortcuts.captureKey.value, (b) => { MoreShortcuts.captureKey.value = b; }); dropDown.tooltip = "Select the desired capture key combination"; group.AddSpace(10); UIPanel panel = group.self as UIPanel; UILabel label = panel.AddUIComponent <UILabel>(); label.textScale = 1.125f; label.text = "Shortcuts:"; panel.gameObject.AddComponent <OptionsKeymapping>(); } catch (Exception e) { DebugUtils.Log("OnSettingsUI failed"); DebugUtils.LogException(e); } }
public void OnSettingsUI(UIHelperBase helper) { try { UIHelper group = helper.AddGroup(Name) as UIHelper; UIPanel panel = group.self as UIPanel; UICheckBox 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); panel.gameObject.AddComponent <OptionsKeymapping>(); group.AddSpace(10); } catch (Exception e) { DebugUtils.Log("OnSettingsUI failed"); DebugUtils.LogException(e); } }
public void OnSettingsUI(UIHelperBase helper) { try { UIHelper group = helper.AddGroup(Name) as UIHelper; UIPanel panel = group.self as UIPanel; panel.gameObject.AddComponent <OptionsKeymapping>(); group.AddSpace(10); UICheckBox checkBox = (UICheckBox)group.AddCheckbox("Disable Undo/Redo shortcuts when using unsupported tools", sa_disableShortcuts.value, (b) => { sa_disableShortcuts.value = b; }); checkBox.tooltip = "Shortcuts are inactive when using unsupported tools (eg. zoning tool) or tools with their own undo implementation (eg. Move It!)\n" + "Warning: Although the shortcuts are disabled, all actions are still saved in undo queue!"; checkBox = (UICheckBox)group.AddCheckbox("Ignore costs", sa_ignoreCosts.value, (b) => { sa_ignoreCosts.value = b; }); checkBox.tooltip = "Undo/Redo won't change account balance"; group.AddSpace(10); UITextField tf = null; tf = (UITextField)group.AddTextfield("Undo queue capacity (hit enter to submit): ", sa_queueCapacity.value.ToString(), (text) => { }, (text) => { int val; if (int.TryParse(text, out val) && val > 0) { UndoMod.Instsance.ChangeQueueCapacity(val); sa_queueCapacity.value = val; } else { tf.text = "10"; } }); tf.tooltip = "Warning: Current queue will be discarded\nDefault value is 10"; } catch (Exception e) { Debug.Log("OnSettingsUI failed"); Debug.LogException(e); } }
public static void Make(ExtUITabstrip tabStrip) { UIHelper panelHelper = tabStrip.AddTabPage("Developer"); panelHelper.AddCheckbox( "Soft assembly dependency", ConfigUtil.Config.SoftDLLDependancy, val => { ConfigUtil.Config.SoftDLLDependancy = val; ConfigUtil.SaveConfig(); }); panelHelper.AddButton("Ensure All", CheckSubsUtil.EnsureAll); //g.AddButton("RequestItemDetails", OnRequestItemDetailsClicked); //g.AddButton("QueryItems", OnQueryItemsClicked); panelHelper.AddButton("RunCallbacks", OnRunCallbacksClicked); var bufferedToggle = panelHelper.AddCheckbox("Buffered Log", Log.Buffered, (val) => Log.Buffered = val) as UICheckBox; bufferedToggle.eventVisibilityChanged += new PropertyChangedEventHandler <bool>((_, ___) => bufferedToggle.isChecked = Log.Buffered); }
void Check(UIHelper group, string text, string tooltip, bool enabled, OnCheckChanged action) { try { UIComponent check = group.AddCheckbox(text, enabled, action) as UIComponent; check.tooltip = tooltip; } catch (Exception e) { UnityEngine.Debug.LogException(e); } }
public static void MakeGameSettings(UIHelperBase helper) { UIHelper group = helper.AddGroup("Game settings") as UIHelper; UIPanel panel = group.self as UIPanel; UICheckBox universalFixes = group.AddCheckbox( "apply universal slope fixes(flat jucntions, curvitute of extreme slopes)", defaultValue: GameConfig?.UnviversalSlopeFixes ?? GameConfigT.NewGameDefault.UnviversalSlopeFixes, ApplyUniversalSlopeFixes) as UICheckBox; universalFixes.tooltip = "changing this may influence existing custom nodes."; }
public UICheckBox Draw(UIHelper group, ICities.OnCheckChanged callback = null) { UICheckBox chb; chb = (UICheckBox)group.AddCheckbox(Description, this.value, (b) => { this.value = b; if (callback != null) { callback.Invoke(b); } }); chb.tooltip = Tooltip; return(chb); }
public static void OnSettingsUI(UIHelperBase helper) { UIHelper group = helper.AddGroup("Network Detective") as UIHelper; UIPanel panel = group.self as UIPanel; var keymappings = panel.gameObject.AddComponent <UIKeymappingsPanel>(); keymappings.AddKeymapping("Activation Shortcut", NetworkDetectiveTool.ActivationShortcut); var ShowLaneType = group.AddCheckbox( "Display lane type/vehicle type in parantheses in front of each lane.", InLineLaneInfo.value, val => InLineLaneInfo.value = val); }
public static void MakeGameSettings(UIHelperBase helper) { UIHelper group = helper.AddGroup("Game settings") as UIHelper; UIPanel panel = group.self as UIPanel; object val = GameConfig?.UnviversalSlopeFixes; val = val ?? "null"; Log.Debug($"MakeGameSettings: UnviversalSlopeFixes =" + val); universalFixes_ = group.AddCheckbox( "apply universal slope fixes(flat junctions, curvature of extreme slopes)", defaultValue: GameConfig?.UnviversalSlopeFixes ?? GameConfigT.NewGameDefault.UnviversalSlopeFixes, ApplyUniversalSlopeFixes) as UICheckBox; universalFixes_.tooltip = "changing this may influence existing custom nodes."; }
//Special Thanks to SamsamTS' mod MoveIt! on how to add Main Menu settings. public void OnSettingsUI(UIHelperBase helper) { try { UIHelper _UIHelper = helper.AddGroup(this.Name) as UIHelper; UIPanel _UIPanel = _UIHelper.self as UIPanel; UICheckBox _UICheckbox = (UICheckBox)_UIHelper.AddCheckbox("PLT Anarchy ON by default >> see tooltip <<", UserSettingsMainMenu.anarchyPLTOnByDefault.value, OnAnarchyPLTDefaultChecked); _UICheckbox.tooltip = "If enabled, automatically enables PLT Anarchy on map load.\n\n>> Recommended to also enable:\nProp & Tree Anarchy: \"Anarchy ON by default\"\n(separate mod). <<"; _UICheckbox.playAudioEvents = true; } catch (Exception e) { Debug.LogError("[PLT]: OnSettingsUI failed!"); Debug.LogException(e); } }
private static void AddCheckboxPanel(UIHelper group, string mainLabel, SavedBool mainSaved, SavedInt optionsSaved, string[] labels) { var inProcess = false; var checkBoxes = new UICheckBox[labels.Length]; var optionsPanel = default(UIPanel); var mainCheckBox = group.AddCheckbox(mainLabel, mainSaved, OnMainChanged) as UICheckBox; optionsPanel = (group.self as UIComponent).AddUIComponent <UIPanel>(); optionsPanel.autoLayout = true; optionsPanel.autoLayoutDirection = LayoutDirection.Vertical; optionsPanel.autoFitChildrenHorizontally = true; optionsPanel.autoFitChildrenVertically = true; optionsPanel.autoLayoutPadding = new RectOffset(25, 0, 0, 5); var panelHelper = new UIHelper(optionsPanel); for (var i = 0; i < checkBoxes.Length; i += 1) { var index = i; checkBoxes[i] = panelHelper.AddCheckbox(labels[i], optionsSaved == i, (value) => Set(index, value)) as UICheckBox; } SetVisible(); void OnMainChanged(bool value) { mainSaved.value = value; SetVisible(); } void SetVisible() => optionsPanel.isVisible = mainSaved; void Set(int index, bool value) { if (!inProcess) { inProcess = true; optionsSaved.value = index; for (var i = 0; i < checkBoxes.Length; i += 1) { checkBoxes[i].isChecked = optionsSaved == i; } inProcess = false; } } }
public void OnSettingsUI(UIHelperBase helper) { try { UIHelper group = helper.AddGroup(Name) as UIHelper; UIPanel uipanel = group.self as UIPanel; group.AddSpace(10); uipanel.gameObject.AddComponent <OptionsKeymapping>(); group.AddSpace(10); UICheckBox checkBox = (UICheckBox)group.AddCheckbox("Show mod icon on toolbar (needs reload)", ShowUIButton.value, (b) => { ShowUIButton.value = b; }); checkBox.tooltip = "Show Adjust Pathfinding icon in road tools panel (You can always use the shortcut to open mod menu)"; group.AddSpace(10); group.AddButton("Reset tool window position", () => { savedWindowX.Delete(); savedWindowY.Delete(); if (UIWindow.Instance != null) { UIWindow.Instance.absolutePosition = defWindowPosition; } }); group.AddSpace(10); group.AddButton("Acknowledgements & Developer Info", () => { UIWindow.ThrowErrorMsg(DeveloperInfo); }); } catch (Exception e) { Debug.LogError("OnSettingsUI failed"); Debug.Log(e); } }
private UICheckBox CreateCheckBox(UIPanel parent, string name, string text, string tooltip, bool defaultValue, OnCheckChanged onCheckChanged) { var helper = new UIHelper(parent); var cb = (UICheckBox)helper.AddCheckbox(text, defaultValue, onCheckChanged); cb.name = name; cb.tooltip = tooltip; cb.height = 16.0f; var lbl = cb.Find <UILabel>("Label"); lbl.textScale = 0.8125f; lbl.anchor = UIAnchorStyle.Top | UIAnchorStyle.Left; var rp = lbl.relativePosition; rp.y = 2.0f; lbl.relativePosition = rp; cb.width = lbl.relativePosition.x + lbl.width; return(cb); }
public void OnSettingsUI(UIHelperBase helper) { try { UIHelper group = helper.AddGroup(Name) as UIHelper; UIPanel panel = group.self as UIPanel; UICheckBox checkBox = (UICheckBox)group.AddCheckbox(Translations.Translate("NTCP_SET_VAN"), Settings.skipVanillaProps, (b) => { Settings.skipVanillaProps = b; XMLUtils.SaveSettings(); }); checkBox.tooltip = Translations.Translate("NTCP_SET_VANTP"); group.AddSpace(10); // languate settings UIDropDown languageDropDown = (UIDropDown)group.AddDropdown(Translations.Translate("TRN_CHOICE"), Translations.LanguageList, Translations.Index, (value) => { Translations.Index = value; XMLUtils.SaveSettings(); }); languageDropDown.width = 300; group.AddSpace(10); // show path to NonTerrainConformingPropsConfig.xml string path = Path.Combine(DataLocation.executableDirectory, "NonTerrainConformingPropsConfig.xml"); UITextField customTagsFilePath = (UITextField)group.AddTextfield(Translations.Translate("NTCP_SET_CONF") + " - NonTerrainConformingPropsConfig.xml", path, _ => { }, _ => { }); customTagsFilePath.width = panel.width - 30; group.AddButton(Translations.Translate("NTCP_SET_CONFFE"), () => System.Diagnostics.Process.Start(DataLocation.executableDirectory)); } catch (Exception e) { Debug.Log("OnSettingsUI failed"); Debug.LogException(e); } }
private static void AddShowOnlyMajor(UIHelper group) { var showOnlyMajorCheckBox = group.AddCheckbox(Localize.Settings_ShowOnlyMajor, ShowOnlyMajor, OnShowOnlyMajorChanged) as UICheckBox; void OnShowOnlyMajorChanged(bool request) => ShowOnlyMajor.value = request; }
private static void AddShowWhatsNew(UIHelper group) { var showWhatsNewCheckBox = group.AddCheckbox(Localize.Settings_ShowWhatsNew, ShowWhatsNew, OnShowWhatsNewChanged) as UICheckBox; void OnShowWhatsNewChanged(bool request) => ShowWhatsNew.value = request; }
private static void AddGroupLines(UIHelper group) { var groupLinesCheckBox = group.AddCheckbox(Localize.Settings_GroupLines, GroupLines, OnGroupLinesChanged) as UICheckBox; void OnGroupLinesChanged(bool groupLines) => GroupLines.value = groupLines; }
private static void AddQuickRuleSetup(UIHelper group) { var quickRuleSetupCheckBox = group.AddCheckbox(Localize.Settings_QuickRuleSetup, QuickRuleSetup, OnQuickRuleSetupChanged) as UICheckBox; void OnQuickRuleSetupChanged(bool request) => QuickRuleSetup.value = request; }
public void OnSettingsUI(UIHelperBase helper) { try { UIHelper uiHelper = helper.AddGroup(this.Name) as UIHelper; UIPanel self = uiHelper.self as UIPanel; ((UIComponent)uiHelper.AddCheckbox( "Enable custom vehicles", Settings.enableCustomVehicles, b => Settings.enableCustomVehicles.value = b)) .tooltip = "Enable ability to set vehicle types used by service buildings. Disable to use default game logic or other mods."; ((UIComponent)uiHelper.AddCheckbox( "Enable dummy cargo traffic", Settings.enableDummyCargoTraffic, b => Settings.enableDummyCargoTraffic.value = b)) .tooltip = "By default, the base game will generate a little dummy cargo traffic. Disable this option if you have massive traffic problems emanating from outside connections."; ((UIComponent)uiHelper.AddCheckbox( "Enable ability to customize industries supply chain", Settings.enableIndustriesControl, b => Settings.enableIndustriesControl.value = b)) .tooltip = "By default, the mod offers the ability to control your industries supply chain. Disable this option if you want the base game to control the supply chain."; ((UIComponent)uiHelper.AddCheckbox( "Enable legacy ability to select individual outside connections using the tool", Settings.enableSelectOutsideConnection, b => Settings.enableSelectOutsideConnection.value = b)) .tooltip = "Strongly recommend against enabling this legacy feature. This was originally put in to deal with massive traffic originating from outside connections. Not needed anymore."; ((UIComponent)uiHelper.AddCheckbox( "Show campus districts in district dropdown menu", Settings.showCampusDistricts, b => Settings.showCampusDistricts.value = b)) .tooltip = "Disable this option if you do not wish to be able to see campus districts in the dropdown menu."; ((UIComponent)uiHelper.AddCheckbox( "Show industry districts in district dropdown menu", Settings.showIndustryDistricts, b => Settings.showIndustryDistricts.value = b)) .tooltip = "Disable this option if you do not wish to be able to see industry districts in the dropdown menu."; ((UIComponent)uiHelper.AddCheckbox( "Show park districts in district dropdown menu", Settings.showParkDistricts, b => Settings.showParkDistricts.value = b)) .tooltip = "Disable this option if you do not wish to be able to see park districts in the dropdown menu."; ((UIComponent)uiHelper.AddCheckbox( "Show welcome message", Settings.showWelcomeMessage, b => Settings.showWelcomeMessage.value = b)) .tooltip = "Automatically disabled upon first viewing the welcome message."; uiHelper.AddSpace(10); self.gameObject.AddComponent <UIOptionsKeymapping>(); } catch (Exception ex) { Logger.Log("EnhancedDistrictServicesMod::OnSettingsUI failed"); Logger.LogException(ex); } }
/// <summary> /// Initialises the dialog, populates it with list of incompatible mods, and adds it to the modal stack. /// If the modal stack was previously empty, a blur effect is added over the screen background. /// </summary> public void Initialize() { Log._Debug("IncompatibleModsPanel initialize"); if (mainPanel_ != null) { mainPanel_.OnDestroy(); } modListChanged_ = false; isVisible = true; mainPanel_ = AddUIComponent <UIPanel>(); mainPanel_.backgroundSprite = "UnlockingPanel2"; mainPanel_.color = new Color32(75, 75, 135, 255); width = 600; height = 440; mainPanel_.width = 600; mainPanel_.height = 440; Vector2 resolution = UIView.GetAView().GetScreenResolution(); relativePosition = new Vector3((resolution.x / 2) - 300, resolution.y / 3); mainPanel_.relativePosition = Vector3.zero; warningIcon_ = mainPanel_.AddUIComponent <UISprite>(); warningIcon_.size = new Vector2(40f, 40f); warningIcon_.spriteName = "IconWarning"; warningIcon_.relativePosition = new Vector3(15, 15); warningIcon_.zOrder = 0; title_ = mainPanel_.AddUIComponent <UILabel>(); title_.autoSize = true; title_.padding = new RectOffset(10, 10, 15, 15); title_.relativePosition = new Vector2(60, 12); title_.text = TrafficManagerMod.ModName + " " + Translation.ModConflicts.Get("Window.Title:Detected incompatible mods"); closeButton_ = mainPanel_.AddUIComponent <UIButton>(); closeButton_.eventClick += CloseButtonClick; closeButton_.relativePosition = new Vector3(width - closeButton_.width - 45, 15f); closeButton_.normalBgSprite = "buttonclose"; closeButton_.hoveredBgSprite = "buttonclosehover"; closeButton_.pressedBgSprite = "buttonclosepressed"; UIPanel panel = mainPanel_.AddUIComponent <UIPanel>(); panel.relativePosition = new Vector2(20, 70); panel.size = new Vector2(565, 320); UIHelper helper = new UIHelper(mainPanel_); string checkboxLabel = Translation.ModConflicts.Get("Checkbox:Scan for known incompatible mods on startup"); runModsCheckerOnStartup_ = helper.AddCheckbox( checkboxLabel, GlobalConfig.Instance.Main.ScanForKnownIncompatibleModsAtStartup, RunModsCheckerOnStartup_eventCheckChanged) as UICheckBox; runModsCheckerOnStartup_.relativePosition = new Vector3(20, height - 30f); UIScrollablePanel scrollablePanel = panel.AddUIComponent <UIScrollablePanel>(); scrollablePanel.backgroundSprite = string.Empty; scrollablePanel.size = new Vector2(550, 340); scrollablePanel.relativePosition = new Vector3(0, 0); scrollablePanel.clipChildren = true; scrollablePanel.autoLayoutStart = LayoutStart.TopLeft; scrollablePanel.autoLayoutDirection = LayoutDirection.Vertical; scrollablePanel.autoLayout = true; // Populate list of incompatible mods if (IncompatibleMods.Count != 0) { IncompatibleMods.ForEach( pair => { CreateEntry(ref scrollablePanel, pair.Value, pair.Key); }); } scrollablePanel.FitTo(panel); scrollablePanel.scrollWheelDirection = UIOrientation.Vertical; scrollablePanel.builtinKeyNavigation = true; UIScrollbar verticalScroll = panel.AddUIComponent <UIScrollbar>(); verticalScroll.stepSize = 1; verticalScroll.relativePosition = new Vector2(panel.width - 15, 0); verticalScroll.orientation = UIOrientation.Vertical; verticalScroll.size = new Vector2(20, 320); verticalScroll.incrementAmount = 25; verticalScroll.scrollEasingType = EasingType.BackEaseOut; scrollablePanel.verticalScrollbar = verticalScroll; UISlicedSprite track = verticalScroll.AddUIComponent <UISlicedSprite>(); track.spriteName = "ScrollbarTrack"; track.relativePosition = Vector3.zero; track.size = new Vector2(16, 320); verticalScroll.trackObject = track; UISlicedSprite thumb = track.AddUIComponent <UISlicedSprite>(); thumb.spriteName = "ScrollbarThumb"; thumb.autoSize = true; thumb.relativePosition = Vector3.zero; verticalScroll.thumbObject = thumb; // Add blur effect if applicable blurEffect_ = GameObject.Find("ModalEffect").GetComponent <UIComponent>(); AttachUIComponent(blurEffect_.gameObject); blurEffect_.size = new Vector2(resolution.x, resolution.y); blurEffect_.absolutePosition = new Vector3(0, 0); blurEffect_.SendToBack(); blurEffect_.eventPositionChanged += OnBlurEffectPositionChange; blurEffect_.eventZOrderChanged += OnBlurEffectZOrderChange; blurEffect_.opacity = 0; blurEffect_.isVisible = true; ValueAnimator.Animate( "ModalEffect", val => blurEffect_.opacity = val, new AnimatedFloat(0f, 1f, 0.7f, EasingType.CubicEaseOut)); // Make sure modal dialog is in front of all other UI BringToFront(); }
private static void AddDeleteRequest(UIHelper group) { var requestCheckBox = group.AddCheckbox(Localize.Settings_ShowDeleteWarnings, DeleteWarnings, OnDeleteRequestChanged) as UICheckBox; void OnDeleteRequestChanged(bool request) => DeleteWarnings.value = request; }