Beispiel #1
0
    static int Play(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                BCTweenPosition obj = (BCTweenPosition)ToLua.CheckObject <BCTweenPosition>(L, 1);
                obj.Play();
                return(0);
            }
            else if (count == 2)
            {
                BCTweenPosition obj  = (BCTweenPosition)ToLua.CheckObject <BCTweenPosition>(L, 1);
                bool            arg0 = LuaDLL.luaL_checkboolean(L, 2);
                obj.Play(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: BCTweenPosition.Play"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Beispiel #2
0
 static int SetEndToCurrentValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         BCTweenPosition obj = (BCTweenPosition)ToLua.CheckObject <BCTweenPosition>(L, 1);
         obj.SetEndToCurrentValue();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #3
0
    /// <summary>
    /// Start the tweening operation.
    /// </summary>

    static public BCTweenPosition Begin(GameObject go, float duration, Vector3 pos)
    {
        BCTweenPosition comp = BCUITweener.Begin <BCTweenPosition>(go, duration);

        comp.from = comp.value;
        comp.to   = pos;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
Beispiel #4
0
 static int DoOnUpdate(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         BCTweenPosition obj  = (BCTweenPosition)ToLua.CheckObject <BCTweenPosition>(L, 1);
         float           arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         bool            arg1 = LuaDLL.luaL_checkboolean(L, 3);
         obj.DoOnUpdate(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #5
0
    static int set_Old_to(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BCTweenPosition     obj  = (BCTweenPosition)o;
            UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2);
            obj.Old_to = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Old_to on a nil value"));
        }
    }
Beispiel #6
0
    static int set_UseTransform(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BCTweenPosition obj  = (BCTweenPosition)o;
            bool            arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.UseTransform = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index UseTransform on a nil value"));
        }
    }
Beispiel #7
0
    static int set_mTrans(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BCTweenPosition       obj  = (BCTweenPosition)o;
            UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.CheckObject <UnityEngine.Transform>(L, 2);
            obj.mTrans = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index mTrans on a nil value"));
        }
    }
Beispiel #8
0
    static int set_pathCurve(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BCTweenPosition            obj  = (BCTweenPosition)o;
            UnityEngine.AnimationCurve arg0 = (UnityEngine.AnimationCurve)ToLua.CheckObject(L, 2, typeof(UnityEngine.AnimationCurve));
            obj.pathCurve = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index pathCurve on a nil value"));
        }
    }
Beispiel #9
0
    static int get_Old_to(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BCTweenPosition     obj = (BCTweenPosition)o;
            UnityEngine.Vector3 ret = obj.Old_to;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index Old_to on a nil value"));
        }
    }
Beispiel #10
0
    static int get_cachedTransform(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BCTweenPosition       obj = (BCTweenPosition)o;
            UnityEngine.Transform ret = obj.cachedTransform;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index cachedTransform on a nil value"));
        }
    }
Beispiel #11
0
    static int get_UseTransform(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BCTweenPosition obj = (BCTweenPosition)o;
            bool            ret = obj.UseTransform;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index UseTransform on a nil value"));
        }
    }
Beispiel #12
0
 static int Begin(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));
         float arg1 = (float)LuaDLL.luaL_checknumber(L, 2);
         UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3);
         BCTweenPosition     o    = BCTweenPosition.Begin(arg0, arg1, arg2);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #13
0
    static int get_pathCurve(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BCTweenPosition            obj = (BCTweenPosition)o;
            UnityEngine.AnimationCurve ret = obj.pathCurve;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index pathCurve on a nil value"));
        }
    }
