1
Fork 0
mirror of https://github.com/thegeneralist01/Scene-Manager-DevRepo synced 2026-01-12 08:00:30 +01:00

Merge branch 'Testing'

This commit is contained in:
Rich Dunne 2020-12-06 07:39:31 -07:00
commit 76e265cbe4
39 changed files with 1501 additions and 427 deletions

View file

@ -4,39 +4,47 @@ using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using Rage;
using SceneManager.Objects;
using SceneManager.Utils;
[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 (CheckRNUIVersion())
{
AppDomain.CurrentDomain.DomainUnload += MyTerminationHandler;
Settings.LoadSettings();
GetAssemblyVersion();
MenuManager.InstantiateMenus();
DisplayHintsToOpenMenu();
GameFiber UserInputFiber = new GameFiber(() => GetUserInput.LoopForUserInput());
UserInputFiber.Start();
}
else
if(!InputManagerChecker() || !CheckRNUIVersion())
{
Game.UnloadActivePlugin();
return;
}
while (Game.IsLoading)
{
GameFiber.Yield();
}
AppDomain.CurrentDomain.DomainUnload += MyTerminationHandler;
Settings.LoadSettings();
GetAssemblyVersion();
MenuManager.InstantiateMenus();
DisplayHintsToOpenMenu();
GameFiber UserInputFiber = new GameFiber(() => GetUserInput.LoopForUserInput());
UserInputFiber.Start();
void GetAssemblyVersion()
{
string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
Game.LogTrivial($"Scene Manager V{version} is ready.");
}
}
private static bool CheckRNUIVersion()
{
var directory = Directory.GetCurrentDirectory();
@ -57,11 +65,25 @@ namespace SceneManager
}
else
{
Game.DisplayNotification($"~o~Scene Manager~r~[Error]\n~w~ Your RAGENativeUI.dll version is below 1.7, please update RAGENativeUI and try again.");
Game.DisplayNotification($"~o~Scene Manager~r~[Error]\n~w~Your RAGENativeUI.dll version is below 1.7. Please update RAGENativeUI and try again.");
return false;
}
}
private static bool InputManagerChecker()
{
var directory = Directory.GetCurrentDirectory();
var exists = File.Exists(directory + @"\InputManager.dll");
if (!exists)
{
Game.LogTrivial($"InputManager was not found in the user's GTA V directory.");
Game.DisplayNotification($"~o~Scene Manager ~r~[Error]\n~w~InputManager.dll was not found in your GTA V directory. Please install InputManager.dll and try again.");
return false;
}
return true;
}
private static void DisplayHintsToOpenMenu()
{
if (Settings.ModifierKey == Keys.None && Settings.ModifierButton == ControllerButtons.None)
@ -96,7 +118,7 @@ namespace SceneManager
// Clean up paths
for (int i = 0; i < PathMainMenu.paths.Count; i++)
{
PathMainMenu.DeletePath(PathMainMenu.paths[i], PathMainMenu.Delete.All);
PathMainMenu.DeletePath(PathMainMenu.paths[i], Delete.All);
}
Game.LogTrivial($"Plugin has shut down.");