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 () {
            
        }
    }
  • 相关阅读:
    Python 集合
    Python sorted()
    CodeForces 508C Anya and Ghosts
    CodeForces 496B Secret Combination
    CodeForces 483B Friends and Presents
    CodeForces 490C Hacking Cypher
    CodeForces 483C Diverse Permutation
    CodeForces 478C Table Decorations
    CodeForces 454C Little Pony and Expected Maximum
    CodeForces 313C Ilya and Matrix
  • 原文地址:https://www.cnblogs.com/timeObjserver/p/6038139.html
Copyright © 2011-2022 走看看