GetName() public method

public GetName ( int index ) : string
index int
return string
        void OnGUI()
        {
            bool gotMouseUp = (Event.current.type == EventType.MouseUp);

            if (m_DelegateView == null && m_OnCurveChanged == null)
            {
                m_Curve = null;
            }

            if (ms_Styles == null)
            {
                ms_Styles = new Styles();
            }

            // Curve Editor
            m_CurveEditor.rect         = GetCurveEditorRect();
            m_CurveEditor.hRangeLocked = Event.current.shift;
            m_CurveEditor.vRangeLocked = EditorGUI.actionKey;

            GUI.changed = false;

            GUI.Label(m_CurveEditor.drawRect, GUIContent.none, ms_Styles.curveEditorBackground);
            m_CurveEditor.OnGUI();

            // Preset swatch area
            GUI.Box(new Rect(0, position.height - kPresetsHeight, position.width, kPresetsHeight), "", ms_Styles.curveSwatchArea);
            Color curveColor = m_Color;

            curveColor.a *= 0.6f;
            const float margin = 45f;
            const float width  = 40f;
            const float height = 25f;
            float       yPos   = position.height - kPresetsHeight + (kPresetsHeight - height) * 0.5f;

            InitCurvePresets();
            CurvePresetLibrary curveLibrary = m_CurvePresets.GetPresetLibraryEditor().GetCurrentLib();

            if (curveLibrary != null)
            {
                for (int i = 0; i < curveLibrary.Count(); i++)
                {
                    Rect swatchRect = new Rect(margin + (width + 5f) * i, yPos, width, height);
                    m_GUIContent.tooltip = curveLibrary.GetName(i);
                    if (GUI.Button(swatchRect, m_GUIContent, ms_Styles.curveSwatch))
                    {
                        AnimationCurve animCurve = curveLibrary.GetPreset(i) as AnimationCurve;
                        m_Curve.keys         = GetDenormalizedKeys(animCurve.keys);
                        m_Curve.postWrapMode = animCurve.postWrapMode;
                        m_Curve.preWrapMode  = animCurve.preWrapMode;
                        m_CurveEditor.SelectNone();
                        SendEvent(CurveChangedCommand, true);
                    }
                    if (Event.current.type == EventType.Repaint)
                    {
                        curveLibrary.Draw(swatchRect, i);
                    }

                    if (swatchRect.xMax > position.width - 2 * margin)
                    {
                        break;
                    }
                }
            }

            Rect presetDropDownButtonRect = new Rect(margin - 20f, yPos + 5f, 20, 20);

            PresetDropDown(presetDropDownButtonRect);

            // For adding default preset curves
            //if (EditorGUI.DropdownButton(new Rect (position.width -26, yPos, 20, 20), GUIContent.none, FocusType.Passive, "OL Plus"))
            //  AddDefaultPresetsToCurrentLib ();

            if (Event.current.type == EventType.Used && gotMouseUp)
            {
                DoUpdateCurve(false);
                SendEvent(CurveChangeCompletedCommand, true);
            }
            else if (Event.current.type != EventType.Layout && Event.current.type != EventType.Repaint)
            {
                DoUpdateCurve(true);
            }
        }
