From 6fdfe48cdbd39337b43bf287181c816f66daf2b2 Mon Sep 17 00:00:00 2001 From: Hank Morgan Date: Wed, 17 Apr 2024 23:10:06 +0100 Subject: [PATCH] changes to execution order --- .github/workflows/main.yml | 1 + main.cs | 18 +++++++++--------- src/ui/uimanager.cs | 13 ++++++++++++- src/utility/config.cs | 6 +++++- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 52b1a11..446fe41 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,3 +40,4 @@ jobs: generateReleaseNotes: true tag: ${{ github.ref_name }} artifacts: ${{ steps.export.outputs.archive_directory }}/* + prerelease: true diff --git a/main.cs b/main.cs index 641785c..56c729a 100644 --- a/main.cs +++ b/main.cs @@ -45,7 +45,7 @@ public static bool blockmouseinput public static Camera3D gamecam; //static ref to the above camera [Export] public AudioStreamPlayer audioplayer; [Export] public RichTextLabel lblPositionDebug; - [Export] public uimanager uwUI; + //[Export] public uimanager uwUI; [Export] public SubViewport secondarycameras; @@ -64,15 +64,15 @@ public static bool blockmouseinput public override void _Ready() { - instance = this; + instance = this; gamecam = cam; - uimanager.instance = uwUI; - uimanager.instance.mousecursor.Texture = uimanager.instance.cross; - uwsettings.LoadSettings(); - uimanager.EnableDisable(uimanager.instance.StartMenuPanel, true); - uimanager.instance.pathuw1.Text = uwsettings.instance.pathuw1; - uimanager.instance.pathuw2.Text = uwsettings.instance.pathuw2; - GetTree().DebugCollisionsHint =uwsettings.instance.showcolliders; + //uimanager.instance = uwUI; + if (uwsettings.instance!=null) + { + gamecam.Fov = Math.Max(50, uwsettings.instance.FOV); + GetTree().DebugCollisionsHint = uwsettings.instance.showcolliders; + } + } public static void StartGame() diff --git a/src/ui/uimanager.cs b/src/ui/uimanager.cs index 5faa2b5..fec075c 100644 --- a/src/ui/uimanager.cs +++ b/src/ui/uimanager.cs @@ -12,7 +12,18 @@ public partial class uimanager : Node2D [Export] public TextureRect placeholderuw1; [Export] public TextureRect placeholderuw2; - public void InitUI() + + public override void _Ready() + { + uwsettings.LoadSettings(); + instance = this; + uimanager.instance.mousecursor.Texture = uimanager.instance.cross; + uimanager.EnableDisable(uimanager.instance.StartMenuPanel, true); + uimanager.instance.pathuw1.Text = uwsettings.instance.pathuw1; + uimanager.instance.pathuw2.Text = uwsettings.instance.pathuw2; + } + + public void InitUI() { InitArt(); InitMainMenu(); diff --git a/src/utility/config.cs b/src/utility/config.cs index 95878eb..6c1d94b 100644 --- a/src/utility/config.cs +++ b/src/utility/config.cs @@ -40,7 +40,11 @@ public static void LoadSettings() } var gamesettings = JsonSerializer.Deserialize(File.ReadAllText(settingsfile)); uwsettings.instance = gamesettings; - main.gamecam.Fov = Math.Max(50, uwsettings.instance.FOV); + if (main.gamecam!=null) + { + main.gamecam.Fov = Math.Max(50, uwsettings.instance.FOV); + } + setGame(gamesettings.gametoload); switch (UWClass._RES)