首页 > 其他 > 详细

U3D 扩展方法 & Dotween & tolua

时间:2016-11-07 12:21:26      阅读:986      评论:0      收藏:0      [点我收藏+]
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 () {
        
    }
}

 

U3D 扩展方法 & Dotween & tolua

原文:http://www.cnblogs.com/timeObjserver/p/6038139.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!