Beispiel #14
0
    //call me before play
    public void JudgeTween()
    {
        if (randMaker == null || tweener == null)
        {
            return;
        }
        Vector3 fromfinal     = from;
        Vector3 tofinal       = to;
        float   durationFinal = duration;
        float   delayfinal    = delay;

        //-------------First handle the situation of Current mode-------------
        if (tweener is BCTweenRotation)
        {
            BCTweenRotation tween     = tweener as BCTweenRotation;
            Vector3         realvalue = tween.value.eulerAngles;
            if (from_rule[0] == TweenFromRule.Current)
            {
                fromfinal.x = realvalue.x;
            }
            if (from_rule[1] == TweenFromRule.Current)
            {
                fromfinal.y = realvalue.y;
            }
            if (from_rule[2] == TweenFromRule.Current)
            {
                fromfinal.z = realvalue.z;
            }
        }
        else if (tweener is BCTweenScale)
        {
            BCTweenScale tween = tweener as BCTweenScale;
            if (from_rule[0] == TweenFromRule.Current)
            {
                fromfinal.x = tween.value.x;
            }
            if (from_rule[1] == TweenFromRule.Current)
            {
                fromfinal.y = tween.value.y;
            }
            if (from_rule[2] == TweenFromRule.Current)
            {
                fromfinal.z = tween.value.z;
            }
        }
        else if (tweener is BCTweenPosition)
        {
            BCTweenPosition tween = tweener as BCTweenPosition;
            if (from_rule[0] == TweenFromRule.Current)
            {
                fromfinal.x = tween.value.x;
            }
            if (from_rule[1] == TweenFromRule.Current)
            {
                fromfinal.y = tween.value.y;
            }
            if (from_rule[2] == TweenFromRule.Current)
            {
                fromfinal.z = tween.value.z;
            }
        }
        //----------then handle other----------------------
        if (from_rule[0] == TweenFromRule.RandValue)
        {
            fromfinal.x = randMaker.GetRand(ruleTagFrom[0]);
        }
        if (from_rule[1] == TweenFromRule.RandValue)
        {
            fromfinal.y = randMaker.GetRand(ruleTagFrom[1]);
        }
        if (from_rule[2] == TweenFromRule.RandValue)
        {
            fromfinal.z = randMaker.GetRand(ruleTagFrom[2]);
        }
        if (to_rule[0] == TweenToRule.RandValue)
        {
            tofinal.x = randMaker.GetRand(ruleTagTo[0]);
        }
        if (to_rule[1] == TweenToRule.RandValue)
        {
            tofinal.y = randMaker.GetRand(ruleTagTo[1]);
        }
        if (to_rule[2] == TweenToRule.RandValue)
        {
            tofinal.z = randMaker.GetRand(ruleTagTo[2]);
        }
        if (to_rule[0] == TweenToRule.FromPlusRand)
        {
            tofinal.x = fromfinal.x + randMaker.GetRand(ruleTagTo[0]);
        }
        if (to_rule[1] == TweenToRule.FromPlusRand)
        {
            tofinal.y = fromfinal.y + randMaker.GetRand(ruleTagTo[1]);
        }
        if (to_rule[2] == TweenToRule.FromPlusRand)
        {
            tofinal.z = fromfinal.z + randMaker.GetRand(ruleTagTo[2]);
        }
        if (to_rule[0] == TweenToRule.FromPlusFormula)
        {
            tofinal.x = randMaker.CalculateForm(ruleTagTo[0], fromfinal.x);
        }
        if (to_rule[1] == TweenToRule.FromPlusFormula)
        {
            tofinal.y = randMaker.CalculateForm(ruleTagTo[1], fromfinal.y);
        }
        if (to_rule[2] == TweenToRule.FromPlusFormula)
        {
            tofinal.z = randMaker.CalculateForm(ruleTagTo[2], fromfinal.z);
        }

        //--------------------------------------------------
        if (tweener is BCTweenRotation)
        {
            BCTweenRotation tween = tweener as BCTweenRotation;
            tween.from = fromfinal;
            tween.to   = tofinal;
        }
        else if (tweener is BCTweenScale)
        {
            BCTweenScale tween = tweener as BCTweenScale;
            tween.from = fromfinal;
            tween.to   = tofinal;
        }
        else if (tweener is BCTweenPosition)
        {
            BCTweenPosition tween = tweener as BCTweenPosition;
            tween.from = fromfinal;
            tween.to   = tofinal;
        }

        if (durationRule == TweenTimeRule.RandValue)
        {
            durationFinal = randMaker.GetRand(ruleTagDuration);
        }
        if (delayRule == TweenTimeRule.RandValue)
        {
            delayfinal = randMaker.GetRand(ruleTagDelay);
        }
        tweener.delay    = delayfinal;
        tweener.duration = durationFinal;
    }
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        BCEditorTools.SetLabelWidth(120f);

        BCTweenPosition tw = target as BCTweenPosition;

        GUI.changed = false;
        bool useTransform = EditorGUILayout.Toggle("Use Transform", tw.UseTransform);

        Vector3   from = tw.from;
        Transform fromTran = null, toTran = null;

        if (useTransform)
        {
            fromTran = EditorGUILayout.ObjectField("From", tw.fromTran, typeof(Transform)) as Transform;
        }
        else
        {
            from = EditorGUILayout.Vector3Field("From", tw.from);
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Set From"))
            {
                from        = tw.value;
                GUI.changed = true;
            }
            if (GUILayout.Button("Reset By From"))
            {
                tw.value = from;
            }
            EditorGUILayout.EndHorizontal();
        }
        Vector3 to = tw.to;

        if (useTransform)
        {
            toTran = EditorGUILayout.ObjectField("To", tw.toTran, typeof(Transform)) as Transform;
        }
        else
        {
            to = EditorGUILayout.Vector3Field("To", tw.to);
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Set To"))
            {
                to          = tw.value;
                GUI.changed = true;
            }
            if (GUILayout.Button("Reset By To"))
            {
                tw.value = to;
            }
            EditorGUILayout.EndHorizontal();
        }


        bool fromIsCurrent = false, RelativeMove = false;
        bool LockX = false, LockY = false, LockZ = false;

        if (!useTransform)
        {
            fromIsCurrent = EditorGUILayout.Toggle("From Is Current", tw.fromIsCurrent);
            if (fromIsCurrent)
            {
                RelativeMove = EditorGUILayout.Toggle("->Relative Move", tw.RelativeMove);
            }
            LockX = EditorGUILayout.Toggle("Lock X", tw.LockX);
            LockY = EditorGUILayout.Toggle("Lock Y", tw.LockY);
            LockZ = EditorGUILayout.Toggle("Lock Z", tw.LockZ);
        }

        tw.mTrans = EditorGUILayout.ObjectField("Transform", tw.mTrans, typeof(Transform)) as Transform;

        bool           UsePathCurve = EditorGUILayout.Toggle("Use Path Curve", tw.UsePathCurve);
        AnimationCurve curve        = new AnimationCurve();

        if (UsePathCurve)
        {
            curve = EditorGUILayout.CurveField("Path Curve", tw.pathCurve, GUILayout.Width(300f), GUILayout.Height(50f));
        }

        if (GUI.changed)
        {
            BCEditorTools.RegisterUndo("Tween Change", tw);
            tw.from          = from;
            tw.to            = to;
            tw.fromIsCurrent = fromIsCurrent;
            tw.RelativeMove  = RelativeMove;
            tw.LockX         = LockX;
            tw.LockY         = LockY;
            tw.LockZ         = LockZ;
            tw.UsePathCurve  = UsePathCurve;
            if (UsePathCurve)
            {
                tw.pathCurve = curve;
            }
            tw.UseTransform = useTransform;
            if (useTransform)
            {
                tw.fromTran = fromTran;
                tw.toTran   = toTran;
            }
            BCEditorTools.SetDirty(tw);
        }

        DrawCommonProperties();
    }