美文网首页
4、xlua实战小例子1

4、xlua实战小例子1

作者: GameObjectLgy | 来源:发表于2020-11-15 12:23 被阅读0次

1、引入LuaBehaviour
参考官方例子

2、脚本无端报错,发现是没有采用utf-8编码保存所致
https://blog.csdn.net/qq_37140150/article/details/97252654

3、让vscode 识别非.lua后缀的代码文件 比如.txt .bytes、.lua.txt
https://blog.csdn.net/iway_lch/article/details/91364825

如果找不到settings.json就继续往下滑


image.png

4、在工程中引入DOTween插件

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using XLua;

/// <summary>
/// xlua自定义导出
/// </summary>
public static class XLuaCustomExport
{
    /// <summary>
    /// dotween的扩展方法在lua中调用
    /// </summary>
    [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.TweenCallback),
        typeof(DG.Tweening.TweenExtensions),
        typeof(DG.Tweening.TweenSettingsExtensions),
        typeof(DG.Tweening.ShortcutExtensions),

        //如果这部分在DOTween插件中没有使用的话,需要注释掉
        typeof(DG.Tweening.ShortcutExtensions43),
        typeof(DG.Tweening.ShortcutExtensions46),
        typeof(DG.Tweening.ShortcutExtensions50),
       
        //dotween pro 的功能
        //typeof(DG.Tweening.DOTweenPath),
        //typeof(DG.Tweening.DOTweenVisualManager),
    };
}

调用方式举例:myBtn.transform:DOScale(Vector3(2, 2, 2), 2)

相关文章

  • 4、xlua实战小例子1

    1、引入LuaBehaviour参考官方例子 2、脚本无端报错,发现是没有采用utf-8编码保存所致https:/...

  • XLua-热更新(HotFix)

    仿照XLua的官方例子,我们做一个XLua的热更新1.按照hotfix.md的使用说明 1、添加HOTFIX_EN...

  • XLua_热更新学习一,把Xlua迁入工程

    1.下载Xlua源码 https://github.com/Tencent/xLua/

  • unity xlua入门

    xlua脚本 myxlua.lua.txt print("my xlua file");num1=10str1='...

  • unity教程二:配置xlua环境

    ( 1 )先根据文档配置运行 1.下载Xlua源码https://github.com/Tencent/xLua/...

  • xLua介绍

    xLua地址:传送门[https://github.com/Tencent/xLua] Xlua是啥?2016年 ...

  • 在用中学

    日更4/100 几天前看到辉哥的文章《实战、实战、实战》,举了几个例子:实弹射击、OKR、摄影。辉哥鼓励大家「放下...

  • Redis1️⃣5️⃣课 GEO

    1.GEO是什么? 2. 五个城市经纬度 3.相关命令 实战例子 4.相关说明 1). Since 3.22). ...

  • Mac上Unity配置xlua

    unity版本:2019.4.9f1 1、首先从xLua官网下载名为xLua-master的压缩包,新建一个uni...

  • (XLua)C#与Lua中的交互

    XLua下载地址:https://github.com/Tencent/xLua 下载后接下来就是导入XLua到u...

网友评论

      本文标题:4、xlua实战小例子1

      本文链接:https://www.haomeiwen.com/subject/urnzpktx.html