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

ExportPath hidden for V2.2.0 release

This commit is contained in:
Rich Dunne 2020-12-06 07:25:30 -07:00
parent 8a40b41077
commit b6ad2c031a

View file

@ -1,16 +1,16 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO;
using Rage; using Rage;
using RAGENativeUI; using RAGENativeUI;
using RAGENativeUI.Elements; using RAGENativeUI.Elements;
using SceneManager.Utils;
namespace SceneManager namespace SceneManager
{ {
class EditPathMenu class EditPathMenu
{ {
internal static UIMenu editPathMenu = new UIMenu("Scene Manager", "~o~Edit Path"); internal static UIMenu editPathMenu = new UIMenu("Scene Manager", "~o~Edit Path");
private static UIMenuItem editPathWaypoints, deletePath, savePath; private static UIMenuItem editPathWaypoints, deletePath, exportPath;
internal static UIMenuCheckboxItem disablePath; internal static UIMenuCheckboxItem disablePath;
internal static void InstantiateMenu() internal static void InstantiateMenu()
@ -29,8 +29,8 @@ namespace SceneManager
editPathWaypoints.ForeColor = Color.Gold; editPathWaypoints.ForeColor = Color.Gold;
editPathMenu.AddItem(deletePath = new UIMenuItem("Delete Path")); editPathMenu.AddItem(deletePath = new UIMenuItem("Delete Path"));
deletePath.ForeColor = Color.Gold; deletePath.ForeColor = Color.Gold;
editPathMenu.AddItem(savePath = new UIMenuItem("Export Path")); //editPathMenu.AddItem(exportPath = new UIMenuItem("Export Path"));
savePath.ForeColor = Color.Gold; //exportPath.ForeColor = Color.Gold;
editPathMenu.RefreshIndex(); editPathMenu.RefreshIndex();
} }
@ -46,7 +46,7 @@ namespace SceneManager
private static void DeletePath() private static void DeletePath()
{ {
var currentPath = PathMainMenu.paths[PathMainMenu.editPath.Index]; var currentPath = PathMainMenu.paths[PathMainMenu.editPath.Index];
PathMainMenu.DeletePath(currentPath, PathMainMenu.Delete.Single); PathMainMenu.DeletePath(currentPath, Delete.Single);
} }
private static void DisablePath() private static void DisablePath()
@ -66,30 +66,19 @@ namespace SceneManager
private static void ExportPath() private static void ExportPath()
{ {
var currentPath = PathMainMenu.paths[PathMainMenu.editPath.Index];
// Reference PNWParks's UserInput class from LiveLights // Reference PNWParks's UserInput class from LiveLights
string filename = PNWUserInput.GetUserInput("Type the name you would like to save your file as", "Enter a filename", 100); var filename = PNWUserInput.GetUserInput("Type the name you would like to save your file as", "Enter a filename", 100) + ".xml";
// If filename != null or empty, check if export directory exists (GTA V/Plugins/SceneManager/Saved Paths) // If filename != null or empty, check if export directory exists (GTA V/Plugins/SceneManager/Saved Paths)
if(string.IsNullOrWhiteSpace(filename)) if(string.IsNullOrWhiteSpace(filename))
{ {
Game.DisplayHelp($"Invalid filename given. Filename cannot be null, empty, or consist of just white spaces.");
Game.LogTrivial($"Invalid filename given. Filename cannot be null, empty, or consist of just white spaces."); Game.LogTrivial($"Invalid filename given. Filename cannot be null, empty, or consist of just white spaces.");
return; return;
} }
Game.LogTrivial($"Filename: {filename}"); Game.LogTrivial($"Filename: {filename}");
currentPath.Save(filename);
// If directory does not exist, create it
var gameDirectory = Directory.GetCurrentDirectory();
var pathDirectoryExists = Directory.Exists(gameDirectory + "/plugins/SceneManager/Saved Paths");
if (!pathDirectoryExists)
{
Directory.CreateDirectory(gameDirectory + "/plugins/SceneManager/Saved Paths");
Game.LogTrivial($"New directory created at '/plugins/SceneManager/Saved Paths'");
}
// Create XML in save directory with user's filename, saving all path information
//<Path>
// <Waypoint number="1" pos="x,y,z" speed="5" drivingFlag="Normal" stop="false" collector="true" collectorRadius="3" speedZoneRadius="5"/>
//</Path>
} }
private static void EditPath_OnItemSelected(UIMenu sender, UIMenuItem selectedItem, int index) private static void EditPath_OnItemSelected(UIMenu sender, UIMenuItem selectedItem, int index)
@ -104,7 +93,7 @@ namespace SceneManager
DeletePath(); DeletePath();
} }
if(selectedItem == savePath) if(selectedItem == exportPath)
{ {
ExportPath(); ExportPath();
} }
@ -121,14 +110,6 @@ namespace SceneManager
private static void EditPath_OnMenuOpen(UIMenu menu) private static void EditPath_OnMenuOpen(UIMenu menu)
{ {
var scrollerItems = new List<UIMenuScrollerItem> { }; var scrollerItems = new List<UIMenuScrollerItem> { };
var checkboxItems = new Dictionary<UIMenuCheckboxItem, RNUIMouseInputHandler.Function>() { { disablePath, DisablePath } };
var selectItems = new Dictionary<UIMenuItem, RNUIMouseInputHandler.Function>()
{
{ editPathWaypoints, EditPathWaypoints },
{ deletePath, DeletePath },
{ savePath, ExportPath }
};
RNUIMouseInputHandler.Initialize(menu, scrollerItems); RNUIMouseInputHandler.Initialize(menu, scrollerItems);
} }
} }