Esempio n. 2
0
        private void OnGUI()
        {
            bool flag = Event.current.type == EventType.MouseUp;

            if (this.delegateView == null)
            {
                this.m_Curve = null;
            }
            if (ms_Styles == null)
            {
                ms_Styles = new Styles();
            }
            this.m_CurveEditor.rect         = this.GetCurveEditorRect();
            this.m_CurveEditor.hRangeLocked = Event.current.shift;
            this.m_CurveEditor.vRangeLocked = EditorGUI.actionKey;
            GUI.changed = false;
            GUI.Label(this.m_CurveEditor.drawRect, GUIContent.none, ms_Styles.curveEditorBackground);
            this.m_CurveEditor.BeginViewGUI();
            this.m_CurveEditor.GridGUI();
            this.m_CurveEditor.CurveGUI();
            this.DoWrapperPopups();
            this.m_CurveEditor.EndViewGUI();
            GUI.Box(new Rect(0f, base.position.height - 46f, base.position.width, 46f), string.Empty, ms_Styles.curveSwatchArea);
            this.m_Color.a *= 0.6f;
            float y = (base.position.height - 46f) + 10.5f;

            this.InitCurvePresets();
            CurvePresetLibrary currentLib = this.m_CurvePresets.GetPresetLibraryEditor().GetCurrentLib();

            if (currentLib != null)
            {
                for (int i = 0; i < currentLib.Count(); i++)
                {
                    Rect position = new Rect(45f + (45f * i), y, 40f, 25f);
                    this.m_GUIContent.tooltip = currentLib.GetName(i);
                    if (GUI.Button(position, this.m_GUIContent, ms_Styles.curveSwatch))
                    {
                        AnimationCurve preset = currentLib.GetPreset(i) as AnimationCurve;
                        this.m_Curve.keys         = preset.keys;
                        this.m_Curve.postWrapMode = preset.postWrapMode;
                        this.m_Curve.preWrapMode  = preset.preWrapMode;
                        this.m_CurveEditor.SelectNone();
                        this.SendEvent("CurveChanged", true);
                    }
                    if (Event.current.type == EventType.Repaint)
                    {
                        currentLib.Draw(position, i);
                    }
                    if (position.xMax > (base.position.width - 90f))
                    {
                        break;
                    }
                }
            }
            Rect rect2 = new Rect(25f, y + 5f, 20f, 20f);

            this.PresetDropDown(rect2);
            if ((Event.current.type == EventType.Used) && flag)
            {
                this.DoUpdateCurve(false);
                this.SendEvent("CurveChangeCompleted", true);
            }
            else if ((Event.current.type != EventType.Layout) && (Event.current.type != EventType.Repaint))
            {
                this.DoUpdateCurve(true);
            }
        }
