博客
关于我
在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/

你可能感兴趣的文章
MySQL5.7.37windows解压版的安装使用
查看>>
mysql5.7免费下载地址
查看>>
mysql5.7命令总结
查看>>
mysql5.7安装
查看>>
mysql5.7性能调优my.ini
查看>>
MySQL5.7新增Performance Schema表
查看>>
Mysql5.7深入学习 1.MySQL 5.7 中的新增功能
查看>>
Webpack 之 basic chunk graph
查看>>
Mysql5.7版本单机版my.cnf配置文件
查看>>
mysql5.7的安装和Navicat的安装
查看>>
mysql5.7示例数据库_Linux MySQL5.7多实例数据库配置
查看>>
Mysql8 数据库安装及主从配置 | Spring Cloud 2
查看>>
mysql8 配置文件配置group 问题 sql语句group不能使用报错解决 mysql8.X版本的my.cnf配置文件 my.cnf文件 能够使用的my.cnf配置文件
查看>>
MySQL8.0.29启动报错Different lower_case_table_names settings for server (‘0‘) and data dictionary (‘1‘)
查看>>
MYSQL8.0以上忘记root密码
查看>>
Mysql8.0以上重置初始密码的方法
查看>>
mysql8.0新特性-自增变量的持久化
查看>>
Mysql8.0注意url变更写法
查看>>
Mysql8.0的特性
查看>>
MySQL8修改密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
查看>>