Esempio n. 1
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                UIHelper group = helper.AddGroup(Name) as UIHelper;
                UIPanel  panel = group.self as UIPanel;

                sb_SuppressAllExceptions.Draw(group);

                group.AddSpace(10);

                group.AddButton("Clear list of suppressed exceptions", () =>
                {
                    ExceptionTemplate.ResetSuppressing();
                });

                group.AddSpace(10);

                group.AddButton("Open log folder", () =>
                {
                    Utils.OpenInFileBrowser(Application.dataPath);
                });
            }
            catch (Exception e)
            {
                Debug.Log("OnSettingsUI failed");
                Debug.LogException(e);
            }
        }
Esempio n. 2
0
        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);

                F5toExec.Draw(group);
                SyncExecution.Draw(group, (b) => {
                    PythonConsole.CreateInstance();
                });
                ShowRemoteConsole.Draw(group);
                DoNotLaunchRemoteConsole.Draw(group);

                group.AddSpace(10);

                group.AddButton("Kill python engine", () => {
                    PythonConsole.KillInstance();
                });
            }
            catch (Exception e) {
                Debug.Log("OnSettingsUI failed");
                Debug.LogException(e);
            }
        }
Esempio n. 3
0
        private static void AddDump(UIHelper group)
        {
            var button = group.AddButton(Localize.Settings_DumpMarkingButton, Click) as UIButton;

            void Click()
            {
                var result = Serializer.OnDumpData(out string path);

                if (result)
                {
                    var messageBox = MessageBoxBase.ShowModal <TwoButtonMessageBox>();
                    messageBox.CaprionText    = Localize.Settings_DumpMarkingCaption;
                    messageBox.MessageText    = Localize.Settings_DumpMarkingMessageSuccess;
                    messageBox.Button1Text    = Localize.Settings_DumpMarkingButton1;
                    messageBox.Button2Text    = Localize.Settings_DumpMarkingButton2;
                    messageBox.OnButton1Click = CopyToClipboard;

                    bool CopyToClipboard()
                    {
                        Clipboard.text = path;
                        return(false);
                    }
                }
                else
                {
                    var messageBox = MessageBoxBase.ShowModal <OkMessageBox>();
                    messageBox.CaprionText = Localize.Settings_DumpMarkingCaption;
                    messageBox.MessageText = Localize.Settings_DumpMarkingMessageFailed;
                }
            }
        }
        /*
         * 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));
        }
Esempio n. 5
0
        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);
            }
        }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
0
        private static UIButton AddButton(UIHelper group, string text, OnButtonClicked click, float width = 400)
        {
            var button = group.AddButton(text, click) as UIButton;

            button.autoSize = false;
            button.textHorizontalAlignment = UIHorizontalAlignment.Center;
            button.width = width;

            return(button);
        }
Esempio n. 8
0
        private void Initialise()
        {
            if (_helper == null)
            {
                width         = 400;
                height        = 500;
                isInteractive = true;
                enabled       = true;

                _helper           = new UIHelper(this);
                _titleBar         = AddUIComponent <UITitleBar>();
                _informationLabel = AddUIComponent <UILabel>();
                _totalPanel       = AddUIComponent <UIPanel>();
                _totalAmountLabel = _totalPanel.AddUIComponent <UILabel>();
                _totalIncomeLabel = _totalPanel.AddUIComponent <UILabel>();
                _costLabel        = _totalPanel.AddUIComponent <UILabel>();
                _incomeLabel      = _totalPanel.AddUIComponent <UILabel>();
                _incentiveList    = UIFastList.Create <UIFastListIncentives>(this);

                _titleBar.Initialise(CimTools.CimToolsHandler.CimToolBase);

                _ticketSlider = _helper.AddSlider("Tickets", 100, 9000, 10, 500, delegate(float value)
                {
                    if (_incentiveList != null)
                    {
                        FastList <object> optionItems = _incentiveList.rowsData;

                        foreach (IncentiveOptionItem optionItemObject in optionItems)
                        {
                            optionItemObject.ticketCount = value;
                            optionItemObject.UpdateTicketSize();
                        }
                    }
                }) as UISlider;

                _startDaySlider = _helper.AddSlider("Days", 0, 7, 1, 0, delegate(float value)
                {
                    CalculateTotal();
                }) as UISlider;

                TimeOfDaySlider startTimeSliderOptions = new TimeOfDaySlider()
                {
                    uniqueName = "Time", value = 12f
                };
                _startTimeSlider = startTimeSliderOptions.Create(_helper) as UISlider;
                _startTimeSlider.eventValueChanged += delegate(UIComponent component, float value)
                {
                    CalculateTotal();
                };

                _createButton = _helper.AddButton("Create", new OnButtonClicked(CreateEvent)) as UIButton;

                CimTools.CimToolsHandler.CimToolBase.Translation.OnLanguageChanged += Translation_OnLanguageChanged;
            }
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        private static void AddImport(UIHelper group)
        {
            var button = group.AddButton(Localize.Settings_ImportMarkingButton, Click) as UIButton;

            void Click()
            {
                var messageBox = MessageBoxBase.ShowModal <ImportMessageBox>();

                messageBox.CaprionText = Localize.Settings_ImportMarkingCaption;
                messageBox.MessageText = Localize.Settings_ImportMarkingMessage;
            }
        }
Esempio n. 11
0
        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;
        }
Esempio n. 12
0
        public void CreateUi(UIHelperBase helper, DoorstopManager manager)
        {
            _manager = manager;
            var uiHelper = helper as UIHelper;
            var panel    = uiHelper.self as UIScrollablePanel;
            var label    = panel.AddUIComponent <UILabel>();

            label.relativePosition = new Vector3(10, 0, 10);
            label.processMarkup    = true;

            StringBuilder builder         = new StringBuilder();
            StringBuilder internalBuilder = new StringBuilder();
            bool          anyError        = false;

            foreach (KeyValuePair <string, PatchStatus> patchStatus in PatchLoaderStatusInfo.Statuses)
            {
                if (patchStatus.Value.HasError)
                {
                    anyError = true;
                    builder.Append("   ")
                    .Append(patchStatus.Key)
                    .Append(": <color ").Append(colorError).Append(">")
                    .Append("Error (").Append(patchStatus.Value.ErrorMessage).AppendLine(") </color>");
                }
                internalBuilder.Append("   ")
                .Append(patchStatus.Key)
                .Append(patchStatus.Value.HasError ? ": Error (" : ": OK")
                .Append(patchStatus.Value.HasError ? patchStatus.Value.ErrorMessage : "")
                .AppendLine(patchStatus.Value.HasError ? ")" : "");
            }

            if (!anyError && PatchLoaderStatusInfo.Statuses.Count > 0)
            {
                builder.Append("   ")
                .Append("<color").Append(colorOk).Append(">").Append("All patches applied correctly").AppendLine("</color>").AppendLine();
            }

            label.text = "Statuses:\n\n" + (PatchLoaderStatusInfo.Statuses.Count > 0 ? builder.ToString() : "No patches processed.\n");

            _logger?.Info("Statuses:\n" + internalBuilder);

            UIHelper loaderGroup = helper.AddGroup("Loader") as UIHelper;
            var      uiPanel     = loaderGroup.self as UIPanel;

            _statusLabel = uiPanel.AddUIComponent <UILabel>();
            _statusLabel.processMarkup = true;
            _upgradeButton             = loaderGroup.AddButton("Upgrade", OnUpgrade) as UIButton;
            UpdateStatus();
        }
Esempio n. 13
0
        void Button(UIHelper group, string text, string tooltip, OnButtonClicked action)
        {
            try
            {
                UIButton button = group.AddButton(text, action) as UIButton;
                button.textScale = 0.875f;

                if (tooltip != null)
                {
                    button.tooltip = tooltip;
                }
            }
            catch (Exception e)
            {
                UnityEngine.Debug.LogException(e);
            }
        }
Esempio n. 14
0
        public void MakeSettings(UIHelperBase helperBase)
        {
            UIHelper    helper    = helperBase as UIHelper;
            UIComponent container = helper.self as UIComponent;

            _ui_always                          = container.AddUIComponent <UICheckboxDropDownExt>();
            _ui_always.Title                    = "Always";
            _ui_always.selectedItems            = Split(loaded_always);
            _ui_always.eventAfterDropdownClose += (_) => PrefabUtils.CacheAlways(_ui_always.selectedItems);
            PrefabUtils.CacheAlways(_ui_always.selectedItems);


            _ui_never                          = container.AddUIComponent <UICheckboxDropDownExt>();
            _ui_never.Title                    = "Never";
            _ui_never.selectedItems            = Split(loaded_never);
            _ui_never.eventAfterDropdownClose += (_) => PrefabUtils.CacheNever(_ui_never.selectedItems);
            PrefabUtils.CacheNever(_ui_never.selectedItems);

            helper.AddButton("Save", Save);
        }
Esempio n. 15
0
        private static void AddDeleteAll(UIHelper group)
        {
            var button = group.AddButton(Localize.Settings_DeleteMarkingButton, Click) as UIButton;

            button.textColor = Color.red;

            void Click()
            {
                var messageBox = MessageBoxBase.ShowModal <YesNoMessageBox>();

                messageBox.CaprionText    = Localize.Settings_DeleteMarkingCaption;
                messageBox.MessageText    = Localize.Settings_DeleteMarkingMessage;
                messageBox.OnButton1Click = Сonfirmed;
            }

            bool Сonfirmed()
            {
                MarkupManager.DeleteAll();
                return(true);
            }
        }
Esempio n. 16
0
        public void MakeSettings(UIHelperBase helperBase)
        {
            UIHelper    helper    = helperBase as UIHelper;
            UIComponent container = helper.self as UIComponent;

            Extensions.Init();
            bool active = Extensions.IsActive;

#if DEBUG
            active = true; // Fast test of options from main menu
#endif
            void RefreshPrefabs()
            {
                if (PrefabUtils.PrefabsLoaded)
                {
                    NetInfoExt.InitNetInfoExtArray();
                }
            }

            if (active)
            {
                _ui_never               = container.AddUIComponent <UICheckboxDropDownExt>();
                _ui_never.Title         = "Except List";
                _ui_never.tooltip       = "TMPE cannot hide crosswalks from roads in this list.\nThis list does not affect NS2 junction markings.";
                _ui_never.selectedItems = Split(loaded_never);

                void HandleAfterDropdownClose(UICheckboxDropDown _) => RefreshPrefabs();

                _ui_never.eventAfterDropdownClose += HandleAfterDropdownClose;
                RefreshPrefabs();

                helper.AddButton("Save", Save);
            }
            else
            {
                var label = container.AddUIComponent <UILabel>();
                label.text = "Options are only available in game";
            }
        }
Esempio n. 17
0
        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);
            }
        }
        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);
            }
        }
        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
        }
Esempio n. 20
0
        public static void OnSettingsUI(UIHelper helper)
        {
            helper.AddButton("Reset all settings", () =>
            {
                MainWindow.Instance.Config = new ModConfiguration();
                foreach (HotKey hotkey in Hotkeys)
                {
                    hotkey.ResetToDefault();
                }
                SaveConfig();
            });

            helper.AddCheckbox("Scale to resolution", Config.ScaleToResolution, val =>
            {
                Config.ScaleToResolution = val;
                SaveConfig();
            });

            var debugRendererIncludeAll = helper.AddCheckbox(
                "Debug renderer excludes UI components that do not respond to mouse",
                Config.DebugRendererExcludeUninteractive, val =>
            {
                Config.DebugRendererExcludeUninteractive = val;
                SaveConfig();
            }) as UIComponent;

            debugRendererIncludeAll.tooltip = "their children will be shown either way.";

            var debugRendererAutoTurnOff = helper.AddCheckbox(
                "Automatically turn off debug renderer",
                Config.DebugRendererAutoTurnOff, val =>
            {
                Config.DebugRendererAutoTurnOff = val;
                SaveConfig();
            }) as UIComponent;

            debugRendererAutoTurnOff.tooltip = "turns off debug render when user shows UI component in scene explorer";

            helper.AddSlider2(
                "UI Scale",
                25, 400, 10,
                Config.UIScale * 100,
                val =>
            {
                if (Config.UIScale != val)
                {
                    Config.UIScale = val * 0.01f;
                    SaveConfig();
                }

                return("%" + val);
            });

            var g           = helper.AddGroup("Hot Keys");
            var keymappings = g.Panel().gameObject.AddComponent <UIKeymappingsPanel>();

            keymappings.AddKeymapping("Selection Tool", SelectionToolKey);
            keymappings.AddKeymapping("Debug Console", ConsoleKey);
            keymappings.AddKeymapping("Main window", MainWindowKey);
            keymappings.AddKeymapping("Watches", WatchesKey);
            keymappings.AddKeymapping("Script Editor", ScriptEditorKey);
            keymappings.AddKeymapping("Scene Explorer", SceneExplorerKey);
            keymappings.AddKeymapping("Debug Renderer", DebugRendererKey);
            keymappings.AddKeymapping("Debug Renderer\\show in SceneExplorer", ShowComponentKey);
            keymappings.AddKeymapping("Debug Renderer\\iterate", IterateComponentKey);
        }
Esempio n. 21
0
        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);

                checkBox = (UICheckBox)group.AddCheckbox("Reduce rail catenary masts", FineRoadTool.reduceCatenary.value, (b) =>
                {
                    FineRoadTool.reduceCatenary.value = b;
                    if (FineRoadTool.instance != null)
                    {
                        FineRoadTool.instance.UpdateCatenary();
                    }
                });
                checkBox.tooltip = "Reduce the number of catenary mast of rail lines from 3 to 1 per segment.\n";

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox("Change max turn angle for more realistic tram tracks turns", FineRoadTool.changeMaxTurnAngle.value, (b) =>
                {
                    FineRoadTool.changeMaxTurnAngle.value = b;

                    if (b)
                    {
                        RoadPrefab.SetMaxTurnAngle(FineRoadTool.maxTurnAngle);
                    }
                    else
                    {
                        RoadPrefab.ResetMaxTurnAngle();
                    }
                });
                checkBox.tooltip = "Change all roads with tram tracks max turn angle by the value below if current value is higher";

                group.AddTextfield("Max turn angle: ", FineRoadTool.maxTurnAngle.ToString(), (f) => {},
                                   (s) =>
                {
                    float f = 0;
                    float.TryParse(s, out f);

                    FineRoadTool.maxTurnAngle.value = Mathf.Clamp(f, 0f, 180f);

                    if (FineRoadTool.changeMaxTurnAngle.value)
                    {
                        RoadPrefab.SetMaxTurnAngle(FineRoadTool.maxTurnAngle.value);
                    }
                });

                group.AddSpace(10);

                panel.gameObject.AddComponent <OptionsKeymapping>();

                group.AddSpace(10);

                group.AddButton("Reset tool window position", () =>
                {
                    UIToolOptionsButton.savedWindowX.Delete();
                    UIToolOptionsButton.savedWindowY.Delete();

                    if (UIToolOptionsButton.toolOptionsPanel)
                    {
                        UIToolOptionsButton.toolOptionsPanel.absolutePosition = new Vector3(-1000, -1000);
                    }
                });
            }
            catch (Exception e)
            {
                DebugUtils.Log("OnSettingsUI failed");
                DebugUtils.LogException(e);
            }
        }
        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;

            // GENERAL

            AddOptionTab(tabStrip, Translation.GetString("General"));            // tabStrip.AddTab(Translation.GetString("General"), tabTemplate, true);
            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);

            simAccuracyDropdown = panelHelper.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;

            var featureGroup = panelHelper.AddGroup(Translation.GetString("Activated_features"));

            enablePrioritySignsToggle        = featureGroup.AddCheckbox(Translation.GetString("Priority_signs"), prioritySignsEnabled, onPrioritySignsEnabledChanged) as UICheckBox;
            enableTimedLightsToggle          = featureGroup.AddCheckbox(Translation.GetString("Timed_traffic_lights"), timedLightsEnabled, onTimedLightsEnabledChanged) as UICheckBox;
            enableCustomSpeedLimitsToggle    = featureGroup.AddCheckbox(Translation.GetString("Speed_limits"), customSpeedLimitsEnabled, onCustomSpeedLimitsEnabledChanged) as UICheckBox;
            enableVehicleRestrictionsToggle  = featureGroup.AddCheckbox(Translation.GetString("Vehicle_restrictions"), vehicleRestrictionsEnabled, onVehicleRestrictionsEnabledChanged) as UICheckBox;
            enableJunctionRestrictionsToggle = featureGroup.AddCheckbox(Translation.GetString("Junction_restrictions"), junctionRestrictionsEnabled, onJunctionRestrictionsEnabledChanged) as UICheckBox;
            enableLaneConnectorToggle        = featureGroup.AddCheckbox(Translation.GetString("Lane_connector"), laneConnectorEnabled, onLaneConnectorEnabledChanged) as UICheckBox;

            // GAMEPLAY
            ++tabIndex;

            AddOptionTab(tabStrip, Translation.GetString("Gameplay"));
            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 vehBehaviorGroup = panelHelper.AddGroup(Translation.GetString("Vehicle_behavior"));

            recklessDriversDropdown            = vehBehaviorGroup.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;
            realisticSpeedsToggle              = vehBehaviorGroup.AddCheckbox(Translation.GetString("Realistic_speeds"), realisticSpeeds, onRealisticSpeedsChanged) as UICheckBox;
            strongerRoadConditionEffectsToggle = vehBehaviorGroup.AddCheckbox(Translation.GetString("Road_condition_has_a_bigger_impact_on_vehicle_speed"), strongerRoadConditionEffects, onStrongerRoadConditionEffectsChanged) as UICheckBox;
            enableDespawningToggle             = vehBehaviorGroup.AddCheckbox(Translation.GetString("Enable_despawning"), enableDespawning, onEnableDespawningChanged) as UICheckBox;

            var vehAiGroup = panelHelper.AddGroup(Translation.GetString("Advanced_Vehicle_AI"));

            advancedAIToggle = vehAiGroup.AddCheckbox(Translation.GetString("Enable_Advanced_Vehicle_AI"), advancedAI, onAdvancedAIChanged) as UICheckBox;
#if DEBUG
            //if (SystemInfo.processorCount >= DYNAMIC_RECALC_MIN_PROCESSOR_COUNT)
            //dynamicPathRecalculationToggle = vehAiGroup.AddCheckbox(Translation.GetString("Enable_dynamic_path_calculation"), dynamicPathRecalculation, onDynamicPathRecalculationChanged) as UICheckBox;
#endif
            highwayRulesToggle    = vehAiGroup.AddCheckbox(Translation.GetString("Enable_highway_specific_lane_merging/splitting_rules"), highwayRules, onHighwayRulesChanged) as UICheckBox;
            preferOuterLaneToggle = vehAiGroup.AddCheckbox(Translation.GetString("Heavy_trucks_prefer_outer_lanes_on_highways"), preferOuterLane, onPreferOuterLaneChanged) as UICheckBox;

            var parkAiGroup = panelHelper.AddGroup(Translation.GetString("Parking_AI"));
            prohibitPocketCarsToggle = parkAiGroup.AddCheckbox(Translation.GetString("Enable_more_realistic_parking") + " (BETA feature)", prohibitPocketCars, onProhibitPocketCarsChanged) as UICheckBox;

            // VEHICLE RESTRICTIONS
            ++tabIndex;

            AddOptionTab(tabStrip, Translation.GetString("Policies_&_Restrictions"));
            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 atJunctionsGroup = panelHelper.AddGroup(Translation.GetString("At_junctions"));
#if DEBUG
            allRelaxedToggle = atJunctionsGroup.AddCheckbox(Translation.GetString("All_vehicles_may_ignore_lane_arrows"), allRelaxed, onAllRelaxedChanged) as UICheckBox;
#endif
            relaxedBussesToggle = atJunctionsGroup.AddCheckbox(Translation.GetString("Busses_may_ignore_lane_arrows"), relaxedBusses, onRelaxedBussesChanged) as UICheckBox;
            allowEnterBlockedJunctionsToggle = atJunctionsGroup.AddCheckbox(Translation.GetString("Vehicles_may_enter_blocked_junctions"), allowEnterBlockedJunctions, onAllowEnterBlockedJunctionsChanged) as UICheckBox;
            allowUTurnsToggle = atJunctionsGroup.AddCheckbox(Translation.GetString("Vehicles_may_do_u-turns_at_junctions"), allowUTurns, onAllowUTurnsChanged) as UICheckBox;
            allowLaneChangesWhileGoingStraightToggle = atJunctionsGroup.AddCheckbox(Translation.GetString("Vehicles_going_straight_may_change_lanes_at_junctions"), allowLaneChangesWhileGoingStraight, onAllowLaneChangesWhileGoingStraightChanged) as UICheckBox;

            if (SteamHelper.IsDLCOwned(SteamHelper.DLC.NaturalDisastersDLC))
            {
                var inCaseOfEmergencyGroup = panelHelper.AddGroup(Translation.GetString("In_case_of_emergency"));
                evacBussesMayIgnoreRulesToggle = inCaseOfEmergencyGroup.AddCheckbox(Translation.GetString("Evacuation_busses_may_ignore_traffic_rules"), evacBussesMayIgnoreRules, onEvacBussesMayIgnoreRulesChanged) as UICheckBox;
            }

            // OVERLAYS
            ++tabIndex;

            AddOptionTab(tabStrip, Translation.GetString("Overlays"));
            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);

            prioritySignsOverlayToggle        = panelHelper.AddCheckbox(Translation.GetString("Priority_signs"), prioritySignsOverlay, onPrioritySignsOverlayChanged) as UICheckBox;
            timedLightsOverlayToggle          = panelHelper.AddCheckbox(Translation.GetString("Timed_traffic_lights"), timedLightsOverlay, onTimedLightsOverlayChanged) as UICheckBox;
            speedLimitsOverlayToggle          = panelHelper.AddCheckbox(Translation.GetString("Speed_limits"), speedLimitsOverlay, onSpeedLimitsOverlayChanged) as UICheckBox;
            vehicleRestrictionsOverlayToggle  = panelHelper.AddCheckbox(Translation.GetString("Vehicle_restrictions"), vehicleRestrictionsOverlay, onVehicleRestrictionsOverlayChanged) as UICheckBox;
            junctionRestrictionsOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Junction_restrictions"), junctionRestrictionsOverlay, onJunctionRestrictionsOverlayChanged) as UICheckBox;
            connectedLanesOverlayToggle       = panelHelper.AddCheckbox(Translation.GetString("Connected_lanes"), connectedLanesOverlay, onConnectedLanesOverlayChanged) as UICheckBox;
            nodesOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Nodes_and_segments"), nodesOverlay, onNodesOverlayChanged) as UICheckBox;
            showLanesToggle    = panelHelper.AddCheckbox(Translation.GetString("Lanes"), showLanes, onShowLanesChanged) as UICheckBox;
#if DEBUG
            vehicleOverlayToggle  = panelHelper.AddCheckbox(Translation.GetString("Vehicles"), vehicleOverlay, onVehicleOverlayChanged) as UICheckBox;
            citizenOverlayToggle  = panelHelper.AddCheckbox(Translation.GetString("Citizens"), citizenOverlay, onCitizenOverlayChanged) as UICheckBox;
            buildingOverlayToggle = panelHelper.AddCheckbox(Translation.GetString("Buildings"), buildingOverlay, onBuildingOverlayChanged) as UICheckBox;
#endif

            // MAINTENANCE
            ++tabIndex;

            AddOptionTab(tabStrip, Translation.GetString("Maintenance"));
            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);

            forgetTrafficLightsBtn = panelHelper.AddButton(Translation.GetString("Forget_toggled_traffic_lights"), onClickForgetToggledLights) as UIButton;
            resetStuckEntitiesBtn  = panelHelper.AddButton(Translation.GetString("Reset_stuck_cims_and_vehicles"), onClickResetStuckEntities) as UIButton;
#if DEBUG
            resetSpeedLimitsBtn = panelHelper.AddButton(Translation.GetString("Reset_custom_speed_limits"), onClickResetSpeedLimits) as UIButton;
#endif
            reloadGlobalConfBtn = panelHelper.AddButton(Translation.GetString("Reload_global_configuration"), onClickReloadGlobalConf) as UIButton;
            resetGlobalConfBtn  = panelHelper.AddButton(Translation.GetString("Reset_global_configuration"), onClickResetGlobalConf) as UIButton;
#if DEBUG
            // DEBUG

            /*++tabIndex;
             *
             * settingsButton = tabStrip.AddTab("Debug", tabTemplate, true);
             * settingsButton.textPadding = new RectOffset(10, 10, 10, 10);
             * settingsButton.autoSize = true;
             * settingsButton.tooltip = "Debug";
             *
             * 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);
             *
             * debugSwitchFields.Clear();
             * for (int i = 0; i < debugSwitches.Length; ++i) {
             *      int index = i;
             *      string varName = $"Debug switch #{i}";
             *      debugSwitchFields.Add(panelHelper.AddCheckbox(varName, debugSwitches[i], delegate (bool newVal) { onBoolValueChanged(varName, newVal, ref debugSwitches[index]); }) as UICheckBox);
             * }
             *
             * debugValueFields.Clear();
             * for (int i = 0; i < debugValues.Length; ++i) {
             *      int index = i;
             *      string varName = $"Debug value #{i}";
             *      debugValueFields.Add(panelHelper.AddTextfield(varName, String.Format("{0:0.##}", debugValues[i]), delegate(string newValStr) { onFloatValueChanged(varName, newValStr, ref debugValues[index]); }, null) as UITextField);
             * }*/
