void OnGUI()
        {
            bool gotMouseUp = (Event.current.type == EventType.MouseUp);

            if (delegateView == null)
            {
                m_MinCurve = null;
                m_MaxCurve = null;
            }

            if (s_Styles == null)
                s_Styles = new CurveEditorWindow.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, s_Styles.curveEditorBackground);
            m_CurveEditor.OnGUI();

            DrawPresetSwatchArea();

            if (Event.current.type == EventType.Used && gotMouseUp)
            {
                DoUpdateCurve(false);
                SendEvent("CurveChangeCompleted", true);
            }
            else if (Event.current.type != EventType.Layout && Event.current.type != EventType.Repaint)
            {
                DoUpdateCurve(true);
            }
        }
Example #2
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 (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.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, 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);
            }
        }
 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);
   }
 }