Skip to content

Commit fb9965d

Browse files
Improve performance, fix bugs, organize assets, update documentation (#184)
* Suppress GC.SuppressFinalize warnings * Merge in commits from GodotUtils * Add ComponentManager node to Autoloads.tscn * Rename Global.cs to Autoloads.cs * Convert OptionsManager to Component * Move menu UI assets back to GodotUtils * GodotUtils scripts under GodotUtils namespace * Remove [SceneTree] from all scripts * Replace .ToArray() with [..XYZ] * Convert more scripts to be components * Assumptions and Performance in ComponentManager * Move Icon.svg to res://Framework * Move Autoloads.tscn to GodotUtils * Organize highlights in readme * Uncomment LogWarning()'s in extension collections * Set ComponentManager to be Pausable * Autoload components no longer extend Component * Add MenuScenes Resource to scripts * Fix circular dependency resource errors * Set game scene to res://Level.tscn * Majority of options scripts no longer extend Node * Duplicate InputEvent to prevent Godot disposing it * Decouple Commands from GodotUtils
1 parent c50b99a commit fb9965d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+56
-2419
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ dotnet_diagnostic.IDE0044.severity = none
4343
# Stop warning about user defined suppressions
4444
dotnet_diagnostic.IDE0079.severity = none
4545

46+
# Stop GC.SuppressFinalize(this) warnings
47+
dotnet_diagnostic.CA1816.severity = none
48+
4649
# Do not simplify XYZ.ToArray() to [.. XYZ] (I do not understand it)
4750
dotnet_diagnostic.IDE0305.severity = none
4851

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
using Godot;
12
using GodotUtils;
23
using GodotUtils.UI.Console;
34
using System.Collections.Generic;
45
using System.Linq;
56

67
namespace __TEMPLATE__.UI;
78

8-
public class Commands
9+
public partial class Commands : Node
910
{
10-
public static void RegisterAll()
11+
public override void _Ready()
1112
{
12-
GameConsole.RegisterCommand("help", CommandHelp);
13-
GameConsole.RegisterCommand("quit", CommandQuit).WithAliases("exit");
13+
GameConsole.RegisterCommand("help", CommandHelp);
14+
GameConsole.RegisterCommand("quit", CommandQuit).WithAliases("exit");
1415
GameConsole.RegisterCommand("debug", CommandDebug);
1516
}
1617

@@ -22,7 +23,7 @@ private static void CommandHelp(string[] args)
2223

2324
private async static void CommandQuit(string[] args)
2425
{
25-
await Global.Instance.QuitAndCleanup();
26+
await Autoloads.Instance.QuitAndCleanup();
2627
}
2728

2829
private static void CommandDebug(string[] args)

Framework/GodotUtils

Submodule GodotUtils updated 68 files
File renamed without changes.

Framework/Scenes/MenuUI/MainMenu/MainMenuNav.cs renamed to Framework/MainMenuNav.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ namespace __TEMPLATE__.UI;
55

66
public partial class MainMenuNav : Node
77
{
8+
[Export] private PackedScene _gameScene;
9+
810
public override void _Ready()
911
{
1012
GetNode<Button>("Play").GrabFocus();
@@ -13,30 +15,30 @@ public override void _Ready()
1315
private void _OnPlayPressed()
1416
{
1517
//AudioManager.PlayMusic(Music.Level1, false);
16-
SceneManager.SwitchScene(Scene.Game);
18+
SceneManager.SwitchScene(_gameScene);
1719
}
1820

1921
private void _OnModsPressed()
2022
{
2123
//AudioManager.PlayMusic(Music.Level4);
22-
SceneManager.SwitchScene(Scene.ModLoader);
24+
SceneManager.SwitchScene(SceneManager.Instance.MenuScenes.ModLoader);
2325
}
2426

2527
private void _OnOptionsPressed()
2628
{
2729
//AudioManager.PlayMusic(Music.Level4);
28-
SceneManager.SwitchScene(Scene.Options);
30+
SceneManager.SwitchScene(SceneManager.Instance.MenuScenes.Options);
2931
}
3032

3133
private void _OnCreditsPressed()
3234
{
3335
//AudioManager.PlayMusic(Music.Level4);
34-
SceneManager.SwitchScene(Scene.Credits);
36+
SceneManager.SwitchScene(SceneManager.Instance.MenuScenes.Credits);
3537
}
3638

3739
private async void _OnQuitPressed()
3840
{
39-
await Global.Instance.QuitAndCleanup();
41+
await Autoloads.Instance.QuitAndCleanup();
4042
}
4143

4244
private void _OnDiscordPressed()

Framework/Scenes/MenuUI/MainMenu/MainMenuNav.cs.uid renamed to Framework/MainMenuNav.cs.uid

File renamed without changes.

Framework/Scenes.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Godot;
2+
3+
namespace __TEMPLATE__.UI;
4+
5+
[GlobalClass]
6+
public partial class Scenes : Node
7+
{
8+
[Export] public PackedScene Game { get; private set; }
9+
}

Framework/Scenes.cs.uid

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://dhjdrl43yn46w

Framework/Scenes/Autoloads.tscn

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)