UnityEngine_Object_Binding.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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[]{typeof(UnityEngine.Object), typeof(UnityEngine.Object)};
  24. method = type.GetMethod("op_Inequality", flag, null, args, null);
  25. app.RegisterCLRMethodRedirection(method, op_Inequality_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(System.String)};
  30. method = type.GetMethod("set_name", flag, null, args, null);
  31. app.RegisterCLRMethodRedirection(method, set_name_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. args = new Type[]{typeof(UnityEngine.Object), typeof(UnityEngine.Object)};
  60. method = type.GetMethod("op_Equality", flag, null, args, null);
  61. app.RegisterCLRMethodRedirection(method, op_Equality_4);
  62. }
  63. static StackObject* op_Inequality_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  64. {
  65. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  66. StackObject* ptr_of_this_method;
  67. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  68. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  69. UnityEngine.Object @y = (UnityEngine.Object)typeof(UnityEngine.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  70. __intp.Free(ptr_of_this_method);
  71. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  72. UnityEngine.Object @x = (UnityEngine.Object)typeof(UnityEngine.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  73. __intp.Free(ptr_of_this_method);
  74. var result_of_this_method = x != y;
  75. __ret->ObjectType = ObjectTypes.Integer;
  76. __ret->Value = result_of_this_method ? 1 : 0;
  77. return __ret + 1;
  78. }
  79. static StackObject* Destroy_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  80. {
  81. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  82. StackObject* ptr_of_this_method;
  83. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  84. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  85. UnityEngine.Object @obj = (UnityEngine.Object)typeof(UnityEngine.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  86. __intp.Free(ptr_of_this_method);
  87. UnityEngine.Object.Destroy(@obj);
  88. return __ret;
  89. }
  90. static StackObject* set_name_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  91. {
  92. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  93. StackObject* ptr_of_this_method;
  94. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  95. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  96. System.String @value = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  97. __intp.Free(ptr_of_this_method);
  98. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  99. UnityEngine.Object instance_of_this_method = (UnityEngine.Object)typeof(UnityEngine.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  100. __intp.Free(ptr_of_this_method);
  101. instance_of_this_method.name = value;
  102. return __ret;
  103. }
  104. static StackObject* Instantiate_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  105. {
  106. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  107. StackObject* ptr_of_this_method;
  108. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  109. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  110. UnityEngine.GameObject @original = (UnityEngine.GameObject)typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  111. __intp.Free(ptr_of_this_method);
  112. var result_of_this_method = UnityEngine.Object.Instantiate<UnityEngine.GameObject>(@original);
  113. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  114. }
  115. static StackObject* op_Equality_4(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  116. {
  117. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  118. StackObject* ptr_of_this_method;
  119. StackObject* __ret = ILIntepreter.Minus(__esp, 2);
  120. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  121. UnityEngine.Object @y = (UnityEngine.Object)typeof(UnityEngine.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  122. __intp.Free(ptr_of_this_method);
  123. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  124. UnityEngine.Object @x = (UnityEngine.Object)typeof(UnityEngine.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  125. __intp.Free(ptr_of_this_method);
  126. var result_of_this_method = x == y;
  127. __ret->ObjectType = ObjectTypes.Integer;
  128. __ret->Value = result_of_this_method ? 1 : 0;
  129. return __ret + 1;
  130. }
  131. }
  132. }