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

        TweenFillAmount tw = target as TweenFillAmount;

        GUI.changed = false;

        float from = EditorGUILayout.Slider("From", tw.from, 0f, 1f);
        float to   = EditorGUILayout.Slider("To", tw.to, 0f, 1f);

        if (GUI.changed)
        {
            NGUIEditorTools.RegisterUndo("Tween Change", tw);
            tw.from = from;
            tw.to   = to;
            if (preview)
            {
                tw.Sample(tw.tweenFactor, false);
            }
            NGUITools.SetDirty(tw);
        }

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

    static public TweenFillAmount Begin(GameObject go, float duration, float fillAmount)
    {
        TweenFillAmount comp = UITweener.Begin <TweenFillAmount>(go, duration);

        comp.from = comp.value;
        comp.to   = fillAmount;

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

    static public TweenFillAmount Begin(GameObject widget, UISprite target, float duration, float value)
    {
        mBasic = target;
        TweenFillAmount comp = UITweener.Begin <TweenFillAmount>(widget, duration);

        comp.from = mBasic.fillAmount;
        comp.to   = value;

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