mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交GAS 打算做一个帧同步的GAS
This commit is contained in:
24
JEX_GAS/Assets/GAS/Runtime/EventSystem/EventBase.cs
Normal file
24
JEX_GAS/Assets/GAS/Runtime/EventSystem/EventBase.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace GAS.Runtime
|
||||
{
|
||||
public class EventBase<T> where T : EventArgs
|
||||
{
|
||||
public event EventHandler<T> EventHandler;
|
||||
|
||||
public void Publish(T args)
|
||||
{
|
||||
EventHandler?.Invoke(this, args);
|
||||
}
|
||||
|
||||
public void Subscribe(EventHandler<T> handler)
|
||||
{
|
||||
EventHandler += handler;
|
||||
}
|
||||
|
||||
public void Unsubscribe(EventHandler<T> handler)
|
||||
{
|
||||
EventHandler -= handler;
|
||||
}
|
||||
}
|
||||
}
|
3
JEX_GAS/Assets/GAS/Runtime/EventSystem/EventBase.cs.meta
Normal file
3
JEX_GAS/Assets/GAS/Runtime/EventSystem/EventBase.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de27ccfc119b429fa7baf6f075900f4e
|
||||
timeCreated: 1712764204
|
3
JEX_GAS/Assets/GAS/Runtime/EventSystem/Events.meta
Normal file
3
JEX_GAS/Assets/GAS/Runtime/EventSystem/Events.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1eddc7a7d30f4d3cb90d70bf17accf6e
|
||||
timeCreated: 1712815518
|
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
namespace GAS.Runtime
|
||||
{
|
||||
public class AttributeChangedEventArgs : EventArgs
|
||||
{
|
||||
public AttributeChangedEventArgs(AbilitySystemComponent owner, AttributeBase attribute, float oldValue,
|
||||
float newValue)
|
||||
{
|
||||
Owner = owner;
|
||||
Attribute = attribute;
|
||||
OldValue = oldValue;
|
||||
NewValue = newValue;
|
||||
}
|
||||
|
||||
public AbilitySystemComponent Owner { get; }
|
||||
public AttributeBase Attribute { get; }
|
||||
public float OldValue { get; }
|
||||
public float NewValue { get; }
|
||||
}
|
||||
|
||||
public class AttributeChangedEvent:EventBase<AttributeChangedEventArgs>
|
||||
{
|
||||
public void Publish(AbilitySystemComponent owner, AttributeBase attribute, float oldValue, float newValue)
|
||||
{
|
||||
Publish(new AttributeChangedEventArgs(owner, attribute, oldValue, newValue));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79c1fb618c4d44279376853983ff9f8f
|
||||
timeCreated: 1712759099
|
7
JEX_GAS/Assets/GAS/Runtime/EventSystem/GASEvents.cs
Normal file
7
JEX_GAS/Assets/GAS/Runtime/EventSystem/GASEvents.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace GAS.Runtime
|
||||
{
|
||||
public class GASEvents
|
||||
{
|
||||
public static AttributeChangedEvent AttributeChanged = new AttributeChangedEvent();
|
||||
}
|
||||
}
|
3
JEX_GAS/Assets/GAS/Runtime/EventSystem/GASEvents.cs.meta
Normal file
3
JEX_GAS/Assets/GAS/Runtime/EventSystem/GASEvents.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aca5e03fae0845a7bde264547b76c18f
|
||||
timeCreated: 1712764683
|
Reference in New Issue
Block a user