博客
关于我
在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-【1】配置
查看>>
MySQL-【4】基本操作
查看>>
Mysql-丢失更新
查看>>
Mysql-事务阻塞
查看>>
Mysql-存储引擎
查看>>
mysql-开启慢查询&所有操作记录日志
查看>>
MySQL-数据目录
查看>>
MySQL-数据页的结构
查看>>
MySQL-架构篇
查看>>
MySQL-索引的分类(聚簇索引、二级索引、联合索引)
查看>>
Mysql-触发器及创建触发器失败原因
查看>>
MySQL-连接
查看>>
mysql-递归查询(二)
查看>>
MySQL5.1安装
查看>>
mysql5.5和5.6版本间的坑
查看>>
mysql5.5最简安装教程
查看>>
mysql5.6 TIME,DATETIME,TIMESTAMP
查看>>
mysql5.6.21重置数据库的root密码
查看>>
Mysql5.6主从复制-基于binlog
查看>>
MySQL5.6忘记root密码(win平台)
查看>>