#endif

            tabStrip.selectedIndex = 0;
        }
Esempio n. 23
0
        public static void Make(ExtUITabstrip tabStrip)
        {
            UIHelper panelHelper = tabStrip.AddTabPage("Subscriptions");

            UIButton   button;
            UICheckBox checkBox;

            //g.AddButton("Perform All", OnPerformAllClicked);

            button         = panelHelper.AddButton("Refresh workshop items (checks for bad items)", RequestItemDetails) as UIButton;
            button.tooltip = "checks for missing/partially downloaded/outdated items";

            button         = panelHelper.AddButton("unsubscribe from deprecated workshop items [EXPERIMENTAL] ", () => CheckSubsUtil.Instance.UnsubDepricated()) as UIButton;
            button.tooltip = "if steam does not return item path, i assume its deprecated.";

            button           = panelHelper.AddButton("Resubscribe to all broken downloads (exits game) [EXPERIMENTAL]", CheckSubsUtil.ResubcribeExternally) as UIButton;
            button.tooltip   = "less steam can hide problems. if you use less steam please click 'Refresh workshop items' to get all broken downloads";
            button.isVisible = false; //hide for now.

            checkBox = panelHelper.AddCheckbox(
                "Delete unsubscribed items on startup",
                Config.DeleteUnsubscribedItemsOnLoad,
                val => {
                ConfigUtil.Config.DeleteUnsubscribedItemsOnLoad = val;
                ConfigUtil.SaveConfig();
            }) as UICheckBox;

            button = panelHelper.AddButton("Delete Now", () => CheckSubsUtil.Instance.DeleteUnsubbed()) as UIButton;
            Settings.Pairup(checkBox, button);

            {
                var g = panelHelper.AddGroup("Broken downloads") as UIHelper;

                tfSteamPath_ = g.AddTextfield(
                    text: "Steam Path: ",
                    defaultContent: ConfigUtil.Config.SteamPath ?? "",
                    eventChangedCallback: _ => { },
                    eventSubmittedCallback : delegate(string text) {
                    if (CheckSteamPath(text))
                    {
                        ConfigUtil.Config.SteamPath = text;
                        ConfigUtil.SaveConfig();
                    }
                }) as UITextField;
                tfSteamPath_.width   = 650;
                tfSteamPath_.tooltip = "Path to steam.exe";
                g.AddButton("Redownload broken downloads [EXPERIMENTAL]", delegate() {
                    try {
                        var path = tfSteamPath_.text;
                        if (CheckSteamPath(path))
                        {
                            CheckSubsUtil.ReDownload(path);
                            Prompt.Warning("Exit",
                                           "Please exit to desktop, wait for steam download to finish, and then start Cities skylines again.\n" +
                                           "Should this not work the first time, please try again.");
                        }
                    } catch (Exception ex) {
                        ex.Log();
                    }
                });
            }

            //b = g.AddButton("delete duplicates", OnPerformAllClicked) as UIButton;
            //b.tooltip = "when excluded mod is updated, and included duplicate of it is created";
        }
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                UIHelper group = helper.AddGroup(Name) as UIHelper;
                UIPanel  panel = group.self as UIPanel;

                UICheckBox checkBox = (UICheckBox)group.AddCheckbox("Show mod icon on toolbar (needs reload)", ShowUIButton.value, (b) =>
                {
                    ShowUIButton.value = b;
                });
                checkBox.tooltip = "Show the Roundabout Builder icon in road tools panel (You can always use CTRL+O to open the mod menu)";

                checkBox = (UICheckBox)group.AddCheckbox("Use the selected road in roads menu as the roundabout road", FollowRoadToolSelection.value, (b) =>
                {
                    FollowRoadToolSelection.value = b;
                });
                checkBox.tooltip = "Your selected road for the roundabout will change as you browse through the roads menu";

                checkBox = (UICheckBox)group.AddCheckbox("Require money", NeedMoney.value, (b) =>
                {
                    NeedMoney.value = b;
                });
                checkBox.tooltip = "Building a roundabout will cost you money";

                checkBox = (UICheckBox)group.AddCheckbox("Use old snapping algorithm", UseOldSnappingAlgorithm.value, (b) =>
                {
                    UseOldSnappingAlgorithm.value = b;
                });
                checkBox.tooltip = "Old snapping algorithm connects roads at 90° angle, but distorts their geometry";

                checkBox = (UICheckBox)group.AddCheckbox("Allow selection of two-way roads", SelectTwoWayRoads.value, (b) =>
                {
                    SelectTwoWayRoads.value = b;
                    UIWindow2.instance.dropDown.Populate(); // Reload dropdown menu
                });
                checkBox.tooltip = "You can select two-way roads for your roundabouts through the roads menu (if that option is enabled)";

                checkBox = (UICheckBox)group.AddCheckbox("Do not remove or connect any roads (experimental)", DoNotRemoveAnyRoads.value, (b) =>
                {
                    DoNotRemoveAnyRoads.value = b;
                });
                checkBox.tooltip = "No roads will be removed or connected when the roundabout is built";

                checkBox = (UICheckBox)group.AddCheckbox("Do not filter prefabs (include all networks in the menu)", DoNotFilterPrefabs.value, (b) =>
                {
                    DoNotFilterPrefabs.value = b;
                    UIWindow2.instance.dropDown.Populate(); // Reload dropdown menu
                });
                checkBox.tooltip = "The dropdown menu will include all prefabs available, not only one-way roads";

                checkBox = (UICheckBox)group.AddCheckbox("Use secondary increase / decrease radius keys", UseExtraKeys.value, (b) =>
                {
                    UseExtraKeys.value = b;
                });
                checkBox.tooltip = "If checked, you can use bound keys from the list below to increase / decrease radius (besides the ones on numpad)";

                group.AddSpace(10);

                panel.gameObject.AddComponent <OptionsKeymapping>();

                group.AddSpace(10);

                group.AddButton("Reset tool window position", () =>
                {
                    savedWindowX.Delete();
                    savedWindowY.Delete();

                    if (UIWindow2.instance)
                    {
                        UIWindow2.instance.absolutePosition = defWindowPosition;
                    }
                });

                group.AddSpace(10);

                group.AddButton("Remove glitched roads (Save game inbefore)", () =>
                {
                    Tools.GlitchedRoadsCheck.RemoveGlitchedRoads();
                });
            }
            catch (Exception e)
            {
                Debug.Log("OnSettingsUI failed");
                Debug.LogException(e);
            }
        }
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                UIHelper group = helper.AddGroup(Name) as UIHelper;
                UIPanel  panel = group.self as UIPanel;

                FollowRoadToolSelection.Draw(group);
                NeedMoney.Draw(group);
                CtrlToReverseDirection.Draw(group);
                UnlimitedRadius.Draw(group, (b) =>
                {
                    if (UIWindow.instance != null)
                    {
                        UIWindow.instance.InitPanels();
                    }
                });
                SelectTwoWayRoads.Draw(group, (b) =>
                {
                    if (UIWindow.instance != null)
                    {
                        UIWindow.instance.dropDown.Populate();                            // Reload dropdown menu
                    }
                });
                DoNotFilterPrefabs.Draw(group, (b) =>
                {
                    if (UIWindow.instance != null)
                    {
                        UIWindow.instance.dropDown.Populate();                            // Reload dropdown menu
                    }
                });
                DoNotRemoveAnyRoads.Draw(group);

                group.AddSpace(10);

                ShowUIButton.Draw(group);
                UseExtraKeys.Draw(group);
                UseOldSnappingAlgorithm.Draw(group);
                LegacyEllipticRoundabouts.Draw(group, (b) =>
                {
                    if (UIWindow.instance != null)
                    {
                        UIWindow.instance.InitPanels();
                    }
                });

                group.AddSpace(10);

                panel.gameObject.AddComponent <OptionsKeymapping>();

                group.AddSpace(10);

                group.AddButton("Reset tool window position", () =>
                {
                    savedWindowX.Delete();
                    savedWindowY.Delete();

                    if (UIWindow.instance)
                    {
                        UIWindow.instance.absolutePosition = defWindowPosition;
                    }
                });

                group.AddSpace(10);

                group.AddButton("Remove glitched roads (Save game inbefore)", () =>
                {
                    Tools.GlitchedRoadsCheck.RemoveGlitchedRoads();
                });
            }
            catch (Exception e)
            {
                Debug.Log("OnSettingsUI failed");
                Debug.LogException(e);
            }
        }
