diff --git a/SceneManager/Menus/PathCreationMenu.cs b/SceneManager/Menus/PathCreationMenu.cs index 082238c..acedbb2 100644 --- a/SceneManager/Menus/PathCreationMenu.cs +++ b/SceneManager/Menus/PathCreationMenu.cs @@ -75,7 +75,7 @@ namespace SceneManager if (SettingsMenu.debugGraphics.Checked) { - DebugGraphics.LoopToDrawDebugGraphics(SettingsMenu.debugGraphics, PathMainMenu.GetPaths()[0]); + DebugGraphics.LoopToDrawDebugGraphics(PathMainMenu.GetPaths()[0]); } } else if(anyPathsExist && !PathMainMenu.GetPaths().Any(p => p != null && p.State == State.Creating)) @@ -84,13 +84,13 @@ namespace SceneManager if (SettingsMenu.debugGraphics.Checked) { - DebugGraphics.LoopToDrawDebugGraphics(SettingsMenu.debugGraphics, PathMainMenu.GetPaths().Where(p => p != null && p.State == State.Creating).First()); + DebugGraphics.LoopToDrawDebugGraphics(PathMainMenu.GetPaths().Where(p => p != null && p.State == State.Creating).First()); } } var firstNonNullPath = PathMainMenu.GetPaths().Where(p => p != null && p.State == State.Creating).First(); var pathIndex = PathMainMenu.GetPaths().IndexOf(firstNonNullPath); - var currentPath = firstNonNullPath.PathNum; + var currentPath = firstNonNullPath.Number; var currentWaypoint = PathMainMenu.GetPaths()[pathIndex].Waypoints.Count + 1; var drivingFlag = drivingFlags[waypointType.Index]; var blip = CreateWaypointBlip(pathIndex, drivingFlag); @@ -150,18 +150,12 @@ namespace SceneManager var currentPath = PathMainMenu.GetPaths()[i]; if (PathMainMenu.GetPaths().ElementAtOrDefault(i) != null && currentPath.State == State.Creating) { - Game.LogTrivial($"[Path Creation] Path {currentPath.PathNum} finished with {currentPath.Waypoints.Count} waypoints."); + Game.LogTrivial($"[Path Creation] Path {currentPath.Number} finished with {currentPath.Waypoints.Count} waypoints."); Game.DisplayNotification($"~o~Scene Manager\n~g~[Success]~w~ Path {i + 1} complete."); - //currentPath.Waypoints.Last().Blip.Color = Color.OrangeRed; - //if (currentPath.Waypoints.Last().CollectorRadiusBlip) - //{ - // currentPath.Waypoints.Last().CollectorRadiusBlip.Color = Color.OrangeRed; - //} currentPath.State = State.Finished; - //currentPath.FinishPath(); currentPath.EnablePath(); currentPath.SetPathNumber(i + 1); - PathMainMenu.AddPathToPathCountList(i, currentPath.PathNum); + //PathMainMenu.AddPathToPathCountList(i, currentPath.PathNum); // For each waypoint in the path's WaypointData, start a collector game fiber and loop while the path and waypoint exist, and while the path is enabled foreach (Waypoint waypoint in PathMainMenu.GetPaths()[i].Waypoints) diff --git a/SceneManager/Menus/PathMainMenu.cs b/SceneManager/Menus/PathMainMenu.cs index 6673d30..b038d95 100644 --- a/SceneManager/Menus/PathMainMenu.cs +++ b/SceneManager/Menus/PathMainMenu.cs @@ -9,17 +9,20 @@ namespace SceneManager { static class PathMainMenu { + private static List paths = new List() { }; + public static UIMenu pathMainMenu { get; private set; } public static UIMenuItem createNewPath { get; private set; } public static UIMenuItem deleteAllPaths; - public static UIMenuListScrollerItem editPath { get; private set; } + public static UIMenuNumericScrollerItem editPath = new UIMenuNumericScrollerItem("Edit Path", "", 1, paths.Count, 1); + //public static UIMenuListScrollerItem editPath { get; private set; } public static UIMenuListScrollerItem directOptions { get; private set; } - public static UIMenuListScrollerItem directDriver { get; private set; } + public static UIMenuNumericScrollerItem directDriver = new UIMenuNumericScrollerItem("Direct nearest driver to path", "", 1, paths.Count, 1); + //public static UIMenuListScrollerItem directDriver { get; private set; } public static UIMenuListScrollerItem dismissDriver { get; private set; } public static UIMenuCheckboxItem disableAllPaths { get; private set; } - private static List pathsNum = new List(); - private static List paths = new List() { }; + //private static List pathsNum = new List(); private static List dismissOptions = new List() { "From path", "From waypoint", "From position" }; public enum Delete { @@ -44,13 +47,15 @@ namespace SceneManager pathMainMenu.AddItem(createNewPath = new UIMenuItem("Create New Path")); createNewPath.ForeColor = Color.Gold; - pathMainMenu.AddItem(editPath = new UIMenuListScrollerItem("Edit Path", "", pathsNum)); + pathMainMenu.AddItem(editPath = new UIMenuNumericScrollerItem("Edit Path", "", 1, paths.Count, 1)); + //pathMainMenu.AddItem(editPath = new UIMenuListScrollerItem("Edit Path", "", pathsNum)); editPath.ForeColor = Color.Gold; pathMainMenu.AddItem(disableAllPaths = new UIMenuCheckboxItem("Disable All Paths", false)); pathMainMenu.AddItem(deleteAllPaths = new UIMenuItem("Delete All Paths")); deleteAllPaths.ForeColor = Color.Gold; pathMainMenu.AddItem(directOptions = new UIMenuListScrollerItem("Direct driver to path's", "", new[] { "First waypoint", "Nearest waypoint" })); - pathMainMenu.AddItem(directDriver = new UIMenuListScrollerItem("Direct nearest driver to path", "", pathsNum)); + pathMainMenu.AddItem(directDriver = new UIMenuNumericScrollerItem("Direct nearest driver to path", "", 1, paths.Count, 1)); + //pathMainMenu.AddItem(directDriver = new UIMenuListScrollerItem("Direct nearest driver to path", "", pathsNum)); directDriver.ForeColor = Color.Gold; pathMainMenu.AddItem(dismissDriver = new UIMenuListScrollerItem("Dismiss nearest driver", "", dismissOptions)); dismissDriver.ForeColor = Color.Gold; @@ -80,10 +85,10 @@ namespace SceneManager return ref paths; } - public static void AddPathToPathCountList(int indexToInsertAt, int pathNum) - { - pathsNum.Insert(indexToInsertAt, pathNum); - } + //public static void AddPathToPathCountList(int indexToInsertAt, int pathNum) + //{ + // pathsNum.Insert(indexToInsertAt, pathNum); + //} private static bool VehicleAndDriverValid(this Vehicle v) { @@ -115,8 +120,8 @@ namespace SceneManager { // Before deleting a path, we need to dismiss any vehicles controlled by that path and remove the vehicles from ControlledVehicles //Game.LogTrivial($"Deleting path {index+1}"); - Game.LogTrivial($"Deleting path {path.PathNum}"); - var pathVehicles = VehicleCollector.collectedVehicles.Where(cv => cv.Path == path.PathNum).ToList(); + Game.LogTrivial($"Deleting path {path.Number}"); + var pathVehicles = VehicleCollector.collectedVehicles.Where(cv => cv.Path == path.Number).ToList(); Game.LogTrivial($"Removing all vehicles on the path"); foreach (CollectedVehicle cv in pathVehicles.Where(cv => cv.Vehicle && cv.Vehicle.Driver)) @@ -158,11 +163,11 @@ namespace SceneManager paths.RemoveAt(index); //Game.LogTrivial("pathsNum count: " + pathsNum.Count); //Game.LogTrivial("index: " + index); - pathsNum.RemoveAt(index); + //pathsNum.RemoveAt(index); BuildPathMenu(); pathMainMenu.Visible = true; - Game.LogTrivial($"Path {path.PathNum} deleted."); - Game.DisplayNotification($"~o~Scene Manager\n~w~Path {path.PathNum} deleted."); + Game.LogTrivial($"Path {path.Number} deleted."); + Game.DisplayNotification($"~o~Scene Manager\n~w~Path {path.Number} deleted."); } EditPathMenu.editPathMenu.Reset(true, true); @@ -182,8 +187,8 @@ namespace SceneManager if (paths.ElementAtOrDefault(i) != null && paths[i].State == State.Creating) { //Game.LogTrivial($"pathFinished: {paths[i].PathFinished}"); - Game.LogTrivial($"Resuming path {paths[i].PathNum}"); - Game.DisplayNotification($"~o~Scene Manager\n~y~[Creating]~w~ Resuming path {paths[i].PathNum}"); + Game.LogTrivial($"Resuming path {paths[i].Number}"); + Game.DisplayNotification($"~o~Scene Manager\n~y~[Creating]~w~ Resuming path {paths[i].Number}"); break; } } @@ -211,7 +216,7 @@ namespace SceneManager path.Waypoints.Clear(); } paths.Clear(); - pathsNum.Clear(); + //pathsNum.Clear(); BuildPathMenu(); pathMainMenu.Visible = true; Game.LogTrivial($"All paths deleted"); @@ -256,7 +261,7 @@ namespace SceneManager { VehicleCollector.collectedVehicles.Add(new CollectedVehicle(nearbyVehicle, nearbyVehicle.LicensePlate, paths[directDriver.Index].Waypoints[0].Path, paths[directDriver.Index].Waypoints.Count, 1, false, false)); var collectedVehicle = VehicleCollector.collectedVehicles.Where(cv => cv.Vehicle == nearbyVehicle) as CollectedVehicle; - Game.LogTrivial($"[Direct Driver] {nearbyVehicle.Model.Name} not in collection, adding to collection for path {paths[directDriver.Index].PathNum} with {paths[directDriver.Index].Waypoints.Count} waypoints"); + Game.LogTrivial($"[Direct Driver] {nearbyVehicle.Model.Name} not in collection, adding to collection for path {paths[directDriver.Index].Number} with {paths[directDriver.Index].Waypoints.Count} waypoints"); if (directOptions.SelectedItem == "First waypoint") {