mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 07:30:40 +01:00
Add api (#5)
* Add API * Added API * Updated version * Updated RNUI * Added checks for null paths * BelongsToPath menu item now toggles on/off depending if any paths exist
This commit is contained in:
parent
d118513185
commit
56a770b718
10 changed files with 63 additions and 22 deletions
34
SceneManager/API/Functions.cs
Normal file
34
SceneManager/API/Functions.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using Rage;
|
||||
using SceneManager.Managers;
|
||||
|
||||
namespace SceneManager.API
|
||||
{
|
||||
public static class Functions
|
||||
{
|
||||
/// <summary>
|
||||
/// Import paths from the Saved Paths folder and load them into the game world.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name of the file containing the path (extension excluded).</param>
|
||||
/// <param name="filePath">Specify the path from where the file will be loaded from.</param>
|
||||
public static void LoadPathsFromFile(string fileName, string filePath = "")
|
||||
{
|
||||
if(PathManager.ImportedPaths.ContainsKey(fileName))
|
||||
{
|
||||
Game.LogTrivial($"A file with that name is already loaded.");
|
||||
return;
|
||||
}
|
||||
|
||||
var importedPaths = PathManager.ImportPathsFromFile(fileName, filePath);
|
||||
PathManager.LoadImportedPaths(importedPaths, fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete paths loaded from <see cref="LoadPathsFromFile"/>.
|
||||
/// </summary>
|
||||
public static void DeleteLoadedPaths()
|
||||
{
|
||||
PathManager.DeleteAllPaths();
|
||||
PathManager.ImportedPaths.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue