Inheritance: ISerializationCallbackReceiver
Esempio n. 1
1
 private static BaseInvokableCall GetObjectCall(UnityEngine.Object target, MethodInfo method, ArgumentCache arguments)
 {
     System.Type type = typeof(UnityEngine.Object);
     if (!string.IsNullOrEmpty(arguments.unityObjectArgumentAssemblyTypeName))
     {
         System.Type type1 = System.Type.GetType(arguments.unityObjectArgumentAssemblyTypeName, false);
         if (type1 != null)
         {
             type = type1;
         }
         else
         {
             type = typeof(UnityEngine.Object);
         }
     }
     System.Type type2 = typeof(CachedInvokableCall<>);
     System.Type[] typeArguments = new System.Type[] { type };
     System.Type[] types = new System.Type[] { typeof(UnityEngine.Object), typeof(MethodInfo), type };
     ConstructorInfo constructor = type2.MakeGenericType(typeArguments).GetConstructor(types);
     UnityEngine.Object unityObjectArgument = arguments.unityObjectArgument;
     if ((unityObjectArgument != null) && !type.IsAssignableFrom(unityObjectArgument.GetType()))
     {
         unityObjectArgument = null;
     }
     object[] parameters = new object[] { target, method, unityObjectArgument };
     return (constructor.Invoke(parameters) as BaseInvokableCall);
 }
Esempio n. 2
0
        // need to generate a generic typed version of the call here
        // this is due to the fact that we allow binding of 'any'
        // functions that extend object.
        private static BaseInvokableCall GetObjectCall(Object target, MethodInfo method, ArgumentCache arguments)
        {
            var type = typeof(Object);

            if (!string.IsNullOrEmpty(arguments.unityObjectArgumentAssemblyTypeName))
            {
                type = Type.GetType(arguments.unityObjectArgumentAssemblyTypeName, false) ?? typeof(Object);
            }

            var generic  = typeof(CachedInvokableCall <>);
            var specific = generic.MakeGenericType(type);
            var ci       = specific.GetConstructor(new[] { typeof(Object), typeof(MethodInfo), type });

            var castedObject = arguments.unityObjectArgument;

            if (castedObject != null && !type.IsAssignableFrom(castedObject.GetType()))
            {
                castedObject = null;
            }

            // need to pass explicit null here!
            return(ci.Invoke(new object[] { target, method, castedObject }) as BaseInvokableCall);
        }
Esempio n. 3
0
        private static BaseInvokableCall GetObjectCall(UnityEngine.Object target, MethodInfo method, ArgumentCache arguments)
        {
            Type type = typeof(UnityEngine.Object);

            if (!string.IsNullOrEmpty(arguments.unityObjectArgumentAssemblyTypeName))
            {
                type = (Type.GetType(arguments.unityObjectArgumentAssemblyTypeName, false) ?? typeof(UnityEngine.Object));
            }
            Type typeFromHandle = typeof(CachedInvokableCall <>);
            Type type2          = typeFromHandle.MakeGenericType(new Type[]
            {
                type
            });
            ConstructorInfo constructor = type2.GetConstructor(new Type[]
            {
                typeof(UnityEngine.Object),
                typeof(MethodInfo),
                type
            });

            UnityEngine.Object @object = arguments.unityObjectArgument;
            if (@object != null && !type.IsAssignableFrom(@object.GetType()))
            {
                @object = null;
            }
            return(constructor.Invoke(new object[]
            {
                target,
                method,
                @object
            }) as BaseInvokableCall);
        }
