public class InputHandleEvent{ private List<Func<bool>> registered_methods; public InputHandleEvent(int initial_event_capacity) { registered_methods = new(initial_event_capacity); } public void Add(Func<bool> method) { registered_methods.Add(method); } public void Remove(Func<bool> method) { registered_methods.Remove(method); } public void Invoke() { for (int i = 0, length = registered_methods.Count; i < length; ++i) { if (registered_methods[i]()) return; } }}
public static event Func<bool> onKey, onMouseMotion, onMouseButton, onJoypadMotion, onJoypadButton, onScreenDrag, onScreenTouch; public static void SetInputs(InputEvent input) { foreach (var del in onKey.GetInvocationList()) { if (del) { } } }