Exemplo n.º 1
0
    private static int DoScaleFrom(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 5 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(LuaTable), typeof(float), typeof(int), typeof(LuaFunction)))
        {
            GameObject obj = LuaScriptMgr.GetUnityObject <GameObject>(L, 1);
            if (obj == null)
            {
                HobaDebuger.LogError("GameUtil :: DoScaleFrom -> the GameObject is null.");
                return(CheckReturnNum(L, count, nRet));
            }

            DoTweenComponent doTween = obj.GetComponent <DoTweenComponent>();
            if (doTween == null)
            {
                doTween = obj.AddComponent <DoTweenComponent>();
            }

            Vector3 fromScale = LuaScriptMgr.GetVector3(L, 2);
            float   interval  = (float)LuaScriptMgr.GetNumber(L, 3);
            Ease    easeType  = (Ease)LuaScriptMgr.GetNumber(L, 4);

            LuaFunction callbackRef = LuaScriptMgr.GetLuaFunction(L, 5);
            doTween.DoScaleFrom(fromScale, interval, easeType, callbackRef);
        }
        else
        {
            LogParamError("DoScaleFrom", count);
        }

        return(CheckReturnNum(L, count, nRet));
    }
Exemplo n.º 2
0
    private static int DoKill(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject)))
        {
            GameObject obj = LuaScriptMgr.GetUnityObject <GameObject>(L, 1);
            if (obj == null)
            {
                HobaDebuger.LogError("GameUtil :: DoKill -> the GameObject is null.");
                return(CheckReturnNum(L, count, nRet));
            }
            //Debug.Log("Kill " + obj.name);
            DoTweenComponent doTween = obj.GetComponent <DoTweenComponent>();
            if (doTween != null)
            {
                doTween.KillAll();
            }

            DOTween.Kill(obj);
        }
        else
        {
            LogParamError("DoKill", count);
        }

        return(CheckReturnNum(L, count, nRet));
    }
Exemplo n.º 3
0
    private static int DoLoopRotate(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(LuaTable), typeof(float)))
        {
            GameObject obj = LuaScriptMgr.GetUnityObject <GameObject>(L, 1);
            if (obj == null)
            {
                HobaDebuger.LogError("GameUtil :: DoRotation -> the GameObject is null.");
                return(CheckReturnNum(L, count, nRet));
            }

            DoTweenComponent doTween = obj.GetComponent <DoTweenComponent>();
            if (doTween == null)
            {
                doTween = obj.AddComponent <DoTweenComponent>();
            }

            var   endValue = LuaScriptMgr.GetVector3(L, 2);
            float interval = (float)LuaScriptMgr.GetNumber(L, 3);
            doTween.DoLoopRotate(endValue, interval);
        }
        else
        {
            LogParamError("DoLoopRotate", count);
        }

        return(CheckReturnNum(L, count, nRet));
    }
Exemplo n.º 4
0
    private static int DoAlpha(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 4 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(float), typeof(float), typeof(LuaFunction)))
        {
            GameObject obj = LuaScriptMgr.GetUnityObject <GameObject>(L, 1);
            if (obj == null)
            {
                HobaDebuger.LogError("GameUtil :: DoAlpha -> the GameObject is null.");
                return(CheckReturnNum(L, count, nRet));
            }

            DoTweenComponent doTween = obj.GetComponent <DoTweenComponent>();
            if (doTween == null)
            {
                doTween = obj.AddComponent <DoTweenComponent>();
            }

            float endValue = (float)LuaScriptMgr.GetNumber(L, 2);
            float interval = (float)LuaScriptMgr.GetNumber(L, 3);

            LuaFunction callbackRef = LuaScriptMgr.GetLuaFunction(L, 4);

            doTween.DoAlpha(endValue, interval, callbackRef);
        }
        else
        {
            LogParamError("DoAlpha", count);
        }

        return(CheckReturnNum(L, count, nRet));
    }
Exemplo n.º 5
0
    private static int DoLocalMove(IntPtr L)
    {
        int       count = LuaDLL.lua_gettop(L);
        const int nRet  = 0;

        if (count == 5 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(LuaTable), typeof(float), typeof(int), typeof(LuaFunction)))
        {
            GameObject obj = LuaScriptMgr.GetUnityObject <GameObject>(L, 1);
            if (obj == null)
            {
                //LuaScriptMgr.Instance.CallOnTraceBack();
                HobaDebuger.LogError("GameUtil :: DoLocalMove -> the GameObject is null.");
                return(CheckReturnNum(L, count, nRet));
            }

            DoTweenComponent doTween = obj.GetComponent <DoTweenComponent>();
            if (doTween == null)
            {
                doTween = obj.AddComponent <DoTweenComponent>();
            }

            var         toPos       = LuaScriptMgr.GetVector3(L, 2);
            float       interval    = (float)LuaScriptMgr.GetNumber(L, 3);
            Ease        easeType    = (Ease)LuaScriptMgr.GetNumber(L, 4);
            LuaFunction callbackRef = LuaScriptMgr.GetLuaFunction(L, 5);

            //Debug.Log("DoLocalMove " + obj.name+" to "+ toPos);
            doTween.DoLocalMove(toPos, interval, easeType, callbackRef);
        }
        else
        {
            LogParamError("DoLocalMove", count);
        }
        return(CheckReturnNum(L, count, nRet));
    }