Esempio n. 3
0
        private void OnGUI()
        {
            bool flag = Event.current.type == EventType.MouseUp;

            if (this.delegateView == null)
            {
                this.m_Curve = null;
            }
            if (CurveEditorWindow.ms_Styles == null)
            {
                CurveEditorWindow.ms_Styles = new CurveEditorWindow.Styles();
            }
            this.m_CurveEditor.rect         = this.GetCurveEditorRect();
            this.m_CurveEditor.hRangeLocked = Event.current.shift;
            this.m_CurveEditor.vRangeLocked = EditorGUI.actionKey;
            GUI.changed = false;
            GUI.Label(this.m_CurveEditor.drawRect, GUIContent.none, CurveEditorWindow.ms_Styles.curveEditorBackground);
            this.m_CurveEditor.OnGUI();
            GUI.Box(new Rect(0f, base.position.height - 46f, base.position.width, 46f), "", CurveEditorWindow.ms_Styles.curveSwatchArea);
            Color color = this.m_Color;

            color.a *= 0.6f;
            float num = base.position.height - 46f + 10.5f;

            this.InitCurvePresets();
            CurvePresetLibrary currentLib = this.m_CurvePresets.GetPresetLibraryEditor().GetCurrentLib();

            if (currentLib != null)
            {
                for (int i = 0; i < currentLib.Count(); i++)
                {
                    Rect rect = new Rect(45f + 45f * (float)i, num, 40f, 25f);
                    this.m_GUIContent.tooltip = currentLib.GetName(i);
                    if (GUI.Button(rect, this.m_GUIContent, CurveEditorWindow.ms_Styles.curveSwatch))
                    {
                        AnimationCurve animationCurve = currentLib.GetPreset(i) as AnimationCurve;
                        this.m_Curve.keys         = animationCurve.keys;
                        this.m_Curve.postWrapMode = animationCurve.postWrapMode;
                        this.m_Curve.preWrapMode  = animationCurve.preWrapMode;
                        this.m_CurveEditor.SelectNone();
                        this.SendEvent("CurveChanged", true);
                    }
                    if (Event.current.type == EventType.Repaint)
                    {
                        currentLib.Draw(rect, i);
                    }
                    if (rect.xMax > base.position.width - 90f)
                    {
                        break;
                    }
                }
            }
            Rect rect2 = new Rect(25f, num + 5f, 20f, 20f);

            this.PresetDropDown(rect2);
            if (Event.current.type == EventType.Used && flag)
            {
                this.DoUpdateCurve(false);
                this.SendEvent("CurveChangeCompleted", true);
            }
            else if (Event.current.type != EventType.Layout && Event.current.type != EventType.Repaint)
            {
                this.DoUpdateCurve(true);
            }
        }
        private void OnGUI()
        {
            bool flag = Event.current.type == EventType.MouseUp;

            if ((UnityEngine.Object) this.delegateView == (UnityEngine.Object)null)
            {
                this.m_Curve = (AnimationCurve)null;
            }
            if (CurveEditorWindow.ms_Styles == null)
            {
                CurveEditorWindow.ms_Styles = new CurveEditorWindow.Styles();
            }
            this.m_CurveEditor.rect         = this.GetCurveEditorRect();
            this.m_CurveEditor.hRangeLocked = Event.current.shift;
            this.m_CurveEditor.vRangeLocked = EditorGUI.actionKey;
            GUI.changed = false;
            GUI.Label(this.m_CurveEditor.drawRect, GUIContent.none, CurveEditorWindow.ms_Styles.curveEditorBackground);
            this.m_CurveEditor.BeginViewGUI();
            this.m_CurveEditor.GridGUI();
            this.m_CurveEditor.CurveGUI();
            this.DoWrapperPopups();
            this.m_CurveEditor.EndViewGUI();
            GUI.Box(new Rect(0.0f, this.position.height - 46f, this.position.width, 46f), string.Empty, CurveEditorWindow.ms_Styles.curveSwatchArea);
            this.m_Color.a *= 0.6f;
            float y = (float)((double)this.position.height - 46.0 + 10.5);

            this.InitCurvePresets();
            CurvePresetLibrary currentLib = this.m_CurvePresets.GetPresetLibraryEditor().GetCurrentLib();

            if ((UnityEngine.Object)currentLib != (UnityEngine.Object)null)
            {
                for (int index = 0; index < currentLib.Count(); ++index)
                {
                    Rect rect = new Rect((float)(45.0 + 45.0 * (double)index), y, 40f, 25f);
                    this.m_GUIContent.tooltip = currentLib.GetName(index);
                    if (GUI.Button(rect, this.m_GUIContent, CurveEditorWindow.ms_Styles.curveSwatch))
                    {
                        AnimationCurve preset = currentLib.GetPreset(index) as AnimationCurve;
                        this.m_Curve.keys         = preset.keys;
                        this.m_Curve.postWrapMode = preset.postWrapMode;
                        this.m_Curve.preWrapMode  = preset.preWrapMode;
                        this.m_CurveEditor.SelectNone();
                        this.SendEvent("CurveChanged", true);
                    }
                    if (Event.current.type == EventType.Repaint)
                    {
                        currentLib.Draw(rect, index);
                    }
                    if ((double)rect.xMax > (double)this.position.width - 90.0)
                    {
                        break;
                    }
                }
            }
            this.PresetDropDown(new Rect(25f, y + 5f, 20f, 20f));
            if (Event.current.type == EventType.Used && flag)
            {
                this.DoUpdateCurve(false);
                this.SendEvent("CurveChangeCompleted", true);
            }
            else
            {
                if (Event.current.type == EventType.Layout || Event.current.type == EventType.Repaint)
                {
                    return;
                }
                this.DoUpdateCurve(true);
            }
        }