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

        CustomTweenWidth tw = target as CustomTweenWidth;

        GUI.changed = false;

        int  from  = EditorGUILayout.IntField("From", tw.from);
        int  to    = EditorGUILayout.IntField("To", tw.to);
        bool table = EditorGUILayout.Toggle("Update Table", tw.updateTable);

        if (from < 0)
        {
            from = 0;
        }
        if (to < 0)
        {
            to = 0;
        }

        if (GUI.changed)
        {
            CustomUITweenEditorTools.RegisterUndo("Tween Change", tw);
            tw.from        = from;
            tw.to          = to;
            tw.updateTable = table;
            CustomUITweenTools.SetDirty(tw);
        }

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

    static public CustomTweenWidth Begin(RectTransform rectTransform, float duration, int width)
    {
        CustomTweenWidth comp = CustomUITweener.Begin <CustomTweenWidth>(rectTransform.gameObject, duration);

        comp.from = (int)rectTransform.sizeDelta.x;
        comp.to   = width;

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