public static void MakeSettings(UIHelperBase helper)
        {
            ExtUITabstrip tabStrip = ExtUITabstrip.Create(helper);

            OptionsGeneralTab.MakeSettings_General(tabStrip);
            OptionsGameplayTab.MakeSettings_Gameplay(tabStrip);
            OptionsVehicleRestrictionsTab.MakeSettings_VehicleRestrictions(tabStrip);
            OptionsOverlaysTab.MakeSettings_Overlays(tabStrip);
            OptionsMaintenanceTab.MakeSettings_Maintenance(tabStrip);
            OptionsKeybindsTab.MakeSettings_Keybinds(tabStrip);
            tabStrip.Invalidate();
        }
        public static void SetTurnOnRedEnabled(bool newValue)
        {
            Options.turnOnRedEnabled = newValue;

            if (_turnOnRedEnabledToggle != null)
            {
                _turnOnRedEnabledToggle.isChecked = newValue;
            }

            if (!newValue)
            {
                OptionsVehicleRestrictionsTab.SetAllowNearTurnOnRed(false);
                OptionsVehicleRestrictionsTab.SetAllowFarTurnOnRed(false);
            }
        }
        private static void OnTimedLightsEnabledChanged(bool val)
        {
            if (!Options.IsGameLoaded())
            {
                return;
            }

            Options.timedLightsEnabled = val;
            Options.RebuildMenu();

            if (!val)
            {
                OptionsOverlaysTab.SetTimedLightsOverlay(false);
                OptionsVehicleRestrictionsTab.SetTrafficLightPriorityRules(false);
            }
        }
Пример #4
0
        private static void OnPrioritySignsEnabledChanged(bool val)
        {
            if (!Options.IsGameLoaded())
            {
                return;
            }

            Options.MenuRebuildRequired  = true;
            Options.prioritySignsEnabled = val;

            if (!val)
            {
                OptionsOverlaysTab.SetPrioritySignsOverlay(false);
                OptionsVehicleRestrictionsTab.SetTrafficLightPriorityRules(false);
            }
        }
        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
            OptionsGeneralTab.MakeSettings_General(tabStrip, tabIndex);

            // GAMEPLAY
            ++tabIndex;
            OptionsGameplayTab.MakeSettings_Gameplay(tabStrip, tabIndex);

            // VEHICLE RESTRICTIONS
            ++tabIndex;
            OptionsVehicleRestrictionsTab.MakeSettings_VehicleRestrictions(tabStrip, tabIndex);

            // OVERLAYS
            ++tabIndex;
            OptionsOverlaysTab.MakeSettings_Overlays(tabStrip, tabIndex);

            // MAINTENANCE
            ++tabIndex;
            OptionsMaintenanceTab.MakeSettings_Maintenance(tabStrip, tabIndex);

            // KEYBOARD
            ++tabIndex;
            OptionsKeybindsTab.MakeSettings_Keybinds(tabStrip, tabIndex);

            tabStrip.selectedIndex = 0;
        }
        private static void OnJunctionRestrictionsEnabledChanged(bool val)
        {
            if (!Options.IsGameLoaded())
            {
                return;
            }

            Options.junctionRestrictionsEnabled = val;
            Options.RebuildMenu();

            if (!val)
            {
                OptionsVehicleRestrictionsTab.SetAllowUTurns(false);
                OptionsVehicleRestrictionsTab.SetAllowEnterBlockedJunctions(false);
                OptionsVehicleRestrictionsTab.SetAllowLaneChangesWhileGoingStraight(false);
                SetTurnOnRedEnabled(false);
                OptionsOverlaysTab.SetJunctionRestrictionsOverlay(false);
            }
        }