博客
关于我
在xlua中使用DoTween动画插件
阅读量:456 次
发布时间:2019-03-06

本文共 1768 字,大约阅读时间需要 5 分钟。

  在使用xlua编程热更新项目时,如果需要使用DoTween动画插件该如何去设置呢?今天就遇到了这个问题,将解决方案记录在这里:

  DoTween通过添加拓展方法的方式为Unity本身的类或对象添加了许多方法,这些方法使用DO、Set、On等开头,不同开头的方法都有特定的作用。xlua要识别DoTween,需要在相应的拓展类上添加[LuaCallCSharp]特性并生成代码,但是对于系统或插件的API,一般不能修改或不方便修改源码(如导出为dll格式使用的插件就不能修改源码),因此需要使用xlua提供的方法为这些API生成代码。

  参考文件:1);2)  五.lua调用C# 9.特殊问题

  代码:1)自定义静态类,包含静态的list属性,在list中添加要生成代码的类型

/// /// 在Xlua中使用DoTween/// public static class DoTweenCallXLua{    [LuaCallCSharp]    [ReflectionUse]    public static List
luaCallCsharpList = new List
(){ 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
), typeof(DG.Tweening.TweenCallback), typeof(DG.Tweening.TweenExtensions), typeof(DG.Tweening.TweenSettingsExtensions), typeof(DG.Tweening.ShortcutExtensions), typeof(DG.Tweening.ShortcutExtensions43), typeof(DG.Tweening.ShortcutExtensions46), typeof(DG.Tweening.ShortcutExtensions50), };}

  2)在Unity中生成代码

  3)在xlua中调用相关方法即可

  注意事项:在调用过程中发现了一个以前都没有注意到的问题,就是DoTween的DO系列方法DO都是大写的,如果方法名称不正确无法调用

转载地址:http://zlhyz.baihongyu.com/

你可能感兴趣的文章
MySQL两千万数据优化&迁移
查看>>
MySql中 delimiter 详解
查看>>
MYSQL中 find_in_set() 函数用法详解
查看>>