From ef2f87af20a6bae3853878b413a0d198c625bc47 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Thu, 5 Sep 2024 17:31:31 +0100 Subject: [PATCH] Add autoload engine context --- project.godot | 4 ++++ project/code/TMV/Context.cs | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 project/code/TMV/Context.cs diff --git a/project.godot b/project.godot index 1cfa655..0b1f72d 100644 --- a/project.godot +++ b/project.godot @@ -15,6 +15,10 @@ run/main_scene="res://project/scenes/main.tscn" config/features=PackedStringArray("4.3", "C#", "Forward Plus") config/icon="res://icon.svg" +[autoload] + +Context="*res://project/code/TMV/Context.cs" + [dotnet] project/assembly_name="Thief Mission Viewer" diff --git a/project/code/TMV/Context.cs b/project/code/TMV/Context.cs new file mode 100644 index 0000000..6cd980f --- /dev/null +++ b/project/code/TMV/Context.cs @@ -0,0 +1,21 @@ +using Godot; +using KeepersCompound.LGS; + +namespace KeepersCompound.TMV; + +public partial class Context : Node +{ + public static Context Instance { get; private set; } + + public ResourcePathManager PathManager { get; private set; } + public ModelLoader ModelLoader { get; private set; } + + public override void _Ready() + { + var extractPath = ProjectSettings.GlobalizePath($"user://extracted/tmp"); + PathManager = new ResourcePathManager(extractPath); + ModelLoader = new ModelLoader(PathManager); + + Instance = this; + } +} \ No newline at end of file