Пример #1
0
    /// <summary>
    /// Start the tweening operation.
    /// </summary>

    static public TweenLabelCounter Begin(GameObject go, float duration, int value)
    {
        TweenLabelCounter comp = UITweener.Begin <TweenLabelCounter>(go, duration);

        comp.from = comp.Value;
        comp.to   = value;

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

        TweenLabelCounter tw = target as TweenLabelCounter;

        GUI.changed = false;

        int    from         = EditorGUILayout.IntField("From", tw.from);
        int    to           = EditorGUILayout.IntField("To", tw.to);
        string formatString = EditorGUILayout.TextField("Format String", tw.formatString);

        if (GUI.changed)
        {
            NGUIEditorTools.RegisterUndo("Tween Change", tw);
            tw.from         = from;
            tw.to           = (to > from) ? to : from;
            tw.formatString = formatString;
            UnityEditor.EditorUtility.SetDirty(tw);
        }

        DrawCommonProperties();
    }