Esempio n. 26
0
        /// <summary>
        /// Called by the game when the mod options panel is setup.
        /// </summary>
        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;

                // Disable debug messages logging
                UICheckBox checkBox = (UICheckBox)group.AddCheckbox(Translations.Translate("FIF_SET_DM"), Settings.hideDebugMessages, (b) =>
                {
                    Settings.hideDebugMessages = b;
                    XMLUtils.SaveSettings();
                });
                checkBox.tooltip = Translations.Translate("FIF_SET_DMTP");
                group.AddSpace(10);

                // Center the main toolbar
                checkBox = (UICheckBox)group.AddCheckbox(Translations.Translate("FIF_SET_CMT"), Settings.centerToolbar, (b) =>
                {
                    Settings.centerToolbar = b;
                    XMLUtils.SaveSettings();

                    if (FindIt.instance != null)
                    {
                        FindIt.instance.UpdateMainToolbar();
                    }
                });
                checkBox.tooltip = Translations.Translate("FIF_SET_CMTTP");
                group.AddSpace(10);

                // Unlock all
                checkBox = (UICheckBox)group.AddCheckbox(Translations.Translate("FIF_SET_UL"), Settings.unlockAll, (b) =>
                {
                    Settings.unlockAll = b;
                    XMLUtils.SaveSettings();
                });
                checkBox.tooltip = Translations.Translate("FIF_SET_ULTP");
                group.AddSpace(10);

                // Fix bad props next loaded save
                // Implemented by samsamTS. Need to figure out why this is needed.
                UICheckBox fixProps = (UICheckBox)group.AddCheckbox(Translations.Translate("FIF_SET_BP"), false, (b) =>
                {
                    Settings.fixBadProps = b;
                    XMLUtils.SaveSettings();
                });
                fixProps.tooltip = Translations.Translate("FIF_SET_BPTP");
                group.AddSpace(10);

                // Use system default browser instead of steam overlay
                UICheckBox useDefaultBrowser = (UICheckBox)group.AddCheckbox(Translations.Translate("FIF_SET_DB"), Settings.useDefaultBrowser, (b) =>
                {
                    Settings.useDefaultBrowser = b;
                    XMLUtils.SaveSettings();
                });
                useDefaultBrowser.tooltip = Translations.Translate("FIF_SET_DBTP");
                group.AddSpace(10);

                // Disable update notice
                UICheckBox disableUpdateNotice = (UICheckBox)group.AddCheckbox(Translations.Translate("FIF_SET_DUN"), Settings.disableUpdateNotice, (b) =>
                {
                    Settings.disableUpdateNotice = b;
                    XMLUtils.SaveSettings();
                });
                useDefaultBrowser.tooltip = Translations.Translate("FIF_SET_DBTP");
                group.AddSpace(10);

                // Disable update notice
                UICheckBox separateSearchKeyword = (UICheckBox)group.AddCheckbox(Translations.Translate("FIF_SET_SSK"), Settings.separateSearchKeyword, (b) =>
                {
                    Settings.separateSearchKeyword = b;
                    XMLUtils.SaveSettings();
                });
                separateSearchKeyword.tooltip = Translations.Translate("FIF_SET_SSKTP");
                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 FindItCustomTags.xml
                string      path = Path.Combine(DataLocation.localApplicationData, "FindItCustomTags.xml");
                UITextField customTagsFilePath = (UITextField)group.AddTextfield(Translations.Translate("FIF_SET_CTFL"), path, _ => { }, _ => { });
                customTagsFilePath.width = panel.width - 30;

                // from aubergine10's AutoRepair
                if (Application.platform == RuntimePlatform.WindowsPlayer)
                {
                    group.AddButton(Translations.Translate("FIF_SET_CTFOP"), () => System.Diagnostics.Process.Start("explorer.exe", "/select," + path));
                }

                // shortcut keys
                panel.gameObject.AddComponent <MainButtonKeyMapping>();
                panel.gameObject.AddComponent <AllKeyMapping>();
                panel.gameObject.AddComponent <NetworkKeyMapping>();
                panel.gameObject.AddComponent <PloppableKeyMapping>();
                panel.gameObject.AddComponent <GrowableKeyMapping>();
                panel.gameObject.AddComponent <RicoKeyMapping>();
                panel.gameObject.AddComponent <GrwbRicoKeyMapping>();
                panel.gameObject.AddComponent <PropKeyMapping>();
                panel.gameObject.AddComponent <DecalKeyMapping>();
                panel.gameObject.AddComponent <TreeKeyMapping>();
                panel.gameObject.AddComponent <RandomSelectionKeyMapping>();
                group.AddSpace(10);
            }
            catch (Exception e)
            {
                Debugging.Message("OnSettingsUI failed");
                Debugging.LogException(e);
            }
        }
