From 4ccd4bc6d126e0e0f51a50aa10c85b9bf48b1210 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Wed, 18 Oct 2023 10:16:32 +0800 Subject: + init --- .../SerializableCallback/Runtime/InvokableEvent.cs | 111 +++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 ActiveRagdoll/Assets/ThirdParty/SerializableCallback/Runtime/InvokableEvent.cs (limited to 'ActiveRagdoll/Assets/ThirdParty/SerializableCallback/Runtime/InvokableEvent.cs') diff --git a/ActiveRagdoll/Assets/ThirdParty/SerializableCallback/Runtime/InvokableEvent.cs b/ActiveRagdoll/Assets/ThirdParty/SerializableCallback/Runtime/InvokableEvent.cs new file mode 100644 index 0000000..dd9db65 --- /dev/null +++ b/ActiveRagdoll/Assets/ThirdParty/SerializableCallback/Runtime/InvokableEvent.cs @@ -0,0 +1,111 @@ +using System; + +public class InvokableEvent : InvokableEventBase { + + public System.Action action; + + public void Invoke() { + action(); + } + + public override void Invoke(params object[] args) { + action(); + } + + /// Constructor + public InvokableEvent(object target, string methodName) { + if (target == null || string.IsNullOrEmpty(methodName)) { + action = () => { }; + } else { + action = (System.Action) System.Delegate.CreateDelegate(typeof(System.Action), target, methodName); + } + } +} + +public class InvokableEvent : InvokableEventBase { + + public Action action; + + public void Invoke(T0 arg0) { + action(arg0); + } + + public override void Invoke(params object[] args) { + action((T0) args[0]); + } + + /// Constructor + public InvokableEvent(object target, string methodName) { + if (target == null || string.IsNullOrEmpty(methodName)) { + action = x => { }; + } else { + action = (System.Action) System.Delegate.CreateDelegate(typeof(System.Action), target, methodName); + } + } +} + +public class InvokableEvent : InvokableEventBase { + + public Action action; + + public void Invoke(T0 arg0, T1 arg1) { + action(arg0, arg1); + } + + public override void Invoke(params object[] args) { + action((T0) args[0], (T1) args[1]); + } + + /// Constructor + public InvokableEvent(object target, string methodName) { + if (target == null || string.IsNullOrEmpty(methodName)) { + action = (x, y) => { }; + } else { + action = (System.Action) System.Delegate.CreateDelegate(typeof(System.Action), target, methodName); + } + } +} + +public class InvokableEvent : InvokableEventBase { + + public Action action; + + public void Invoke(T0 arg0, T1 arg1, T2 arg2) { + action(arg0, arg1, arg2); + } + + public override void Invoke(params object[] args) { + action((T0) args[0], (T1) args[1], (T2) args[2]); + } + + /// Constructor + public InvokableEvent(object target, string methodName) { + if (target == null || string.IsNullOrEmpty(methodName)) { + action = (x, y, z) => { }; + } else { + action = (System.Action) System.Delegate.CreateDelegate(typeof(System.Action), target, methodName); + } + } +} + +public class InvokableEvent : InvokableEventBase { + + public Action action; + + public void Invoke(T0 arg0, T1 arg1, T2 arg2, T3 arg3) { + action(arg0, arg1, arg2, arg3); + } + + public override void Invoke(params object[] args) { + action((T0) args[0], (T1) args[1], (T2) args[2], (T3) args[3]); + } + + /// Constructor + public InvokableEvent(object target, string methodName) { + if (target == null || string.IsNullOrEmpty(methodName)) { + action = (x, y, z, w) => { }; + } else { + action = (System.Action) System.Delegate.CreateDelegate(typeof(System.Action), target, methodName); + } + } +} -- cgit v1.1-26-g67d0