mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 23:50:29 +01:00
Refactored reference names, removed unused code.
This commit is contained in:
parent
6b2cb588cb
commit
801eca2cb2
2 changed files with 29 additions and 30 deletions
|
|
@ -75,7 +75,7 @@ namespace SceneManager
|
||||||
|
|
||||||
if (SettingsMenu.debugGraphics.Checked)
|
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))
|
else if(anyPathsExist && !PathMainMenu.GetPaths().Any(p => p != null && p.State == State.Creating))
|
||||||
|
|
@ -84,13 +84,13 @@ namespace SceneManager
|
||||||
|
|
||||||
if (SettingsMenu.debugGraphics.Checked)
|
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 firstNonNullPath = PathMainMenu.GetPaths().Where(p => p != null && p.State == State.Creating).First();
|
||||||
var pathIndex = PathMainMenu.GetPaths().IndexOf(firstNonNullPath);
|
var pathIndex = PathMainMenu.GetPaths().IndexOf(firstNonNullPath);
|
||||||
var currentPath = firstNonNullPath.PathNum;
|
var currentPath = firstNonNullPath.Number;
|
||||||
var currentWaypoint = PathMainMenu.GetPaths()[pathIndex].Waypoints.Count + 1;
|
var currentWaypoint = PathMainMenu.GetPaths()[pathIndex].Waypoints.Count + 1;
|
||||||
var drivingFlag = drivingFlags[waypointType.Index];
|
var drivingFlag = drivingFlags[waypointType.Index];
|
||||||
var blip = CreateWaypointBlip(pathIndex, drivingFlag);
|
var blip = CreateWaypointBlip(pathIndex, drivingFlag);
|
||||||
|
|
@ -150,18 +150,12 @@ namespace SceneManager
|
||||||
var currentPath = PathMainMenu.GetPaths()[i];
|
var currentPath = PathMainMenu.GetPaths()[i];
|
||||||
if (PathMainMenu.GetPaths().ElementAtOrDefault(i) != null && currentPath.State == State.Creating)
|
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.");
|
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.State = State.Finished;
|
||||||
//currentPath.FinishPath();
|
|
||||||
currentPath.EnablePath();
|
currentPath.EnablePath();
|
||||||
currentPath.SetPathNumber(i + 1);
|
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
|
// 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)
|
foreach (Waypoint waypoint in PathMainMenu.GetPaths()[i].Waypoints)
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,20 @@ namespace SceneManager
|
||||||
{
|
{
|
||||||
static class PathMainMenu
|
static class PathMainMenu
|
||||||
{
|
{
|
||||||
|
private static List<Path> paths = new List<Path>() { };
|
||||||
|
|
||||||
public static UIMenu pathMainMenu { get; private set; }
|
public static UIMenu pathMainMenu { get; private set; }
|
||||||
public static UIMenuItem createNewPath { get; private set; }
|
public static UIMenuItem createNewPath { get; private set; }
|
||||||
public static UIMenuItem deleteAllPaths;
|
public static UIMenuItem deleteAllPaths;
|
||||||
public static UIMenuListScrollerItem<int> editPath { get; private set; }
|
public static UIMenuNumericScrollerItem<int> editPath = new UIMenuNumericScrollerItem<int>("Edit Path", "", 1, paths.Count, 1);
|
||||||
|
//public static UIMenuListScrollerItem<int> editPath { get; private set; }
|
||||||
public static UIMenuListScrollerItem<string> directOptions { get; private set; }
|
public static UIMenuListScrollerItem<string> directOptions { get; private set; }
|
||||||
public static UIMenuListScrollerItem<int> directDriver { get; private set; }
|
public static UIMenuNumericScrollerItem<int> directDriver = new UIMenuNumericScrollerItem<int>("Direct nearest driver to path", "", 1, paths.Count, 1);
|
||||||
|
//public static UIMenuListScrollerItem<int> directDriver { get; private set; }
|
||||||
public static UIMenuListScrollerItem<string> dismissDriver { get; private set; }
|
public static UIMenuListScrollerItem<string> dismissDriver { get; private set; }
|
||||||
public static UIMenuCheckboxItem disableAllPaths { get; private set; }
|
public static UIMenuCheckboxItem disableAllPaths { get; private set; }
|
||||||
|
|
||||||
private static List<int> pathsNum = new List<int>();
|
//private static List<int> pathsNum = new List<int>();
|
||||||
private static List<Path> paths = new List<Path>() { };
|
|
||||||
private static List<string> dismissOptions = new List<string>() { "From path", "From waypoint", "From position" };
|
private static List<string> dismissOptions = new List<string>() { "From path", "From waypoint", "From position" };
|
||||||
public enum Delete
|
public enum Delete
|
||||||
{
|
{
|
||||||
|
|
@ -44,13 +47,15 @@ namespace SceneManager
|
||||||
|
|
||||||
pathMainMenu.AddItem(createNewPath = new UIMenuItem("Create New Path"));
|
pathMainMenu.AddItem(createNewPath = new UIMenuItem("Create New Path"));
|
||||||
createNewPath.ForeColor = Color.Gold;
|
createNewPath.ForeColor = Color.Gold;
|
||||||
pathMainMenu.AddItem(editPath = new UIMenuListScrollerItem<int>("Edit Path", "", pathsNum));
|
pathMainMenu.AddItem(editPath = new UIMenuNumericScrollerItem<int>("Edit Path", "", 1, paths.Count, 1));
|
||||||
|
//pathMainMenu.AddItem(editPath = new UIMenuListScrollerItem<int>("Edit Path", "", pathsNum));
|
||||||
editPath.ForeColor = Color.Gold;
|
editPath.ForeColor = Color.Gold;
|
||||||
pathMainMenu.AddItem(disableAllPaths = new UIMenuCheckboxItem("Disable All Paths", false));
|
pathMainMenu.AddItem(disableAllPaths = new UIMenuCheckboxItem("Disable All Paths", false));
|
||||||
pathMainMenu.AddItem(deleteAllPaths = new UIMenuItem("Delete All Paths"));
|
pathMainMenu.AddItem(deleteAllPaths = new UIMenuItem("Delete All Paths"));
|
||||||
deleteAllPaths.ForeColor = Color.Gold;
|
deleteAllPaths.ForeColor = Color.Gold;
|
||||||
pathMainMenu.AddItem(directOptions = new UIMenuListScrollerItem<string>("Direct driver to path's", "", new[] { "First waypoint", "Nearest waypoint" }));
|
pathMainMenu.AddItem(directOptions = new UIMenuListScrollerItem<string>("Direct driver to path's", "", new[] { "First waypoint", "Nearest waypoint" }));
|
||||||
pathMainMenu.AddItem(directDriver = new UIMenuListScrollerItem<int>("Direct nearest driver to path", "", pathsNum));
|
pathMainMenu.AddItem(directDriver = new UIMenuNumericScrollerItem<int>("Direct nearest driver to path", "", 1, paths.Count, 1));
|
||||||
|
//pathMainMenu.AddItem(directDriver = new UIMenuListScrollerItem<int>("Direct nearest driver to path", "", pathsNum));
|
||||||
directDriver.ForeColor = Color.Gold;
|
directDriver.ForeColor = Color.Gold;
|
||||||
pathMainMenu.AddItem(dismissDriver = new UIMenuListScrollerItem<string>("Dismiss nearest driver", "", dismissOptions));
|
pathMainMenu.AddItem(dismissDriver = new UIMenuListScrollerItem<string>("Dismiss nearest driver", "", dismissOptions));
|
||||||
dismissDriver.ForeColor = Color.Gold;
|
dismissDriver.ForeColor = Color.Gold;
|
||||||
|
|
@ -80,10 +85,10 @@ namespace SceneManager
|
||||||
return ref paths;
|
return ref paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddPathToPathCountList(int indexToInsertAt, int pathNum)
|
//public static void AddPathToPathCountList(int indexToInsertAt, int pathNum)
|
||||||
{
|
//{
|
||||||
pathsNum.Insert(indexToInsertAt, pathNum);
|
// pathsNum.Insert(indexToInsertAt, pathNum);
|
||||||
}
|
//}
|
||||||
|
|
||||||
private static bool VehicleAndDriverValid(this Vehicle v)
|
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
|
// 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 {index+1}");
|
||||||
Game.LogTrivial($"Deleting path {path.PathNum}");
|
Game.LogTrivial($"Deleting path {path.Number}");
|
||||||
var pathVehicles = VehicleCollector.collectedVehicles.Where(cv => cv.Path == path.PathNum).ToList();
|
var pathVehicles = VehicleCollector.collectedVehicles.Where(cv => cv.Path == path.Number).ToList();
|
||||||
|
|
||||||
Game.LogTrivial($"Removing all vehicles on the path");
|
Game.LogTrivial($"Removing all vehicles on the path");
|
||||||
foreach (CollectedVehicle cv in pathVehicles.Where(cv => cv.Vehicle && cv.Vehicle.Driver))
|
foreach (CollectedVehicle cv in pathVehicles.Where(cv => cv.Vehicle && cv.Vehicle.Driver))
|
||||||
|
|
@ -158,11 +163,11 @@ namespace SceneManager
|
||||||
paths.RemoveAt(index);
|
paths.RemoveAt(index);
|
||||||
//Game.LogTrivial("pathsNum count: " + pathsNum.Count);
|
//Game.LogTrivial("pathsNum count: " + pathsNum.Count);
|
||||||
//Game.LogTrivial("index: " + index);
|
//Game.LogTrivial("index: " + index);
|
||||||
pathsNum.RemoveAt(index);
|
//pathsNum.RemoveAt(index);
|
||||||
BuildPathMenu();
|
BuildPathMenu();
|
||||||
pathMainMenu.Visible = true;
|
pathMainMenu.Visible = true;
|
||||||
Game.LogTrivial($"Path {path.PathNum} deleted.");
|
Game.LogTrivial($"Path {path.Number} deleted.");
|
||||||
Game.DisplayNotification($"~o~Scene Manager\n~w~Path {path.PathNum} deleted.");
|
Game.DisplayNotification($"~o~Scene Manager\n~w~Path {path.Number} deleted.");
|
||||||
}
|
}
|
||||||
|
|
||||||
EditPathMenu.editPathMenu.Reset(true, true);
|
EditPathMenu.editPathMenu.Reset(true, true);
|
||||||
|
|
@ -182,8 +187,8 @@ namespace SceneManager
|
||||||
if (paths.ElementAtOrDefault(i) != null && paths[i].State == State.Creating)
|
if (paths.ElementAtOrDefault(i) != null && paths[i].State == State.Creating)
|
||||||
{
|
{
|
||||||
//Game.LogTrivial($"pathFinished: {paths[i].PathFinished}");
|
//Game.LogTrivial($"pathFinished: {paths[i].PathFinished}");
|
||||||
Game.LogTrivial($"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].PathNum}");
|
Game.DisplayNotification($"~o~Scene Manager\n~y~[Creating]~w~ Resuming path {paths[i].Number}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -211,7 +216,7 @@ namespace SceneManager
|
||||||
path.Waypoints.Clear();
|
path.Waypoints.Clear();
|
||||||
}
|
}
|
||||||
paths.Clear();
|
paths.Clear();
|
||||||
pathsNum.Clear();
|
//pathsNum.Clear();
|
||||||
BuildPathMenu();
|
BuildPathMenu();
|
||||||
pathMainMenu.Visible = true;
|
pathMainMenu.Visible = true;
|
||||||
Game.LogTrivial($"All paths deleted");
|
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));
|
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;
|
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")
|
if (directOptions.SelectedItem == "First waypoint")
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue