zoukankan      html  css  js  c++  java
  • U3D 扩展方法 & Dotween & tolua

    using UnityEngine;
    using System.Collections;
    using LuaInterface;//tolua 空间引用 
    using DG.Tweening;//DOTWEEN 空间引用 
    
    
    public static class MyExt{//扩展方法必须在静态类中
        public static Transform LQDoMove(this Transform root, string str){//必须为静态方法, 第一参数为 this Transform, camera 等
            Debug.Log(str);
            return root;//返回transform以实现链式调用
    
        }
        public static Transform LQ1(this Transform root){
            Debug.Log ("lq1========================");
            return root;
        }
    
        public static Transform LQ2(this Transform root){
            Debug.Log ("lq2========================");
            return root;
        }
    
        public static Transform LQ3(this Transform root){
            Debug.Log ("lq3========================");
            return root;
        }
    }
    public class helloLua : MonoBehaviour {
    
    
        // Use this for initialization
        void Start () {
            Debug.Log ("start------------");
            LuaState L = new LuaState ();
            string luaPath = Application.dataPath + "/Lua";
    
            L.Start ();
            L.AddSearchPath (luaPath);
            L.DoFile ("helloLua.lua");
            L.CheckTop ();
            L.Dispose ();
    
            transform.LQDoMove ("LQDoMove=====================").LQ1 ().LQ2 ().LQ3 ();//链式调用
            Tweener tw = transform.DOMove (new Vector3 (2, 2, 2), 1, false);
            tw.SetEase (Ease.InOutBack);
            tw.SetLoops (4, LoopType.Restart);
            tw.OnComplete(() => {
                Debug.Log("OnComplete================================");
            });
        }
        
        // Update is called once per frame
        void Update () {
            
        }
    }
  • 相关阅读:
    @resource、@Autowired、@Service在一个接口多个实现类中的应用
    java 中 静态块的作用
    数组、List和ArrayList的区别
    C#优化
    Net XML操作
    Asp.Net MVC+EF+三层架构的完整搭建过程
    C#多线程
    算法
    详解java中的byte类型
    虚幻4蓝图编译剖析(三)
  • 原文地址:https://www.cnblogs.com/timeObjserver/p/6038139.html
Copyright © 2011-2022 走看看