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 () {
}
}