using System; using System.Reflection; namespace UniJSON { public static partial class GenericInvokeCallFactory { //////////// Create #if UNITY_5 public static Delegate Create(MethodInfo m) #else public static Action Create(MethodInfo m) #endif { Action callback= (s, a0) => { m.Invoke(s, new object[] { a0 }); }; return callback; } #if UNITY_5 public static Delegate Create(MethodInfo m) #else public static Action Create(MethodInfo m) #endif { Action callback= (s, a0, a1) => { m.Invoke(s, new object[] { a0, a1 }); }; return callback; } #if UNITY_5 public static Delegate Create(MethodInfo m) #else public static Action Create(MethodInfo m) #endif { Action callback= (s, a0, a1, a2) => { m.Invoke(s, new object[] { a0, a1, a2 }); }; return callback; } #if UNITY_5 #else #if UNITY_5 public static Delegate Create(MethodInfo m) #else public static Action Create(MethodInfo m) #endif { Action callback= (s, a0, a1, a2, a3) => { m.Invoke(s, new object[] { a0, a1, a2, a3 }); }; return callback; } #endif #if UNITY_5 #else #if UNITY_5 public static Delegate Create(MethodInfo m) #else public static Action Create(MethodInfo m) #endif { Action callback= (s, a0, a1, a2, a3, a4) => { m.Invoke(s, new object[] { a0, a1, a2, a3, a4 }); }; return callback; } #endif #if UNITY_5 #else #if UNITY_5 public static Delegate Create(MethodInfo m) #else public static Action Create(MethodInfo m) #endif { Action callback= (s, a0, a1, a2, a3, a4, a5) => { m.Invoke(s, new object[] { a0, a1, a2, a3, a4, a5 }); }; return callback; } #endif //////////// CreateWithThis #if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) #else public static Action CreateWithThis(MethodInfo m, S instance) #endif { if (m.IsStatic) { if (instance != null) { throw new ArgumentException(); } } else { if (instance == null) { throw new ArgumentNullException(); } } // ToDo: CreateDelegate Action callback= (a0) => { m.Invoke(instance, new object[]{ a0 }); }; return callback; } #if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) #else public static Action CreateWithThis(MethodInfo m, S instance) #endif { if (m.IsStatic) { if (instance != null) { throw new ArgumentException(); } } else { if (instance == null) { throw new ArgumentNullException(); } } // ToDo: CreateDelegate Action callback= (a0, a1) => { m.Invoke(instance, new object[]{ a0, a1 }); }; return callback; } #if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) #else public static Action CreateWithThis(MethodInfo m, S instance) #endif { if (m.IsStatic) { if (instance != null) { throw new ArgumentException(); } } else { if (instance == null) { throw new ArgumentNullException(); } } // ToDo: CreateDelegate Action callback= (a0, a1, a2) => { m.Invoke(instance, new object[]{ a0, a1, a2 }); }; return callback; } #if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) #else public static Action CreateWithThis(MethodInfo m, S instance) #endif { if (m.IsStatic) { if (instance != null) { throw new ArgumentException(); } } else { if (instance == null) { throw new ArgumentNullException(); } } // ToDo: CreateDelegate Action callback= (a0, a1, a2, a3) => { m.Invoke(instance, new object[]{ a0, a1, a2, a3 }); }; return callback; } #if UNITY_5 #else #if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) #else public static Action CreateWithThis(MethodInfo m, S instance) #endif { if (m.IsStatic) { if (instance != null) { throw new ArgumentException(); } } else { if (instance == null) { throw new ArgumentNullException(); } } // ToDo: CreateDelegate Action callback= (a0, a1, a2, a3, a4) => { m.Invoke(instance, new object[]{ a0, a1, a2, a3, a4 }); }; return callback; } #endif #if UNITY_5 #else #if UNITY_5 public static Delegate CreateWithThis(MethodInfo m, S instance) #else public static Action CreateWithThis(MethodInfo m, S instance) #endif { if (m.IsStatic) { if (instance != null) { throw new ArgumentException(); } } else { if (instance == null) { throw new ArgumentNullException(); } } // ToDo: CreateDelegate Action callback= (a0, a1, a2, a3, a4, a5) => { m.Invoke(instance, new object[]{ a0, a1, a2, a3, a4, a5 }); }; return callback; } #endif } }