Ejemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        NGUIEditorTools.SetLabelWidth(120f);

        TweenGradientColor tw = target as TweenGradientColor;

        GUI.changed = false;

        Color topFrom = EditorGUILayout.ColorField("TopFrom", tw.topFrom);
        Color topTo   = EditorGUILayout.ColorField("TopTo", tw.topTo);

        Color bottomFrom = EditorGUILayout.ColorField("BottomFrom", tw.bottomFrom);
        Color bottomTo   = EditorGUILayout.ColorField("BottomTo", tw.bottomTo);

        if (GUI.changed)
        {
            NGUIEditorTools.RegisterUndo("Tween Change", tw);
            tw.topFrom = topFrom;
            tw.topTo   = topTo;

            tw.bottomFrom = bottomFrom;
            tw.bottomTo   = bottomTo;
            NGUITools.SetDirty(tw);
        }

        DrawCommonProperties();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Start the tweening operation.
    /// </summary>

    static public TweenGradientColor Begin(GameObject go, float duration, Gradient gradient)
    {
#if UNITY_EDITOR
        if (!Application.isPlaying)
        {
            return(null);
        }
#endif
        TweenGradientColor comp = UITweener.Begin <TweenGradientColor>(go, duration);
        comp.gradient = gradient;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Start the tweening operation.
    /// </summary>

    static public TweenGradientColor Begin(GameObject go, float duration, Color colorTop, Color colorBottom)
    {
#if UNITY_EDITOR
        if (!Application.isPlaying)
        {
            return(null);
        }
#endif
        TweenGradientColor comp = UITweener.Begin <TweenGradientColor>(go, duration);
        comp.topFrom = comp.topValue;
        comp.topTo   = colorTop;

        comp.bottomFrom = comp.bottomValue;
        comp.bottomTo   = colorBottom;


        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }