/Unity/Assets/Model/ILBinding/UnityEngine_Vector3_Binding.cs

https://github.com/Viagi/LandlordsCore · C# · 155 lines · 137 code · 18 blank · 0 comment · 3 complexity · 7dd7372253ccc87d551977a48662ff0e MD5 · raw file

  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_Vector3_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. FieldInfo field;
  22. Type[] args;
  23. Type type = typeof(UnityEngine.Vector3);
  24. field = type.GetField("x", flag);
  25. app.RegisterCLRFieldGetter(field, get_x_0);
  26. app.RegisterCLRFieldSetter(field, set_x_0);
  27. field = type.GetField("y", flag);
  28. app.RegisterCLRFieldGetter(field, get_y_1);
  29. app.RegisterCLRFieldSetter(field, set_y_1);
  30. field = type.GetField("z", flag);
  31. app.RegisterCLRFieldGetter(field, get_z_2);
  32. app.RegisterCLRFieldSetter(field, set_z_2);
  33. app.RegisterCLRCreateDefaultInstance(type, () => new UnityEngine.Vector3());
  34. args = new Type[]{typeof(System.Single), typeof(System.Single), typeof(System.Single)};
  35. method = type.GetConstructor(flag, null, args, null);
  36. app.RegisterCLRMethodRedirection(method, Ctor_0);
  37. }
  38. static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, IList<object> __mStack, ref UnityEngine.Vector3 instance_of_this_method)
  39. {
  40. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  41. switch(ptr_of_this_method->ObjectType)
  42. {
  43. case ObjectTypes.Object:
  44. {
  45. __mStack[ptr_of_this_method->Value] = instance_of_this_method;
  46. }
  47. break;
  48. case ObjectTypes.FieldReference:
  49. {
  50. var ___obj = __mStack[ptr_of_this_method->Value];
  51. if(___obj is ILTypeInstance)
  52. {
  53. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
  54. }
  55. else
  56. {
  57. var t = __domain.GetType(___obj.GetType()) as CLRType;
  58. t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
  59. }
  60. }
  61. break;
  62. case ObjectTypes.StaticFieldReference:
  63. {
  64. var t = __domain.GetType(ptr_of_this_method->Value);
  65. if(t is ILType)
  66. {
  67. ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
  68. }
  69. else
  70. {
  71. ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
  72. }
  73. }
  74. break;
  75. case ObjectTypes.ArrayReference:
  76. {
  77. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as UnityEngine.Vector3[];
  78. instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
  79. }
  80. break;
  81. }
  82. }
  83. static object get_x_0(ref object o)
  84. {
  85. return ((UnityEngine.Vector3)o).x;
  86. }
  87. static void set_x_0(ref object o, object v)
  88. {
  89. var h = GCHandle.Alloc(o, GCHandleType.Pinned);
  90. UnityEngine.Vector3* p = (UnityEngine.Vector3 *)(void *)h.AddrOfPinnedObject();
  91. p->x = (System.Single)v;
  92. h.Free();
  93. }
  94. static object get_y_1(ref object o)
  95. {
  96. return ((UnityEngine.Vector3)o).y;
  97. }
  98. static void set_y_1(ref object o, object v)
  99. {
  100. var h = GCHandle.Alloc(o, GCHandleType.Pinned);
  101. UnityEngine.Vector3* p = (UnityEngine.Vector3 *)(void *)h.AddrOfPinnedObject();
  102. p->y = (System.Single)v;
  103. h.Free();
  104. }
  105. static object get_z_2(ref object o)
  106. {
  107. return ((UnityEngine.Vector3)o).z;
  108. }
  109. static void set_z_2(ref object o, object v)
  110. {
  111. var h = GCHandle.Alloc(o, GCHandleType.Pinned);
  112. UnityEngine.Vector3* p = (UnityEngine.Vector3 *)(void *)h.AddrOfPinnedObject();
  113. p->z = (System.Single)v;
  114. h.Free();
  115. }
  116. static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  117. {
  118. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  119. StackObject* ptr_of_this_method;
  120. StackObject* __ret = ILIntepreter.Minus(__esp, 3);
  121. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  122. System.Single @z = *(float*)&ptr_of_this_method->Value;
  123. ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
  124. System.Single @y = *(float*)&ptr_of_this_method->Value;
  125. ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
  126. System.Single @x = *(float*)&ptr_of_this_method->Value;
  127. var result_of_this_method = new UnityEngine.Vector3(@x, @y, @z);
  128. if(!isNewObj)
  129. {
  130. __ret--;
  131. WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method);
  132. return __ret;
  133. }
  134. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  135. }
  136. }
  137. }