From 5ae4a13f2beda4dd1b191a47ce434a26dc40ae14 Mon Sep 17 00:00:00 2001 From: Rich Dunne Date: Mon, 14 Sep 2020 16:42:51 -0600 Subject: [PATCH] Moved some variable assignments back into their build menu method. --- SceneManager/Menus/EditWaypointMenu.cs | 9 ++++----- SceneManager/Menus/PathCreationMenu.cs | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/SceneManager/Menus/EditWaypointMenu.cs b/SceneManager/Menus/EditWaypointMenu.cs index c40c1ec..b50943a 100644 --- a/SceneManager/Menus/EditWaypointMenu.cs +++ b/SceneManager/Menus/EditWaypointMenu.cs @@ -17,8 +17,8 @@ namespace SceneManager internal static UIMenuItem addAsNewWaypoint = new UIMenuItem("Add as New Waypoint", "Adds a new waypoint to the end of the path with these settings"); internal static UIMenuNumericScrollerItem editWaypoint; internal static UIMenuListScrollerItem changeWaypointType = new UIMenuListScrollerItem("Waypoint Type", "", waypointTypes); - private static UIMenuNumericScrollerItem changeWaypointSpeed = new UIMenuNumericScrollerItem("Waypoint Speed", $"How fast the AI will drive to the waypoint in ~b~{SettingsMenu.speedUnits.SelectedItem}", 5, 80, 5); - internal static UIMenuCheckboxItem collectorWaypoint = new UIMenuCheckboxItem("Collector", true, "If this waypoint will collect vehicles to follow the path"); + private static UIMenuNumericScrollerItem changeWaypointSpeed; + internal static UIMenuCheckboxItem collectorWaypoint; internal static UIMenuNumericScrollerItem changeCollectorRadius = new UIMenuNumericScrollerItem("Collection Radius", "The distance from this waypoint (in meters) vehicles will be collected", 1, 50, 1); internal static UIMenuNumericScrollerItem changeSpeedZoneRadius = new UIMenuNumericScrollerItem("Speed Zone Radius", "The distance from this collector waypoint (in meters) non-collected vehicles will drive at this waypoint's speed", 5, 200, 5); internal static UIMenuCheckboxItem updateWaypointPosition = new UIMenuCheckboxItem("Update Waypoint Position", false, "Updates the waypoint's position to the player's current position. You should turn this on if you're planning on adding this waypoint as a new waypoint."); @@ -49,11 +49,10 @@ namespace SceneManager editWaypointMenu.AddItem(changeWaypointType); changeWaypointType.Index = Array.IndexOf(drivingFlags, currentWaypoint.DrivingFlag); - editWaypointMenu.AddItem(changeWaypointSpeed); + editWaypointMenu.AddItem(changeWaypointSpeed = new UIMenuNumericScrollerItem("Waypoint Speed", $"How fast the AI will drive to the waypoint in ~b~{SettingsMenu.speedUnits.SelectedItem}", 5, 80, 5)); changeWaypointSpeed.Value = (int)MathHelper.ConvertMetersPerSecondToMilesPerHour(currentWaypoint.Speed); - editWaypointMenu.AddItem(collectorWaypoint); - collectorWaypoint.Checked = currentWaypoint.IsCollector; + editWaypointMenu.AddItem(collectorWaypoint = new UIMenuCheckboxItem("Collector", currentWaypoint.IsCollector, "If this waypoint will collect vehicles to follow the path")); editWaypointMenu.AddItem(changeCollectorRadius); changeCollectorRadius.Value = currentWaypoint.CollectorRadius != 0 diff --git a/SceneManager/Menus/PathCreationMenu.cs b/SceneManager/Menus/PathCreationMenu.cs index 9f7b1b8..d726e3e 100644 --- a/SceneManager/Menus/PathCreationMenu.cs +++ b/SceneManager/Menus/PathCreationMenu.cs @@ -16,7 +16,7 @@ namespace SceneManager internal static UIMenu pathCreationMenu = new UIMenu("Scene Manager", "~o~Path Creation Menu"); private static UIMenuItem trafficAddWaypoint = new UIMenuItem("Add waypoint"), trafficRemoveWaypoint = new UIMenuItem("Remove last waypoint"), trafficEndPath = new UIMenuItem("End path creation"); internal static UIMenuListScrollerItem waypointType = new UIMenuListScrollerItem("Waypoint Type", $"~b~Drive To (Normal): ~w~AI obeys traffic as much as possible{Environment.NewLine}~b~Drive To (Direct): ~w~AI ignores pathfinding rules{Environment.NewLine}~b~Stop: ~w~AI stops at the waypoint until dismissed", waypointTypes); - private static UIMenuNumericScrollerItem waypointSpeed = new UIMenuNumericScrollerItem("Waypoint Speed", $"How fast the AI will drive to the waypoint in ~b~{SettingsMenu.speedUnits.SelectedItem}", 5, 80, 5); + private static UIMenuNumericScrollerItem waypointSpeed; internal static UIMenuCheckboxItem collectorWaypoint = new UIMenuCheckboxItem("Collector", true, "If this waypoint will collect vehicles to follow the path. Your path's first waypoint ~b~must~w~ be a collector."); internal static UIMenuNumericScrollerItem collectorRadius = new UIMenuNumericScrollerItem("Collection Radius", "The distance from this waypoint (in meters) vehicles will be collected", 1, 50, 1); internal static UIMenuNumericScrollerItem speedZoneRadius = new UIMenuNumericScrollerItem("Speed Zone Radius", "The distance from this collector waypoint (in meters) non-collected vehicles will drive at this waypoint's speed", 5, 200, 5); @@ -31,7 +31,7 @@ namespace SceneManager { pathCreationMenu.AddItem(waypointType); - pathCreationMenu.AddItem(waypointSpeed); + pathCreationMenu.AddItem(waypointSpeed = new UIMenuNumericScrollerItem("Waypoint Speed", $"How fast the AI will drive to the waypoint in ~b~{SettingsMenu.speedUnits.SelectedItem}", 5, 80, 5)); waypointSpeed.Index = 0; pathCreationMenu.AddItem(collectorWaypoint);