实现步骤
使用 [LuaCallCSharp]和 [ReflectionUse]属性包裹住一个静态的类型为List《Type》的变量
将大部分DG.Tweening命名空间中的类都包裹进来并生成。
网上的大部分帖子都是这样的,但是他并没有贴完整,简直是误导了一半的人人,像网上的帖子那么干只能使用到最基础的Transform的拓展方法,而像是UGUI中的图片,文本,或者AudioSource调用Dotween的方法都会报空,那是因为网上并没有写完整,如果想要使用其他的模块,就要将这些模块也囊括在这个静态列表中,代码如下:
[LuaCallCSharp]
[ReflectionUse]
public static List<Type> dotween_lua_call_cs_list = new List<Type>()
{
typeof(DG.Tweening.AutoPlay),
typeof(DG.Tweening.AxisConstraint),
typeof(DG.Tweening.Ease),
typeof(DG.Tweening.LogBehaviour),
typeof(DG.Tweening.LoopType),
typeof(DG.Tweening.PathMode),
typeof(DG.Tweening.PathType),
typeof(DG.Tweening.RotateMode),
typeof(DG.Tweening.ScrambleMode),
typeof(DG.Tweening.TweenType),
typeof(DG.Tweening.UpdateType),
typeof(DG.Tweening.DOTween),
typeof(DG.Tweening.DOVirtual),
typeof(DG.Tweening.EaseFactory),
typeof(DG.Tweening.Tweener),
typeof(DG.Tweening.Tween),
typeof(DG.Tweening.Sequence),
typeof(DG.Tweening.TweenParams),
typeof(DG.Tweening.Core.ABSSequentiable),
typeof(DG.Tweening.Core.TweenerCore<Vector3, Vector3, DG.Tweening.Plugins.Options.VectorOptions>),
typeof(DG.Tweening.Core.TweenerCore<Color,Color,DG.Tweening.Plugins.Options.ColorOptions>),
typeof(DG.Tweening.Core.TweenerCore<float,float,DG.Tweening.Plugins.Options.FloatOptions>),
typeof(DG.Tweening.TweenCallback),
typeof(DG.Tweening.TweenExtensions),
typeof(DG.Tweening.TweenSettingsExtensions),
typeof(DG.Tweening.ShortcutExtensions),
typeof(DG.Tweening.DOTweenModuleUI),
//有了以下这部分才能真正使用其他模块的拓展方法,这是其他帖子都没写的
typeof(DG.Tweening.DOTweenModuleSprite),
typeof(DG.Tweening.DOTweenModuleAudio),
typeof(DG.Tweening.DOTweenModulePhysics),
typeof(DG.Tweening.DOTweenModulePhysics2D)
}
找了半天的错误,真的是无语了。。各位大佬发帖子就应该说清楚一点才对。。都讲了一半