UnityEngine_Object_Binding.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Runtime.InteropServices;
  6. using ILRuntime.CLR.TypeSystem;
  7. using ILRuntime.CLR.Method;
  8. using ILRuntime.Runtime.Enviorment;
  9. using ILRuntime.Runtime.Intepreter;
  10. using ILRuntime.Runtime.Stack;
  11. using ILRuntime.Reflection;
  12. using ILRuntime.CLR.Utils;
  13. namespace ILRuntime.Runtime.Generated
  14. {
  15. unsafe class UnityEngine_Object_Binding
  16. {
  17. public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
  18. {
  19. BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
  20. MethodBase method;
  21. Type[] args;
  22. Type type = typeof(UnityEngine.Object);
  23. args = new Type[]{};
  24. method = type.GetMethod("get_name", flag, null, args, null);
  25. app.RegisterCLRMethodRedirection(method, get_name_0);
  26. args = new Type[]{typeof(UnityEngine.Object)};
  27. method = type.GetMethod("Destroy", flag, null, args, null);
  28. app.RegisterCLRMethodRedirection(method, Destroy_1);
  29. args = new Type[]{typeof(UnityEngine.Object), typeof(UnityEngine.Object)};
  30. method = type.GetMethod("op_Equality", flag, null, args, null);
  31. app.RegisterCLRMethodRedirection(method, op_Equality_2);
  32. Dictionary<string, List<MethodInfo>> genericMethods = new Dictionary<string, List<MethodInfo>>();
  33. List<MethodInfo> lst = null;
  34. foreach(var m in type.GetMethods())
  35. {
  36. if(m.IsGenericMethodDefinition)
  37. {
  38. if (!genericMethods.TryGetValue(m.Name, out lst))
  39. {
  40. lst = new List<MethodInfo>();
  41. genericMethods[m.Name] = lst;
  42. }
  43. lst.Add(m);
  44. }
  45. }
  46. args = new Type[]{typeof(UnityEngine.GameObject)};
  47. if (genericMethods.TryGetValue("Instantiate", out lst))
  48. {
  49. foreach(var m in lst)
  50. {
  51. if(m.GetParameters().Length == 1)
  52. {
  53. method = m.MakeGenericMethod(args);
  54. app.RegisterCLRMethodRedirection(method, Instantiate_3);
  55. break;
  56. }
  57. }
  58. }
  59. }
  60. static StackObject* get_name_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  61. {
  62. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  63. StackObject* ptr_of_this_method;
  64. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  65. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  66. UnityEngine.Object instance_of_this_method = (UnityEngine.Object)typeof(UnityEngine.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  67. __intp.Free(ptr_of_this_method);
  68. var result_of_this_method = instance_of_this_method.name;
  69. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  70. }
  71. static StackObject* Destroy_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  72. {
  73. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  74. StackObject* ptr_of_this_method;
  75. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  76. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  77. UnityEngine.Object @obj = (UnityEngine.Object)typeof(UnityEngine.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  78. __intp.Free(ptr_of_this_method);
  79. UnityEngine.Object.Destroy(@obj);
  80. return __ret;
  81. }
  82. static StackObject* op_Equality_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  83. {
  84. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  85. StackObject* ptr_of_this_method;
  86. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  87. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  88. UnityEngine.Object @y = (UnityEngine.Object)typeof(UnityEngine.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  89. __intp.Free(ptr_of_this_method);
  90. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  91. UnityEngine.Object @x = (UnityEngine.Object)typeof(UnityEngine.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  92. __intp.Free(ptr_of_this_method);
  93. var result_of_this_method = x == y;
  94. __ret->ObjectType = ObjectTypes.Integer;
  95. __ret->Value = result_of_this_method ? 1 : 0;
  96. return __ret + 1;
  97. }
  98. static StackObject* Instantiate_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  99. {
  100. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  101. StackObject* ptr_of_this_method;
  102. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  103. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  104. UnityEngine.GameObject @original = (UnityEngine.GameObject)typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  105. __intp.Free(ptr_of_this_method);
  106. var result_of_this_method = UnityEngine.Object.Instantiate<UnityEngine.GameObject>(@original);
  107. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  108. }
  109. }
  110. }