多轮审查和修复
This commit is contained in:
@@ -10,15 +10,37 @@ namespace BaseGames.Core.Events
|
||||
{
|
||||
[Multiline] public string description;
|
||||
|
||||
public event Action<T> OnEventRaised;
|
||||
private event Action<T> _onEventRaisedBacking;
|
||||
#if UNITY_EDITOR
|
||||
private int _subscriberCount;
|
||||
#endif
|
||||
|
||||
public event Action<T> OnEventRaised
|
||||
{
|
||||
add
|
||||
{
|
||||
_onEventRaisedBacking += value;
|
||||
#if UNITY_EDITOR
|
||||
_subscriberCount++;
|
||||
#endif
|
||||
}
|
||||
remove
|
||||
{
|
||||
_onEventRaisedBacking -= value;
|
||||
#if UNITY_EDITOR
|
||||
_subscriberCount--;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public void Raise(T value)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
EventBusMonitor.Record(name, value?.ToString() ?? "null",
|
||||
OnEventRaised?.GetInvocationList().Length ?? 0);
|
||||
_subscriberCount,
|
||||
Time.frameCount);
|
||||
#endif
|
||||
OnEventRaised?.Invoke(value);
|
||||
_onEventRaisedBacking?.Invoke(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -38,15 +60,37 @@ namespace BaseGames.Core.Events
|
||||
{
|
||||
[Multiline] public string description;
|
||||
|
||||
public event Action OnEventRaised;
|
||||
private event Action _onEventRaisedBacking;
|
||||
#if UNITY_EDITOR
|
||||
private int _subscriberCount;
|
||||
#endif
|
||||
|
||||
public event Action OnEventRaised
|
||||
{
|
||||
add
|
||||
{
|
||||
_onEventRaisedBacking += value;
|
||||
#if UNITY_EDITOR
|
||||
_subscriberCount++;
|
||||
#endif
|
||||
}
|
||||
remove
|
||||
{
|
||||
_onEventRaisedBacking -= value;
|
||||
#if UNITY_EDITOR
|
||||
_subscriberCount--;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public void Raise()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
EventBusMonitor.Record(name, "<void>",
|
||||
OnEventRaised?.GetInvocationList().Length ?? 0);
|
||||
_subscriberCount,
|
||||
Time.frameCount);
|
||||
#endif
|
||||
OnEventRaised?.Invoke();
|
||||
_onEventRaisedBacking?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user