UnityEngine_Physics_Binding.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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_Physics_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.Physics);
  23. args = new Type[]{typeof(UnityEngine.Ray), typeof(UnityEngine.RaycastHit).MakeByRefType(), typeof(System.Single), typeof(System.Int32)};
  24. method = type.GetMethod("Raycast", flag, null, args, null);
  25. app.RegisterCLRMethodRedirection(method, Raycast_0);
  26. }
  27. static StackObject* Raycast_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  28. {
  29. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  30. StackObject* ptr_of_this_method;
  31. StackObject* __ret = ILIntepreter.Minus(__esp, 4);
  32. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  33. System.Int32 @layerMask = ptr_of_this_method->Value;
  34. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  35. System.Single @maxDistance = *(float*)&ptr_of_this_method->Value;
  36. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  37. UnityEngine.RaycastHit @hitInfo = (UnityEngine.RaycastHit)typeof(UnityEngine.RaycastHit).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack));
  38. ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
  39. UnityEngine.Ray @ray = (UnityEngine.Ray)typeof(UnityEngine.Ray).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  40. var result_of_this_method = UnityEngine.Physics.Raycast(@ray, out @hitInfo, @maxDistance, @layerMask);
  41. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  42. __intp.Free(ptr_of_this_method);
  43. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  44. __intp.Free(ptr_of_this_method);
  45. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  46. switch(ptr_of_this_method->ObjectType)
  47. {
  48. case ObjectTypes.StackObjectReference:
  49. {
  50. var ___dst = ILIntepreter.ResolveReference(ptr_of_this_method);
  51. object ___obj = @hitInfo;
  52. if (___dst->ObjectType >= ObjectTypes.Object)
  53. {
  54. if (___obj is CrossBindingAdaptorType)
  55. ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
  56. __mStack[___dst->Value] = ___obj;
  57. }
  58. else
  59. {
  60. ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain);
  61. }
  62. }
  63. break;
  64. case ObjectTypes.FieldReference:
  65. {
  66. var ___obj = __mStack[ptr_of_this_method->Value];
  67. if(___obj is ILTypeInstance)
  68. {
  69. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = @hitInfo;
  70. }
  71. else
  72. {
  73. var ___type = __domain.GetType(___obj.GetType()) as CLRType;
  74. ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, @hitInfo);
  75. }
  76. }
  77. break;
  78. case ObjectTypes.StaticFieldReference:
  79. {
  80. var ___type = __domain.GetType(ptr_of_this_method->Value);
  81. if(___type is ILType)
  82. {
  83. ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = @hitInfo;
  84. }
  85. else
  86. {
  87. ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, @hitInfo);
  88. }
  89. }
  90. break;
  91. case ObjectTypes.ArrayReference:
  92. {
  93. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as UnityEngine.RaycastHit[];
  94. instance_of_arrayReference[ptr_of_this_method->ValueLow] = @hitInfo;
  95. }
  96. break;
  97. }
  98. __intp.Free(ptr_of_this_method);
  99. ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
  100. __intp.FreeStackValueType(ptr_of_this_method);
  101. __intp.Free(ptr_of_this_method);
  102. __ret->ObjectType = ObjectTypes.Integer;
  103. __ret->Value = result_of_this_method ? 1 : 0;
  104. return __ret + 1;
  105. }
  106. }
  107. }