static int Play(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                BCTweenScale obj = (BCTweenScale)ToLua.CheckObject <BCTweenScale>(L, 1);
                obj.Play();
                return(0);
            }
            else if (count == 2)
            {
                BCTweenScale obj  = (BCTweenScale)ToLua.CheckObject <BCTweenScale>(L, 1);
                bool         arg0 = LuaDLL.luaL_checkboolean(L, 2);
                obj.Play(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: BCTweenScale.Play"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        BCEditorTools.SetLabelWidth(120f);

        BCTweenScale tw = target as BCTweenScale;

        GUI.changed = false;

        Vector3 from = EditorGUILayout.Vector3Field("From", tw.from);

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Set local From"))
        {
            from        = tw.value;
            GUI.changed = true;
        }
        if (GUILayout.Button("Reset By local From"))
        {
            tw.value = from;
        }
        EditorGUILayout.EndHorizontal();
        Vector3 to = EditorGUILayout.Vector3Field("To", tw.to);

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Set local To"))
        {
            to          = tw.value;
            GUI.changed = true;
        }
        if (GUILayout.Button("Reset By local To"))
        {
            tw.value = to;
        }
        EditorGUILayout.EndHorizontal();

        bool fromIsCurrent = EditorGUILayout.Toggle("From Is Current", tw.fromIsCurrent);
        bool RelativeScale = false;

        if (fromIsCurrent)
        {
            RelativeScale = EditorGUILayout.Toggle("->Relative Scale", tw.RelativeScale);
        }

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

        if (GUI.changed)
        {
            BCEditorTools.RegisterUndo("Tween Change", tw);
            tw.from          = from;
            tw.to            = to;
            tw.fromIsCurrent = fromIsCurrent;
            tw.RelativeScale = RelativeScale;
            BCEditorTools.SetDirty(tw);
        }

        DrawCommonProperties();
    }
Beispiel #3
0
    /// <summary>
    /// Start the tweening operation.
    /// </summary>

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

        comp.from = comp.value;
        comp.to   = scale;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
 static int SetCurrentValueToEnd(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         BCTweenScale obj = (BCTweenScale)ToLua.CheckObject <BCTweenScale>(L, 1);
         obj.SetCurrentValueToEnd();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int set_value(IntPtr L)
    {
        object o = null;

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

        try
        {
            o = ToLua.ToObject(L, 1);
            BCTweenScale          obj  = (BCTweenScale)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"));
        }
    }
    static int set_RelativeScale(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BCTweenScale obj  = (BCTweenScale)o;
            bool         arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.RelativeScale = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index RelativeScale on a nil value"));
        }
    }
 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);
         BCTweenScale        o    = BCTweenScale.Begin(arg0, arg1, arg2);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int get_value(IntPtr L)
    {
        object o = null;

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

        try
        {
            o = ToLua.ToObject(L, 1);
            BCTweenScale          obj = (BCTweenScale)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"));
        }
    }
    static int get_RelativeScale(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            BCTweenScale obj = (BCTweenScale)o;
            bool         ret = obj.RelativeScale;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index RelativeScale on a nil value"));
        }
    }
Beispiel #12
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;
    }