LuaExportList.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. #if USE_LUA
  2. using LuaInterface;
  3. using UnityEditor;
  4. using System;
  5. using System.Collections.Generic;
  6. using UnityEngine;
  7. using UnityEngine.EventSystems;
  8. using UnityEngine.UI;
  9. using BindType = ToLuaMenu.BindType;
  10. public class LuaExportList
  11. {
  12. public static string saveDir = Application.dataPath + "/Script/LuaGenerate";
  13. public static string toluaBaseType = Application.dataPath + "/Script/LuaGenerate/BaseType/";
  14. //在这里添加你要导出注册到lua的类型列表
  15. public static BindType[] customTypeList =
  16. {
  17. _GT(typeof(Debugger)).SetNameSpace(null),
  18. #region Base
  19. _GT(typeof(UnityEngine.Object)),
  20. _GT(typeof(GameObject)),
  21. _GT(typeof(Transform)),
  22. _GT(typeof(Component)),
  23. _GT(typeof(Behaviour)),
  24. _GT(typeof(MonoBehaviour)),
  25. _GT(typeof(Vector3)),
  26. _GT(typeof(Vector4)),
  27. _GT(typeof(Vector2)),
  28. _GT(typeof(Color)),
  29. #endregion
  30. #region UGUI
  31. _GT(typeof(Selectable)),
  32. _GT(typeof(UIBehaviour)),
  33. _GT(typeof(Graphic)),
  34. _GT(typeof(MaskableGraphic)),
  35. _GT(typeof(ScrollRect)),
  36. _GT(typeof(Button)),
  37. _GT(typeof(Image)),
  38. _GT(typeof(Text)),
  39. _GT(typeof(RectTransform)),
  40. //自定义的UGUI拓展类
  41. _GT(typeof(ScrollRectInput)),
  42. _GT(typeof(ReusingScrollRect)),
  43. #endregion
  44. #region Framework
  45. #region AnimSystem
  46. _GT(typeof(InterpType)),
  47. _GT(typeof(RepeatType)),
  48. _GT(typeof(AnimData)),
  49. _GT(typeof(AnimSystem)),
  50. #endregion
  51. #region UI
  52. _GT(typeof(UIBase)),
  53. _GT(typeof(UIWindowBase)),
  54. _GT(typeof(UIManager)),
  55. _GT(typeof(UIWindowLuaHelper)),
  56. _GT(typeof(UISystemEvent)),
  57. _GT(typeof(UIEvent)),
  58. #endregion
  59. #region Data
  60. _GT(typeof(List<string>)),
  61. _GT(typeof(Dictionary<string,object>)),
  62. _GT(typeof(JsonLuaHelper)),
  63. _GT(typeof(DataTable)),
  64. _GT(typeof(SingleData)),
  65. _GT(typeof(SingleField)),
  66. _GT(typeof(RecordTable)),
  67. _GT(typeof(DataManager)),
  68. _GT(typeof(ConfigManager)),
  69. _GT(typeof(RecordManager)),
  70. _GT(typeof(AudioPlayManager)),
  71. #endregion
  72. #region Input
  73. _GT(typeof(IInputEventBase)),
  74. _GT(typeof(InputUIEventType)),
  75. _GT(typeof(InputUIEventBase)),
  76. _GT(typeof(InputUIOnScrollEvent)),
  77. _GT(typeof(InputUIOnClickEvent)),
  78. _GT(typeof(InputUILongPressEvent)),
  79. _GT(typeof(InputNetworkMessageEvent)),
  80. _GT(typeof(InputNetworkConnectStatusEvent)),
  81. _GT(typeof(NetworkState)),
  82. _GT(typeof(InputManager)),
  83. _GT(typeof(NetworkManager)),
  84. #endregion
  85. //_GT(typeof(HeapObjectPool)),
  86. //_GT(typeof(ResourceManager)),
  87. //_GT(typeof(ApplicationManager)),
  88. //_GT(typeof(ApplicationStatusManager)),
  89. _GT(typeof(GameObjectManager)),
  90. #endregion
  91. #region Custom
  92. //要导出的C#类文件请放在这里
  93. //格式: _GT(typeof(类名)),
  94. #endregion
  95. #region Note
  96. //这里是注释
  97. //_GT(typeof(Component)),
  98. //_GT(typeof(Material)),
  99. //_GT(typeof(Light)),
  100. //_GT(typeof(Rigidbody)),
  101. //_GT(typeof(Camera)),
  102. //_GT(typeof(AudioSource)),
  103. //_GT(typeof(Behaviour)),
  104. //_GT(typeof(MonoBehaviour)),
  105. //_GT(typeof(TrackedReference)),
  106. //_GT(typeof(Application)),
  107. //_GT(typeof(Physics)),
  108. //_GT(typeof(Collider)),
  109. //_GT(typeof(Time)),
  110. //_GT(typeof(Texture)),
  111. //_GT(typeof(Texture2D)),
  112. //_GT(typeof(Shader)),
  113. //_GT(typeof(Renderer)),
  114. //_GT(typeof(WWW)),
  115. _GT(typeof(Screen)),
  116. //_GT(typeof(CameraClearFlags)),
  117. //_GT(typeof(AudioClip)),
  118. //_GT(typeof(AssetBundle)),
  119. //_GT(typeof(ParticleSystem)),
  120. //_GT(typeof(AsyncOperation)).SetBaseType(typeof(System.Object)),
  121. //_GT(typeof(LightType)),
  122. //_GT(typeof(SleepTimeout)),
  123. //_GT(typeof(Animator)),
  124. _GT(typeof(Input)),
  125. //_GT(typeof(KeyCode)),
  126. //_GT(typeof(SkinnedMeshRenderer)),
  127. //_GT(typeof(Space)),
  128. //_GT(typeof(MeshRenderer)),
  129. //_GT(typeof(ParticleEmitter)),
  130. //_GT(typeof(ParticleRenderer)),
  131. //_GT(typeof(ParticleAnimator)),
  132. //_GT(typeof(BoxCollider)),
  133. //_GT(typeof(MeshCollider)),
  134. //_GT(typeof(SphereCollider)),
  135. //_GT(typeof(CharacterController)),
  136. //_GT(typeof(CapsuleCollider)),
  137. //_GT(typeof(Animation)),
  138. //_GT(typeof(AnimationClip)).SetBaseType(typeof(UnityEngine.Object)),
  139. //_GT(typeof(AnimationState)),
  140. //_GT(typeof(AnimationBlendMode)),
  141. //_GT(typeof(QueueMode)),
  142. //_GT(typeof(PlayMode)),
  143. //_GT(typeof(WrapMode)),
  144. //_GT(typeof(QualitySettings)),
  145. //_GT(typeof(RenderSettings)),
  146. //_GT(typeof(BlendWeights)),
  147. //_GT(typeof(RenderTexture)),
  148. #endregion
  149. };
  150. //导出时强制做为静态类的类型(注意customTypeList 还要添加这个类型才能导出)
  151. //unity 有些类作为sealed class, 其实完全等价于静态类
  152. public static List<Type> staticClassTypes = new List<Type>
  153. {
  154. //typeof(UnityEngine.Application),
  155. //typeof(UnityEngine.Time),
  156. //typeof(UnityEngine.Screen),
  157. };
  158. //附加导出委托类型(在导出委托时, customTypeList 中牵扯的委托类型都会导出, 无需写在这里)
  159. public static DelegateType[] customDelegateList =
  160. {
  161. //_DT(typeof(Action)),
  162. //_DT(typeof(UnityEngine.Events.UnityAction)),
  163. //_DT(typeof(System.Predicate<int>)),
  164. };
  165. public static List<Type> dynamicList = new List<Type>()
  166. {
  167. //typeof(MeshRenderer),
  168. //typeof(BoxCollider),
  169. //typeof(MeshCollider),
  170. };
  171. //重载函数,相同参数个数,相同位置out参数匹配出问题时, 需要强制匹配解决
  172. //使用方法参见例子14
  173. public static List<Type> outList = new List<Type>()
  174. {
  175. };
  176. public static BindType _GT(Type t)
  177. {
  178. return new BindType(t);
  179. }
  180. public static DelegateType _DT(Type t)
  181. {
  182. return new DelegateType(t);
  183. }
  184. }
  185. #endif