make resources global classes

godot-4.2
John Montagu, the 4th Earl of Sandvich 2023-12-13 18:25:32 -08:00
parent 6f03295d8e
commit c1d66f15e0
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
5 changed files with 12 additions and 8 deletions

View File

@ -9,6 +9,7 @@ public enum InputMethod
MouseCentered, MouseCentered,
} }
[GlobalClass]
public partial class GameSettings : Resource public partial class GameSettings : Resource
{ {
[Export] [Export]

View File

@ -36,13 +36,13 @@ public partial class GlobalState : Node
public override void _Notification(int what) public override void _Notification(int what)
{ {
if (what == NotificationWMCloseRequest) //if (what == NotificationWMCloseRequest)
{ //{
// TODO: quit prompt // // TODO: quit prompt
GetTree().Root // GetTree().Root
.PropagateNotification((int)NotificationWMCloseRequest); // .PropagateNotification((int)NotificationWMCloseRequest);
SaveSettings(); // SaveSettings();
} //}
} }
private void LoadSettings() private void LoadSettings()

View File

@ -3,10 +3,11 @@ using Godot.Collections;
namespace SupaLidlGame.State.Global; namespace SupaLidlGame.State.Global;
[GlobalClass]
public partial class MapState : Resource public partial class MapState : Resource
{ {
[Export] [Export]
private Dictionary<string, Variant> _state = new(); private Dictionary<string, Variant> _state;
[Signal] [Signal]
public delegate void MapStateChangedEventHandler(string key, Variant value); public delegate void MapStateChangedEventHandler(string key, Variant value);

View File

@ -3,6 +3,7 @@ using Godot.Collections;
namespace SupaLidlGame.State.Global; namespace SupaLidlGame.State.Global;
[GlobalClass]
public partial class Progression : Resource public partial class Progression : Resource
{ {
public Dictionary<string, bool> BossStatus { get; set; } public Dictionary<string, bool> BossStatus { get; set; }

View File

@ -2,6 +2,7 @@ using Godot;
namespace SupaLidlGame.State.Global; namespace SupaLidlGame.State.Global;
[GlobalClass]
public partial class Stats : Resource public partial class Stats : Resource
{ {
[Export] [Export]