Create local EventManager wrapper to expose ConfigurableEventManager as GlobalClass

This commit is contained in:
Will Stuckey
2025-10-28 12:34:50 -05:00
parent 4c81fffb2f
commit 3deeb42403
4 changed files with 19 additions and 3 deletions

View File

@@ -5,4 +5,4 @@
[node name="Main" type="Node2D"] [node name="Main" type="Node2D"]
script = ExtResource("1_1") script = ExtResource("1_1")
[node name="EventManager" type="ConfigurableEventManager" parent="."] [node name="EventManager" type="EventManager" parent="."]

View File

@@ -10,13 +10,13 @@ namespace Voider;
public partial class EventExample : Node public partial class EventExample : Node
{ {
// Reference to the ConfigurableEventManager in the scene // Reference to the ConfigurableEventManager in the scene
private ConfigurableEventManager _eventManager; private EventManager _eventManager;
public override void _Ready() public override void _Ready()
{ {
// Get reference to the ConfigurableEventManager node // Get reference to the ConfigurableEventManager node
// (Assumes it's named "EventManager" in your scene tree) // (Assumes it's named "EventManager" in your scene tree)
_eventManager = GetNode<ConfigurableEventManager>("/root/Main/EventManager"); _eventManager = GetNode<EventManager>("/root/Main/EventManager");
// Subscribe to events // Subscribe to events
SubscribeToEvents(); SubscribeToEvents();

15
Scripts/EventManager.cs Normal file
View File

@@ -0,0 +1,15 @@
using Godot;
using EinSoftworks.Events;
namespace Voider;
/// <summary>
/// Wrapper for ConfigurableEventManager that makes it available in this project.
/// This inherits from the library's ConfigurableEventManager.
/// </summary>
[GlobalClass]
public partial class EventManager : ConfigurableEventManager
{
// Inherits all functionality from ConfigurableEventManager
// You can add project-specific event manager functionality here if needed
}

View File

@@ -0,0 +1 @@
uid://butot2dkursrs