Ejemplo n.º 1
0
    static public TweenSpritFill Begin(UISprite sprite, float duration, int targetValue)
    {
        TweenSpritFill comp = UITweener.Begin <TweenSpritFill>(sprite.gameObject, duration);

        comp.from = sprite.fillAmount;
        comp.to   = targetValue;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        NGUIEditorTools.SetLabelWidth(120f);

        TweenSpritFill tw = target as TweenSpritFill;

        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;
            NGUITools.SetDirty(tw);
        }

        DrawCommonProperties();
    }