1
Fork 0
mirror of https://github.com/thegeneralist01/Scene-Manager-DevRepo synced 2026-01-11 23:50:29 +01:00

Added ExportPath option

This commit is contained in:
Rich Dunne 2021-05-15 09:49:47 -06:00
parent 817b7cb685
commit bbc0ea6354

View file

@ -7,16 +7,15 @@ using RAGENativeUI.Elements;
using SceneManager.Managers; using SceneManager.Managers;
using SceneManager.Paths; using SceneManager.Paths;
using SceneManager.Utils; using SceneManager.Utils;
using SceneManager.Waypoints;
namespace SceneManager.Menus namespace SceneManager.Menus
{ {
internal static class PathMainMenu internal static class PathMainMenu
{ {
private static int MAX_PATH_LIMIT { get; } = 10;
internal static UIMenu Menu { get; } = new UIMenu("Scene Manager", "~o~Path Manager"); internal static UIMenu Menu { get; } = new UIMenu("Scene Manager", "~o~Path Manager");
internal static UIMenuItem CreateNewPath { get; } = new UIMenuItem("Create New Path"); internal static UIMenuItem CreateNewPath { get; } = new UIMenuItem("Create New Path");
internal static UIMenuItem ImportPath { get; } = new UIMenuItem("Import Path", "Import a saved path from ~b~plugins/SceneManager/Saved Paths"); internal static UIMenuItem ImportPath { get; } = new UIMenuItem("Import Paths", "Import saved paths from ~b~plugins/SceneManager/Saved Paths");
internal static UIMenuItem ExportPath { get; } = new UIMenuItem("Export Paths", "Export selected paths to ~b~plugins/SceneManager/Saved Paths");
internal static UIMenuItem DeleteAllPaths { get; } = new UIMenuItem("Delete All Paths"); internal static UIMenuItem DeleteAllPaths { get; } = new UIMenuItem("Delete All Paths");
internal static UIMenuListScrollerItem<string> EditPath { get; private set; } internal static UIMenuListScrollerItem<string> EditPath { get; private set; }
internal static UIMenuCheckboxItem DisableAllPaths { get; } = new UIMenuCheckboxItem("Disable All Paths", false); internal static UIMenuCheckboxItem DisableAllPaths { get; } = new UIMenuCheckboxItem("Disable All Paths", false);
@ -40,8 +39,11 @@ namespace SceneManager.Menus
CreateNewPath.ForeColor = Color.Gold; CreateNewPath.ForeColor = Color.Gold;
Menu.AddItem(ImportPath); Menu.AddItem(ImportPath);
ImportPath.ForeColor = Color.Gold; ImportPath.ForeColor = Color.Gold;
ImportPath.Enabled = Settings.ImportedPaths.Count() > 0; ImportPath.Enabled = PathManager.ImportedPaths.Count > 0;
Menu.AddItem(EditPath = new UIMenuListScrollerItem<string>("Edit Path", "Options to ~b~edit path waypoints~w~, ~b~disable the path~w~, ~b~export the path~w~, or ~b~delete the path~w~.", PathManager.Paths.Select(x => x.Name))); Menu.AddItem(ExportPath);
ExportPath.ForeColor = Color.Gold;
ExportPath.Enabled = PathManager.Paths.Any(x => x != null);
Menu.AddItem(EditPath = new UIMenuListScrollerItem<string>("Edit Path", "Options to ~b~edit path waypoints~w~, ~b~disable the path~w~, ~b~change path name~w~, or ~b~delete the path~w~.", PathManager.Paths.Where(x => x != null).Select(x => x.Name)));
EditPath.ForeColor = Color.Gold; EditPath.ForeColor = Color.Gold;
Menu.AddItem(DisableAllPaths); Menu.AddItem(DisableAllPaths);
DisableAllPaths.Enabled = true; DisableAllPaths.Enabled = true;
@ -49,18 +51,18 @@ namespace SceneManager.Menus
DeleteAllPaths.Enabled = true; DeleteAllPaths.Enabled = true;
DeleteAllPaths.ForeColor = Color.Gold; DeleteAllPaths.ForeColor = Color.Gold;
if (PathManager.Paths.Count == MAX_PATH_LIMIT) if (PathManager.Paths.All(x => x != null))
{ {
CreateNewPath.Enabled = false; CreateNewPath.Enabled = false;
ImportPath.Enabled = false; ImportPath.Enabled = false;
} }
if (PathManager.Paths.Count == 0) if (PathManager.Paths.All(x => x == null))
{ {
EditPath.Enabled = false; EditPath.Enabled = false;
DeleteAllPaths.Enabled = false; DeleteAllPaths.Enabled = false;
DisableAllPaths.Enabled = false; DisableAllPaths.Enabled = false;
} }
if(Settings.ImportedPaths.Count == 0) if(PathManager.ImportedPaths.Count == 0)
{ {
ImportPath.Enabled = false; ImportPath.Enabled = false;
} }
@ -80,6 +82,11 @@ namespace SceneManager.Menus
GoToImportMenu(); GoToImportMenu();
} }
if(selectedItem == ExportPath)
{
GoToExportMenu();
}
if (selectedItem == EditPath) if (selectedItem == EditPath)
{ {
GoToEditPathMenu(); GoToEditPathMenu();
@ -91,7 +98,7 @@ namespace SceneManager.Menus
DisableAllPaths.Checked = false; DisableAllPaths.Checked = false;
Build(); Build();
Menu.Visible = true; Menu.Visible = true;
BarrierMenu.BuildMenu(); BarrierMenu.Build();
} }
} }
@ -115,12 +122,11 @@ namespace SceneManager.Menus
{ {
Menu.Visible = false; Menu.Visible = false;
PathCreationMenu.Menu.Visible = true; PathCreationMenu.Menu.Visible = true;
Path currentPath = PathManager.Paths.FirstOrDefault(x => x.State == State.Creating); Path currentPath = PathManager.Paths.FirstOrDefault(x => x != null && x.State == State.Creating);
Game.DisplayNotification($"~o~Scene Manager~y~[Creating]\n~w~Resuming path {currentPath.Number}"); Game.DisplayNotification($"~o~Scene Manager~y~[Creating]\n~w~Resuming path ~b~{currentPath.Name}~w~.");
} }
else else
{ {
//PathCreationMenu.BuildPathCreationMenu();
Menu.Visible = false; Menu.Visible = false;
PathCreationMenu.Menu.Visible = true; PathCreationMenu.Menu.Visible = true;
} }
@ -132,9 +138,16 @@ namespace SceneManager.Menus
ImportPathMenu.Menu.Visible = true; ImportPathMenu.Menu.Visible = true;
} }
private static void GoToExportMenu()
{
Menu.Visible = false;
ExportPathMenu.Menu.Visible = true;
}
private static void GoToEditPathMenu() private static void GoToEditPathMenu()
{ {
Menu.Visible = false; Menu.Visible = false;
EditPathMenu.CurrentPath = PathManager.Paths[EditPath.Index];
EditPathMenu.Menu.Visible = true; EditPathMenu.Menu.Visible = true;
} }
} }