Esempio n. 4
0
        private static BaseInvokableCall GetObjectCall(UnityEngine.Object target, MethodInfo method, ArgumentCache arguments)
        {
            System.Type type = typeof(UnityEngine.Object);
            if (!string.IsNullOrEmpty(arguments.unityObjectArgumentAssemblyTypeName))
            {
                type = System.Type.GetType(arguments.unityObjectArgumentAssemblyTypeName, false) ?? typeof(UnityEngine.Object);
            }
            ConstructorInfo constructor = typeof(CachedInvokableCall <>).MakeGenericType(type).GetConstructor(new System.Type[3] {
                typeof(UnityEngine.Object), typeof(MethodInfo), type
            });

            UnityEngine.Object @object = arguments.unityObjectArgument;
            if (@object != (UnityEngine.Object)null && !type.IsAssignableFrom(@object.GetType()))
            {
                @object = (UnityEngine.Object)null;
            }
            return(constructor.Invoke(new object[3] {
                (object)target, (object)method, (object)@object
            }) as BaseInvokableCall);
        }
Esempio n. 5
0
        private static BaseInvokableCall GetObjectCall(Object target, MethodInfo method, ArgumentCache arguments)
        {
            Type type = typeof(Object);

            if (!string.IsNullOrEmpty(arguments.unityObjectArgumentAssemblyTypeName))
            {
                Type type1 = Type.GetType(arguments.unityObjectArgumentAssemblyTypeName, false);
                if (type1 != null)
                {
                    type = type1;
                }
                else
                {
                    type = typeof(Object);
                }
            }
            Type type2 = typeof(CachedInvokableCall <>);

            Type[]          typeArguments       = new Type[] { type };
            Type[]          types               = new Type[] { typeof(Object), typeof(MethodInfo), type };
            ConstructorInfo constructor         = type2.MakeGenericType(typeArguments).GetConstructor(types);
            Object          unityObjectArgument = arguments.unityObjectArgument;

            if ((unityObjectArgument != null) && !type.IsAssignableFrom(unityObjectArgument.GetType()))
            {
                unityObjectArgument = null;
            }
            object[] parameters = new object[] { target, method, unityObjectArgument };
            return(constructor.Invoke(parameters) as BaseInvokableCall);
        }
 private static BaseInvokableCall GetObjectCall(UnityEngine.Object target, MethodInfo method, ArgumentCache arguments)
 {
   System.Type type = typeof (UnityEngine.Object);
   if (!string.IsNullOrEmpty(arguments.unityObjectArgumentAssemblyTypeName))
     type = System.Type.GetType(arguments.unityObjectArgumentAssemblyTypeName, false) ?? typeof (UnityEngine.Object);
   ConstructorInfo constructor = typeof (CachedInvokableCall<>).MakeGenericType(type).GetConstructor(new System.Type[3]{ typeof (UnityEngine.Object), typeof (MethodInfo), type });
   UnityEngine.Object @object = arguments.unityObjectArgument;
   if (@object != (UnityEngine.Object) null && !type.IsAssignableFrom(@object.GetType()))
     @object = (UnityEngine.Object) null;
   return constructor.Invoke(new object[3]{ (object) target, (object) method, (object) @object }) as BaseInvokableCall;
 }
		private static BaseInvokableCall GetObjectCall(UnityEngine.Object target, MethodInfo method, ArgumentCache arguments)
		{
			Type type = typeof(UnityEngine.Object);
			if (!string.IsNullOrEmpty(arguments.unityObjectArgumentAssemblyTypeName))
			{
				type = (Type.GetType(arguments.unityObjectArgumentAssemblyTypeName, false) ?? typeof(UnityEngine.Object));
			}
			Type typeFromHandle = typeof(CachedInvokableCall<>);
			Type type2 = typeFromHandle.MakeGenericType(new Type[]
			{
				type
			});
			ConstructorInfo constructor = type2.GetConstructor(new Type[]
			{
				typeof(UnityEngine.Object),
				typeof(MethodInfo),
				type
			});
			UnityEngine.Object @object = arguments.unityObjectArgument;
			if (@object != null && !type.IsAssignableFrom(@object.GetType()))
			{
				@object = null;
			}
			return constructor.Invoke(new object[]
			{
				target,
				method,
				@object
			}) as BaseInvokableCall;
		}