You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
713 B
31 lines
713 B
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
public class EventConnect |
|
{ |
|
System.Action<int, object> OnChanged; |
|
public void Invoke(int type, object data) |
|
{ |
|
if (OnChanged != null) |
|
OnChanged(type, data); |
|
} |
|
public void Add(System.Action<int, object> OnChanged) |
|
{ |
|
this.OnChanged += OnChanged; |
|
} |
|
public void Remove(System.Action<int, object> OnChanged) |
|
{ |
|
this.OnChanged -= OnChanged; |
|
} |
|
public void Clear() |
|
{ |
|
this.OnChanged = null; |
|
} |
|
|
|
void EventCount() |
|
{ |
|
if (OnChanged != null) |
|
Debug.Log($"OnChanged : {OnChanged.GetInvocationList().GetLength(0)}"); |
|
} |
|
}
|
|
|