|
|
|
@ -1,4 +1,3 @@
|
|
|
|
using System;
|
|
|
|
|
|
|
|
using Godot;
|
|
|
|
using Godot;
|
|
|
|
using Godot.Collections;
|
|
|
|
using Godot.Collections;
|
|
|
|
|
|
|
|
|
|
|
|
@ -24,6 +23,26 @@ public partial class EventListener : Node
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
[Signal] public delegate void EventRaisedEventHandler();
|
|
|
|
[Signal] public delegate void EventRaisedEventHandler();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// The signal that is triggered when this listener is called by one of the <see cref="EventListener._eventResources"/>.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
[Signal] public delegate void EventRaisedWithPayloadEventHandler(Variant payload);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// A signal that is triggered when the payload of one of the <see cref="EventListener._eventResources"/> changed.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
[Signal] public delegate void PayloadChangedEventHandler(Variant payload, Variant oldPayload);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// A signal that is triggered when the payload of one of the <see cref="EventListener._eventResources"/> changed.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
[Signal] public delegate void NewEventPayloadEventHandler(Variant payload);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// A signal that is triggered when the payload of one of the <see cref="EventListener._eventResources"/> changed.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
[Signal] public delegate void OldEventPayloadEventHandler(Variant oldPayload);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Subscribes to all <see cref="EventResource"/>s present in the <see cref="_eventResources"/> array.
|
|
|
|
/// Subscribes to all <see cref="EventResource"/>s present in the <see cref="_eventResources"/> array.
|
|
|
|
@ -53,10 +72,24 @@ public partial class EventListener : Node
|
|
|
|
/// Called by a <see cref="EventResource"/>s from the <see cref="_eventResources"/> array.
|
|
|
|
/// Called by a <see cref="EventResource"/>s from the <see cref="_eventResources"/> array.
|
|
|
|
/// Propagates the event by emitting <see cref="EventRaised"/> signal.
|
|
|
|
/// Propagates the event by emitting <see cref="EventRaised"/> signal.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public void Invoke()
|
|
|
|
public void EventInvoked(Variant payload)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(_showLog)
|
|
|
|
if(_showLog)
|
|
|
|
GD.Print("Event Raised on: " + Name);
|
|
|
|
GD.Print("Event Raised on: " + Name);
|
|
|
|
EmitSignal(SignalName.EventRaised);
|
|
|
|
EmitSignal(SignalName.EventRaised);
|
|
|
|
|
|
|
|
EmitSignal(SignalName.EventRaisedWithPayload, payload);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Called by a <see cref="EventResource"/>s from the <see cref="_eventResources"/> array.
|
|
|
|
|
|
|
|
/// Propagates the event by emitting <see cref="EventRaised"/> signal.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public void EventPayloadChanged(Variant payload, Variant oldPayload)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(_showLog)
|
|
|
|
|
|
|
|
GD.Print($"Calling Event Payload Changed Signals on: " + Name);
|
|
|
|
|
|
|
|
EmitSignal(SignalName.PayloadChanged, payload, oldPayload);
|
|
|
|
|
|
|
|
EmitSignal(SignalName.NewEventPayload, payload);
|
|
|
|
|
|
|
|
EmitSignal(SignalName.OldEventPayload, oldPayload);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|