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

        CustomTweenHeight tw = target as CustomTweenHeight;

        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();
    }
    /// <summary>
    /// 创建制定对象的撤消点
    /// </summary>
    static public void RegisterUndo(string name, params Object[] objects)
    {
        if (objects != null && objects.Length > 0)
        {
            UnityEditor.Undo.RecordObjects(objects, name);

            foreach (Object obj in objects)
            {
                if (obj == null)
                {
                    continue;
                }
                CustomUITweenTools.SetDirty(obj);
            }
        }
    }
Ejemplo n.º 3
0
    protected void DrawCommonProperties()
    {
        CustomUITweener tw = target as CustomUITweener;

        if (CustomUITweenEditorTools.DrawHeader("Tweener"))
        {
            CustomUITweenEditorTools.BeginContents();
            CustomUITweenEditorTools.SetLabelWidth(110f);

            GUI.changed = false;

            CustomUITweener.Style style = (CustomUITweener.Style)EditorGUILayout.EnumPopup("Play Style", tw.style);
            EaseType       easeType     = (EaseType)EditorGUILayout.EnumPopup("Ease Type", tw.easeType);
            AnimationCurve curve        = EditorGUILayout.CurveField("Animation Curve", tw.animationCurve, GUILayout.Width(170f), GUILayout.Height(62f));
            GUILayout.BeginHorizontal();
            float dur = EditorGUILayout.FloatField("Duration", tw.duration, GUILayout.Width(170f));
            GUILayout.Label("seconds");
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            float del = EditorGUILayout.FloatField("Start Delay", tw.delay, GUILayout.Width(170f));
            GUILayout.Label("seconds");
            GUILayout.EndHorizontal();

            int  tg = EditorGUILayout.IntField("Tween Group", tw.tweenGroup, GUILayout.Width(170f));
            bool ts = EditorGUILayout.Toggle("Ignore TimeScale", tw.ignoreTimeScale);

            if (GUI.changed)
            {
                CustomUITweenEditorTools.RegisterUndo("Tween Change", tw);
                tw.easeType        = easeType;
                tw.style           = style;
                tw.ignoreTimeScale = ts;
                tw.tweenGroup      = tg;
                tw.duration        = dur;
                tw.delay           = del;
                CustomUITweenTools.SetDirty(tw);
            }
            CustomUITweenEditorTools.EndContents();
        }

        CustomUITweenEditorTools.SetLabelWidth(80f);
        CustomUITweenEditorTools.DrawEvents("On Finished", tw, tw.onFinished);
    }
Ejemplo n.º 4
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        CustomUITweenEditorTools.SetLabelWidth(120f);

        CustomTweenColor tw = target as CustomTweenColor;

        GUI.changed = false;

        Color from = EditorGUILayout.ColorField("From", tw.from);
        Color to   = EditorGUILayout.ColorField("To", tw.to);

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

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

        CustomTweenVolume tw = target as CustomTweenVolume;

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

        DrawCommonProperties();
    }