Example #1
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        UIEditorTools.SetLabelWidth(110f);

        base.OnInspectorGUI();

        DrawCommonProperties();
    }
Example #2
0
    protected void DrawCommonProperties(TweenPRS _tw, TweenPRS.PRSType _type)
    {
        if (UIEditorTools.DrawHeader("Tweener", "Tweener_" + _type.ToString()))
        {
            UIEditorTools.BeginContents();
            UIEditorTools.SetLabelWidth(110f);

            GUI.changed = false;

            TweenPRS.Style style = _tw.GetStyle(_type);
            style = (TweenPRS.Style)EditorGUILayout.EnumPopup("Play Style", style);

            AnimationCurve curve = _tw.GetAnimationCurve(_type);
            curve = EditorGUILayout.CurveField("Animation Curve", curve,
                                               GUILayout.Width(170), GUILayout.Height(62));

            bool useSpeed = _tw.isSpeed(_type);
            if (style == TweenPRS.Style.Once && _type == TweenPRS.PRSType.Pos)
            {
                useSpeed = EditorGUILayout.ToggleLeft("Use Speed", useSpeed);
            }
            else
            {
                useSpeed = false;
            }

            GUILayout.BeginHorizontal();
            float dur = _tw.GetDuration(_type);

            string str = style == TweenPRS.Style.Once ? (useSpeed ? "Speed" : "Duration") : "Duration";
            dur = EditorGUILayout.FloatField(str, dur, GUILayout.Width(170f));
            str = style == TweenPRS.Style.Once ? (useSpeed ? "unit/s" : "seconds") : "seconds";
            GUILayout.Label(str);
            GUILayout.EndHorizontal();


            if (GUI.changed == true)
            {
                UIEditorTools.RegisterUndo("Tween Change", _tw);

                _tw.SetAnimationCurve(_type, curve);
                _tw.SetDuration(_type, dur);
                _tw.SetStyle(_type, style);
                _tw.setEnableSpeed(_type, useSpeed);

                UnityEditor.EditorUtility.SetDirty(_tw);
            }

            UIEditorTools.EndContents();
        }

        UIEditorTools.SetLabelWidth(80f);
        UIEditorTools.DrawEvents("On Finished", "On Finished_" + _type.ToString(), _tw, _tw.GetOnFinished(_type));
    }
Example #3
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        UIEditorTools.SetLabelWidth(120f);

        TweenPRS tw = target as TweenPRS;

        DrawTweenContents(tw, TweenPRS.PRSType.Pos);

        DrawTweenContents(tw, TweenPRS.PRSType.Rot);

        DrawTweenContents(tw, TweenPRS.PRSType.Scale);
    }
Example #4
0
    void DrawTweenContents(TweenPRS _tw, TweenPRS.PRSType _type)
    {
        if (DrawToggleContent(_tw, _type))
        {
            UIEditorTools.BeginContents();
            UIEditorTools.SetLabelWidth(110f);

            GUI.changed = false;

            bool enableOffset = DrawOffsetContent(_tw, _type);
            DrawTweenInfo(_tw, _type, enableOffset);

            UIEditorTools.BeginContents();
            UIEditorTools.SetLabelWidth(100f);
            DrawCommonProperties(_tw, _type);
            UIEditorTools.EndContents();

            UIEditorTools.EndContents();
        }
    }
Example #5
0
    protected void DrawCommonProperties()
    {
        Tweener tw = target as Tweener;

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

            GUI.changed = false;

            Tweener.Style  style = (Tweener.Style)EditorGUILayout.EnumPopup("Play Style", tw.m_Style);
            AnimationCurve curve = EditorGUILayout.CurveField("Animation Curve", tw.m_AnimationCurve,
                                                              GUILayout.Width(170), GUILayout.Height(62));

            GUILayout.BeginHorizontal();
            float dur = EditorGUILayout.FloatField("Duration", tw.Duration, GUILayout.Width(170f));
            GUILayout.Label("seconds");
            GUILayout.EndHorizontal();


            if (GUI.changed == true)
            {
                UIEditorTools.RegisterUndo("Tween Change", tw);

                tw.m_AnimationCurve = curve;
                tw.m_Style          = style;
                tw.Duration         = dur;

                UnityEditor.EditorUtility.SetDirty(tw);
            }

            UIEditorTools.EndContents();
        }

        UIEditorTools.SetLabelWidth(80f);
        UIEditorTools.DrawEvents("On Finished", tw, tw.onFinished);
    }
Example #6
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        UIEditorTools.SetLabelWidth(120f);

        TweenColor tw = target as TweenColor;

        GUI.changed = false;

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

        if (GUI.changed)
        {
            UIEditorTools.RegisterUndo("Tween Change", tw);
            tw.From = from;
            tw.To   = to;

            UnityEditor.EditorUtility.SetDirty(tw);
        }

        DrawCommonProperties();
    }
Example #7
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        UIEditorTools.SetLabelWidth(120f);

        TweenHeight tw = target as TweenHeight;

        GUI.changed = false;

        bool enableOffset = EditorGUILayout.ToggleLeft("Enable Offset ", tw.EnableOffset);

        if (GUI.changed)
        {
            UIEditorTools.RegisterUndo("Tween Change", tw);
            tw.EnableOffset = enableOffset;
            UnityEditor.EditorUtility.SetDirty(tw);
        }

        GUI.changed = false;
        int from = 0, to = 0, offset = 0;

        GUILayout.BeginHorizontal();
        GUILayout.Space(20f);
        GUILayout.BeginVertical();
        GUILayout.Space(2f);

        if (!enableOffset)
        {
            from = EditorGUILayout.IntField("From", (int)tw.From);
            to   = EditorGUILayout.IntField("To", (int)tw.To);
        }
        else
        {
            offset = EditorGUILayout.IntField("Offset", (int)tw.Offset);
        }

        GUILayout.EndHorizontal();
        GUILayout.Space(20f);
        GUILayout.EndVertical();
        GUILayout.Space(2f);

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

        if (GUI.changed)
        {
            UIEditorTools.RegisterUndo("Tween Change", tw);
            if (!enableOffset)
            {
                tw.From = from;
                tw.To   = to;
            }
            else
            {
                tw.Offset = offset;
            }

            UnityEditor.EditorUtility.SetDirty(tw);
        }

        DrawCommonProperties();
    }