1
Fork 0
mirror of https://github.com/thegeneralist01/Scene-Manager-DevRepo synced 2026-01-09 23:00:29 +01:00
Scene-Manager-DevRepo/SceneManager/EntryPoint.cs
2025-01-05 10:44:53 +01:00

63 lines
2.1 KiB
C#

using System;
using System.Reflection;
using Rage;
using SceneManager.Utils;
using SceneManager.Menus;
using SceneManager.Managers;
[assembly: Rage.Attributes.Plugin("Scene Manager", Author = "Rich", Description = "Control your scenes with custom AI pathing and traffic barrier management.", PrefersSingleInstance = true)]
namespace SceneManager
{
[Obfuscation(Exclude = false, Feature = "-rename", ApplyToMembers = false)]
public class EntryPoint
{
[Obfuscation(Exclude = false, Feature = "-rename")]
internal static void Main()
{
if (!DependencyChecker.DependenciesInstalled())
{
Game.UnloadActivePlugin();
return;
}
while (Game.IsLoading)
{
GameFiber.Yield();
}
AppDomain.CurrentDomain.DomainUnload += TerminationHandler;
Settings.LoadSettings();
GetAssemblyVersion();
MenuManager.InitializeMenus();
Game.LogTrivial("[DEBUG] After initializing menus.");
Hints.DisplayHintsToOpenMenu();
Game.LogTrivial("[DEBUG] After displaying hints to open the menu.");
GameFiber.StartNew(() => UserInput.HandleKeyPress(), "Handle User Input");
void GetAssemblyVersion()
{
string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
Game.LogTrivial($"Scene Manager V{version} is ready.");
}
}
private static void TerminationHandler(object sender, EventArgs e)
{
try
{
ExportPathMenu.ExportOnUnload();
}
catch(Exception ex)
{
Game.LogTrivial($"Autosave error: {ex.Message}");
Game.DisplayNotification($"~o~Scene Manager ~r~[Error]\n~w~There was a problem autosaving the paths.");
}
BarrierMenu.Cleanup();
PathManager.DeleteAllPaths();
Game.LogTrivial($"Plugin has shut down.");
}
}
}