2025-06-10 16:11:48 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using LuaInterface;
|
|
|
|
|
|
|
|
|
|
|
|
using BindType = ToLuaMenu.BindType;
|
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
using FairyGUI;
|
|
|
|
|
|
|
|
|
|
|
|
public static class CustomSettings
|
|
|
|
|
|
{
|
|
|
|
|
|
public static string saveDir = Application.dataPath + "/Source/Generate/";
|
|
|
|
|
|
public static string toluaBaseType = Application.dataPath + "/ToLua/BaseType/";
|
|
|
|
|
|
public static string injectionFilesPath = Application.dataPath + "/ToLua/Injection/";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//导出时强制做为静态类的类型(注意customTypeList 还要添加这个类型才能导出)
|
|
|
|
|
|
//unity 有些类作为sealed class, 其实完全等价于静态类
|
|
|
|
|
|
public static List<Type> staticClassTypes = new List<Type>
|
|
|
|
|
|
{
|
|
|
|
|
|
typeof(UnityEngine.Application),
|
|
|
|
|
|
typeof(UnityEngine.Time),
|
|
|
|
|
|
typeof(UnityEngine.Screen),
|
|
|
|
|
|
typeof(UnityEngine.SleepTimeout),
|
|
|
|
|
|
typeof(UnityEngine.Input),
|
|
|
|
|
|
typeof(UnityEngine.Resources),
|
|
|
|
|
|
typeof(UnityEngine.Physics),
|
|
|
|
|
|
typeof(UnityEngine.RenderSettings),
|
|
|
|
|
|
typeof(UnityEngine.QualitySettings),
|
|
|
|
|
|
typeof(UnityEngine.GL),
|
|
|
|
|
|
typeof(UnityEngine.Graphics),
|
2025-07-04 00:27:03 +08:00
|
|
|
|
typeof(EmojiDitc),
|
2025-06-10 16:11:48 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//附加导出委托类型(在导出委托时, customTypeList 中牵扯的委托类型都会导出, 无需写在这里)
|
|
|
|
|
|
public static DelegateType[] customDelegateList =
|
|
|
|
|
|
{
|
|
|
|
|
|
_DT(typeof(Action)),
|
|
|
|
|
|
_DT(typeof(UnityEngine.Events.UnityAction)),
|
|
|
|
|
|
_DT(typeof(System.Predicate<int>)),
|
|
|
|
|
|
_DT(typeof(System.Action<int>)),
|
|
|
|
|
|
_DT(typeof(System.Comparison<int>)),
|
|
|
|
|
|
_DT(typeof(System.Func<int, int>)),
|
|
|
|
|
|
_DT(typeof(GTweenCallback)),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//在这里添加你要导出注册到lua的类型列表
|
|
|
|
|
|
public static BindType[] customTypeList =
|
|
|
|
|
|
{
|
|
|
|
|
|
//------------------------为例子导出--------------------------------
|
|
|
|
|
|
//_GT(typeof(TestEventListener)),
|
|
|
|
|
|
//_GT(typeof(TestProtol)),
|
|
|
|
|
|
//_GT(typeof(TestAccount)),
|
|
|
|
|
|
//_GT(typeof(Dictionary<int, TestAccount>)).SetLibName("AccountMap"),
|
|
|
|
|
|
//_GT(typeof(KeyValuePair<int, TestAccount>)),
|
|
|
|
|
|
//_GT(typeof(Dictionary<int, TestAccount>.KeyCollection)),
|
|
|
|
|
|
//_GT(typeof(Dictionary<int, TestAccount>.ValueCollection)),
|
|
|
|
|
|
//_GT(typeof(TestExport)),
|
|
|
|
|
|
//_GT(typeof(TestExport.Space)),
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
//_GT(typeof(DS.Core.Debugger)).SetNameSpace(null),
|
|
|
|
|
|
|
|
|
|
|
|
#if USING_DOTWEENING
|
|
|
|
|
|
_GT(typeof(DG.Tweening.DOTween)),
|
|
|
|
|
|
_GT(typeof(DG.Tweening.Tween)).SetBaseType(typeof(System.Object)).AddExtendType(typeof(DG.Tweening.TweenExtensions)),
|
|
|
|
|
|
_GT(typeof(DG.Tweening.Sequence)).AddExtendType(typeof(DG.Tweening.TweenSettingsExtensions)),
|
|
|
|
|
|
_GT(typeof(DG.Tweening.Tweener)).AddExtendType(typeof(DG.Tweening.TweenSettingsExtensions)),
|
|
|
|
|
|
_GT(typeof(DG.Tweening.LoopType)),
|
|
|
|
|
|
_GT(typeof(DG.Tweening.PathMode)),
|
|
|
|
|
|
_GT(typeof(DG.Tweening.PathType)),
|
|
|
|
|
|
_GT(typeof(DG.Tweening.RotateMode)),
|
|
|
|
|
|
_GT(typeof(Component)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),
|
|
|
|
|
|
_GT(typeof(Transform)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),
|
|
|
|
|
|
_GT(typeof(Light)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),
|
|
|
|
|
|
_GT(typeof(Material)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),
|
|
|
|
|
|
_GT(typeof(Rigidbody)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),
|
|
|
|
|
|
_GT(typeof(Camera)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),
|
|
|
|
|
|
_GT(typeof(AudioSource)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),
|
|
|
|
|
|
//_GT(typeof(LineRenderer)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),
|
|
|
|
|
|
//_GT(typeof(TrailRenderer)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
|
_GT(typeof(Component)),
|
|
|
|
|
|
_GT(typeof(Transform)),
|
|
|
|
|
|
_GT(typeof(Material)),
|
|
|
|
|
|
_GT(typeof(Light)),
|
|
|
|
|
|
_GT(typeof(Rigidbody)),
|
|
|
|
|
|
_GT(typeof(Camera)),
|
|
|
|
|
|
_GT(typeof(AudioSource)),
|
|
|
|
|
|
//_GT(typeof(LineRenderer))
|
|
|
|
|
|
//_GT(typeof(TrailRenderer))
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
_GT(typeof(Behaviour)),
|
|
|
|
|
|
_GT(typeof(MonoBehaviour)),
|
|
|
|
|
|
_GT(typeof(GameObject)),
|
|
|
|
|
|
_GT(typeof(TrackedReference)),
|
|
|
|
|
|
_GT(typeof(Application)),
|
|
|
|
|
|
_GT(typeof(Physics)),
|
|
|
|
|
|
_GT(typeof(Collider)),
|
|
|
|
|
|
_GT(typeof(Time)),
|
|
|
|
|
|
_GT(typeof(Texture)),
|
|
|
|
|
|
_GT(typeof(Texture2D)),
|
|
|
|
|
|
_GT(typeof(Shader)),
|
|
|
|
|
|
_GT(typeof(Renderer)),
|
|
|
|
|
|
_GT(typeof(WWW)),
|
|
|
|
|
|
_GT(typeof(Screen)),
|
|
|
|
|
|
_GT(typeof(CameraClearFlags)),
|
|
|
|
|
|
_GT(typeof(AudioClip)),
|
|
|
|
|
|
_GT(typeof(AssetBundle)),
|
|
|
|
|
|
_GT(typeof(ParticleSystem)),
|
|
|
|
|
|
_GT(typeof(AsyncOperation)).SetBaseType(typeof(System.Object)),
|
|
|
|
|
|
_GT(typeof(LightType)),
|
|
|
|
|
|
_GT(typeof(SleepTimeout)),
|
|
|
|
|
|
#if UNITY_5_3_OR_NEWER && !UNITY_5_6_OR_NEWER
|
|
|
|
|
|
_GT(typeof(UnityEngine.Experimental.Director.DirectorPlayer)),
|
|
|
|
|
|
#endif
|
|
|
|
|
|
_GT(typeof(Animator)),
|
|
|
|
|
|
_GT(typeof(Input)),
|
|
|
|
|
|
_GT(typeof(KeyCode)),
|
|
|
|
|
|
_GT(typeof(SkinnedMeshRenderer)),
|
|
|
|
|
|
_GT(typeof(Space)),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_GT(typeof(MeshRenderer)),
|
|
|
|
|
|
#if !UNITY_5_4_OR_NEWER
|
|
|
|
|
|
_GT(typeof(ParticleEmitter)),
|
|
|
|
|
|
_GT(typeof(ParticleRenderer)),
|
|
|
|
|
|
_GT(typeof(ParticleAnimator)),
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
_GT(typeof(BoxCollider)),
|
|
|
|
|
|
_GT(typeof(MeshCollider)),
|
|
|
|
|
|
_GT(typeof(SphereCollider)),
|
|
|
|
|
|
_GT(typeof(CharacterController)),
|
|
|
|
|
|
_GT(typeof(CapsuleCollider)),
|
|
|
|
|
|
|
|
|
|
|
|
_GT(typeof(Animation)),
|
|
|
|
|
|
_GT(typeof(AnimationClip)).SetBaseType(typeof(UnityEngine.Object)),
|
|
|
|
|
|
_GT(typeof(AnimationState)),
|
|
|
|
|
|
_GT(typeof(AnimationBlendMode)),
|
|
|
|
|
|
_GT(typeof(QueueMode)),
|
|
|
|
|
|
_GT(typeof(PlayMode)),
|
|
|
|
|
|
_GT(typeof(WrapMode)),
|
|
|
|
|
|
|
|
|
|
|
|
_GT(typeof(QualitySettings)),
|
|
|
|
|
|
_GT(typeof(RenderSettings)),
|
|
|
|
|
|
_GT(typeof(SkinWeights)),
|
|
|
|
|
|
_GT(typeof(RenderTexture)),
|
|
|
|
|
|
_GT(typeof(Resources)),
|
|
|
|
|
|
|
|
|
|
|
|
_GT(typeof(EventContext)),
|
|
|
|
|
|
_GT(typeof(EventDispatcher)),
|
|
|
|
|
|
_GT(typeof(EventListener)),
|
|
|
|
|
|
_GT(typeof(InputEvent)),
|
|
|
|
|
|
_GT(typeof(DisplayObject)),
|
|
|
|
|
|
_GT(typeof(Container)),
|
|
|
|
|
|
_GT(typeof(Stage)),
|
|
|
|
|
|
_GT(typeof(Controller)),
|
|
|
|
|
|
_GT(typeof(GObject)),
|
|
|
|
|
|
_GT(typeof(GGraph)),
|
|
|
|
|
|
_GT(typeof(GGroup)),
|
|
|
|
|
|
_GT(typeof(GImage)),
|
|
|
|
|
|
_GT(typeof(GLoader)),
|
|
|
|
|
|
_GT(typeof(GMovieClip)),
|
|
|
|
|
|
_GT(typeof(TextFormat)),
|
|
|
|
|
|
_GT(typeof(GTextField)),
|
|
|
|
|
|
_GT(typeof(GRichTextField)),
|
|
|
|
|
|
_GT(typeof(GTextInput)),
|
|
|
|
|
|
_GT(typeof(GComponent)),
|
|
|
|
|
|
_GT(typeof(GList)),
|
|
|
|
|
|
_GT(typeof(GRoot)),
|
|
|
|
|
|
_GT(typeof(GLabel)),
|
|
|
|
|
|
_GT(typeof(GButton)),
|
|
|
|
|
|
_GT(typeof(GComboBox)),
|
|
|
|
|
|
_GT(typeof(GProgressBar)),
|
|
|
|
|
|
_GT(typeof(GSlider)),
|
|
|
|
|
|
_GT(typeof(PopupMenu)),
|
|
|
|
|
|
_GT(typeof(ScrollPane)),
|
|
|
|
|
|
_GT(typeof(Transition)),
|
|
|
|
|
|
_GT(typeof(UIPackage)),
|
|
|
|
|
|
_GT(typeof(Window)),
|
|
|
|
|
|
_GT(typeof(GObjectPool)),
|
|
|
|
|
|
_GT(typeof(Relations)),
|
|
|
|
|
|
_GT(typeof(RelationType)),
|
|
|
|
|
|
_GT(typeof(Timers)),
|
|
|
|
|
|
_GT(typeof(NTexture)),
|
|
|
|
|
|
_GT(typeof(NAudioClip)),
|
|
|
|
|
|
_GT(typeof(UIObjectFactory)),
|
|
|
|
|
|
_GT(typeof(GoWrapper)),
|
|
|
|
|
|
|
|
|
|
|
|
_GT(typeof(GearDisplay)),
|
|
|
|
|
|
_GT(typeof(GearXY)),
|
|
|
|
|
|
_GT(typeof(GearSize)),
|
|
|
|
|
|
_GT(typeof(GearLook)),
|
|
|
|
|
|
_GT(typeof(GearColor)),
|
|
|
|
|
|
_GT(typeof(GearAnimation)),
|
|
|
|
|
|
_GT(typeof(GearText)),
|
|
|
|
|
|
_GT(typeof(GearIcon)),
|
|
|
|
|
|
_GT(typeof(UIConfig)),
|
|
|
|
|
|
|
|
|
|
|
|
_GT(typeof(BlurFilter)),
|
|
|
|
|
|
_GT(typeof(ColorFilter)),
|
|
|
|
|
|
|
|
|
|
|
|
_GT(typeof(FontManager)),
|
|
|
|
|
|
_GT(typeof(DynamicFont)),
|
|
|
|
|
|
|
|
|
|
|
|
_GT(typeof(DSAnimationCurve)),
|
|
|
|
|
|
_GT(typeof(TakeScreenShot)),
|
|
|
|
|
|
_GT(typeof(QRCodePicture)),
|
|
|
|
|
|
_GT(typeof(taurus.client.NetManager)),
|
|
|
|
|
|
_GT(typeof(taurus.unity.LuaNetClient)),
|
|
|
|
|
|
_GT(typeof(UnityEngine.PlayerPrefs)),
|
|
|
|
|
|
_GT(typeof(GameApplication)),
|
|
|
|
|
|
_GT(typeof(Version)),
|
|
|
|
|
|
_GT(typeof(Hotupdate)),
|
|
|
|
|
|
_GT(typeof(Game.Utils)),
|
|
|
|
|
|
_GT(typeof(UnityEngine.RuntimePlatform)),
|
|
|
|
|
|
_GT(typeof(UnityEngine.NetworkReachability)),
|
|
|
|
|
|
_GT(typeof(Voice)),
|
|
|
|
|
|
_GT(typeof(taurus.unity.ResourcesManager)),
|
|
|
|
|
|
_GT(typeof(System.IO.File)),
|
|
|
|
|
|
_GT(typeof(System.IO.Directory)),
|
|
|
|
|
|
//_GT(typeof(System.IO.FileInfo)),
|
|
|
|
|
|
//_GT(typeof(System.IO.DirectoryInfo)),
|
|
|
|
|
|
_GT(typeof(GTweener)),
|
|
|
|
|
|
_GT(typeof(UnityEngine.SystemInfo)),
|
|
|
|
|
|
_GT(typeof(Image)),
|
|
|
|
|
|
_GT(typeof(FairyGUI.TextField)),
|
2025-07-04 00:27:03 +08:00
|
|
|
|
_GT(typeof(EmojiDitc)),
|
2025-08-13 14:06:30 +08:00
|
|
|
|
_GT(typeof(EaseType)),
|
2025-08-19 22:17:52 +08:00
|
|
|
|
_GT(typeof(ListLayoutType)),
|
2025-06-10 16:11:48 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
public static List<Type> dynamicList = new List<Type>()
|
|
|
|
|
|
{
|
|
|
|
|
|
typeof(MeshRenderer),
|
|
|
|
|
|
#if !UNITY_5_4_OR_NEWER
|
|
|
|
|
|
typeof(ParticleEmitter),
|
|
|
|
|
|
typeof(ParticleRenderer),
|
|
|
|
|
|
typeof(ParticleAnimator),
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
typeof(BoxCollider),
|
|
|
|
|
|
typeof(MeshCollider),
|
|
|
|
|
|
typeof(SphereCollider),
|
|
|
|
|
|
typeof(CharacterController),
|
|
|
|
|
|
typeof(CapsuleCollider),
|
|
|
|
|
|
|
|
|
|
|
|
typeof(Animation),
|
|
|
|
|
|
typeof(AnimationClip),
|
|
|
|
|
|
typeof(AnimationState),
|
|
|
|
|
|
|
|
|
|
|
|
typeof(SkinWeights),
|
|
|
|
|
|
typeof(RenderTexture),
|
|
|
|
|
|
typeof(Rigidbody),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//重载函数,相同参数个数,相同位置out参数匹配出问题时, 需要强制匹配解决
|
|
|
|
|
|
//使用方法参见例子14
|
|
|
|
|
|
public static List<Type> outList = new List<Type>()
|
|
|
|
|
|
{
|
2025-07-04 00:27:03 +08:00
|
|
|
|
typeof(EmojiDitc),
|
2025-06-10 16:11:48 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//ngui优化,下面的类没有派生类,可以作为sealed class
|
|
|
|
|
|
public static List<Type> sealedList = new List<Type>()
|
|
|
|
|
|
{
|
|
|
|
|
|
/*typeof(Transform),
|
|
|
|
|
|
typeof(UIRoot),
|
|
|
|
|
|
typeof(UICamera),
|
|
|
|
|
|
typeof(UIViewport),
|
|
|
|
|
|
typeof(UIPanel),
|
|
|
|
|
|
typeof(UILabel),
|
|
|
|
|
|
typeof(UIAnchor),
|
|
|
|
|
|
typeof(UIAtlas),
|
|
|
|
|
|
typeof(UIFont),
|
|
|
|
|
|
typeof(UITexture),
|
|
|
|
|
|
typeof(UISprite),
|
|
|
|
|
|
typeof(UIGrid),
|
|
|
|
|
|
typeof(UITable),
|
|
|
|
|
|
typeof(UIWrapGrid),
|
|
|
|
|
|
typeof(UIInput),
|
|
|
|
|
|
typeof(UIScrollView),
|
|
|
|
|
|
typeof(UIEventListener),
|
|
|
|
|
|
typeof(UIScrollBar),
|
|
|
|
|
|
typeof(UICenterOnChild),
|
|
|
|
|
|
typeof(UIScrollView),
|
|
|
|
|
|
typeof(UIButton),
|
|
|
|
|
|
typeof(UITextList),
|
|
|
|
|
|
typeof(UIPlayTween),
|
|
|
|
|
|
typeof(UIDragScrollView),
|
|
|
|
|
|
typeof(UISpriteAnimation),
|
|
|
|
|
|
typeof(UIWrapContent),
|
|
|
|
|
|
typeof(TweenWidth),
|
|
|
|
|
|
typeof(TweenAlpha),
|
|
|
|
|
|
typeof(TweenColor),
|
|
|
|
|
|
typeof(TweenRotation),
|
|
|
|
|
|
typeof(TweenPosition),
|
|
|
|
|
|
typeof(TweenScale),
|
|
|
|
|
|
typeof(TweenHeight),
|
|
|
|
|
|
typeof(TypewriterEffect),
|
|
|
|
|
|
typeof(UIToggle),
|
|
|
|
|
|
typeof(Localization),*/
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-07-04 00:27:03 +08:00
|
|
|
|
public static List<Type> scriptsList = new List<Type>()
|
|
|
|
|
|
{
|
|
|
|
|
|
//typeof(EmojiDitc),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-06-10 16:11:48 +08:00
|
|
|
|
public static BindType _GT(Type t)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new BindType(t);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static DelegateType _DT(Type t)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new DelegateType(t);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|