Create local EventManager wrapper to expose ConfigurableEventManager as GlobalClass
This commit is contained in:
@@ -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="."]
|
||||||
|
|||||||
@@ -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
15
Scripts/EventManager.cs
Normal 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
|
||||||
|
}
|
||||||
1
Scripts/EventManager.cs.uid
Normal file
1
Scripts/EventManager.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://butot2dkursrs
|
||||||
Reference in New Issue
Block a user