Beispiel #1
0
    /// <summary>
    /// 开始补间操作
    /// </summary>

    static public CustomTweenAlpha Begin(GameObject go, float duration, float alpha)
    {
        CustomTweenAlpha comp = CustomUITweener.Begin <CustomTweenAlpha>(go, duration);

        comp.from = comp.value;
        comp.to   = alpha;

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

        CustomTweenAlpha tw = target as CustomTweenAlpha;

        GUI.changed = false;

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

        if (GUI.changed)
        {
            CustomUITweenEditorTools.RegisterUndo("Tween Change", tw);
            tw.from = from;
            tw.to   = to;
            UnityEditor.EditorUtility.SetDirty(tw);
        }
        DrawCommonProperties();
    }