예제 #1
0
        protected void setToFile(T i, int?value)
        {
            SavedInt data = GetSavedInt(i);

            if (value == null)
            {
                data.Delete();
            }
            else
            {
                data.value = value.Value;
            }

            eventOnPropertyChanged?.Invoke(i, null, value, null);
        }
예제 #2
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);
            }
        }
        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);
            }
        }