Esempio n. 27
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                UIHelper group = helper.AddGroup(Name) as UIHelper;
                UIPanel  panel = group.self as UIPanel;

                // Integrate main button with UUI
                UICheckBox integrateMainButtonUUI = (UICheckBox)group.AddCheckbox(Translations.Translate("YAT_SET_UUI"), Settings.integrateMainButtonUUI, (b) =>
                {
                    Settings.integrateMainButtonUUI = b;
                    XMLUtils.SaveSettings();
                    if (YetAnotherToolbar.instance?.mainButton != null)
                    {
                        if (Settings.integrateMainButtonUUI)
                        {
                            UUIIntegration.AttachMainButton();
                        }
                        else
                        {
                            UUIIntegration.DetachMainButton();
                        }
                    }
                });
                group.AddSpace(10);

                // Hide main button
                UICheckBox hideMainButton = (UICheckBox)group.AddCheckbox(Translations.Translate("YAT_SET_HMB"), Settings.hideMainButton, (b) =>
                {
                    Settings.hideMainButton = b;
                    XMLUtils.SaveSettings();
                    if (YetAnotherToolbar.instance?.mainButton != null)
                    {
                        YetAnotherToolbar.instance.mainButton.isVisible = !Settings.hideMainButton;
                    }
                });
                group.AddSpace(10);

                UIButton mainButtonPositionReset = (UIButton)group.AddButton(Translations.Translate("YAT_SET_HMBRST"), () =>
                {
                    Settings.mainButtonX = 538.0f;
                    Settings.mainButtonY = 947.0f;
                    XMLUtils.SaveSettings();
                    if (YetAnotherToolbar.instance?.mainButton != null)
                    {
                        UIView view = UIView.GetAView();
                        Vector2 screenResolution = view.GetScreenResolution();
                        YetAnotherToolbar.instance.mainButton.absolutePosition = new Vector3(Settings.mainButtonX * screenResolution.x / 1920f, Settings.mainButtonY * screenResolution.y / 1080f);// advisorButton.absolutePosition + new Vector3(advisorButton.width, 0);
                    }
                });
                group.AddSpace(10);

                // Hide Advisor Button
                UICheckBox hideAdvisorButton = (UICheckBox)group.AddCheckbox(Translations.Translate("YAT_SET_HAB"), Settings.hideAdvisorButton, (b) =>
                {
                    Settings.hideAdvisorButton = b;
                    XMLUtils.SaveSettings();
                    if (YetAnotherToolbar.instance != null)
                    {
                        YetAnotherToolbar.instance.SetAdvisorButtonVisibility();
                    }
                });
                group.AddSpace(10);

                /*
                 * // Hide Filter Panels
                 * UICheckBox hideFilterPanels = (UICheckBox)group.AddCheckbox(Translations.Translate("YAT_SET_HFP"), Settings.hideFilterPanels, (b) =>
                 * {
                 *  Settings.hideFilterPanels = b;
                 *  XMLUtils.SaveSettings();
                 *  if (YetAnotherToolbar.instance != null)
                 *  {
                 *      YetAnotherToolbar.instance.hideFilterPanels = Settings.hideFilterPanels;
                 *      YetAnotherToolbar.instance.SetFilterPanelsVisibility();
                 *  }
                 * });
                 * group.AddSpace(10);
                 */

                // Disable update notice
                UICheckBox disableUpdateNotice = (UICheckBox)group.AddCheckbox(Translations.Translate("YAT_SET_DUN"), Settings.disableUpdateNotice, (b) =>
                {
                    Settings.disableUpdateNotice = b;
                    XMLUtils.SaveSettings();
                });
                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 YetAnotherToolbarConfig.xml
                string      path           = Path.Combine(DataLocation.executableDirectory, "YetAnotherToolbarConfig.xml");
                UITextField ConfigFilePath = (UITextField)group.AddTextfield($"{Translations.Translate("YAT_SET_CFP")} - YetAnotherToolbarConfig.xml", path, _ => { }, _ => { });
                ConfigFilePath.width = panel.width - 30;

                group.AddButton(Translations.Translate("YAT_SET_OFE"), () => System.Diagnostics.Process.Start(DataLocation.executableDirectory));

                // shortcut keys
                panel.gameObject.AddComponent <ModeToggleKeyMapping>();
                panel.gameObject.AddComponent <QuickMenuKeyMapping>();
                panel.gameObject.AddComponent <HideMenuKeyMapping>();
                group.AddSpace(10);
            }
            catch (Exception e)
            {
                Debugging.Message("OnSettingsUI failed");
                Debugging.LogException(e);
            }
        }