private void OnGUI()
{
this.InitIfNeeded();
if (this.m_resetKeyboardControl)
{
GUIUtility.keyboardControl = 0;
this.m_resetKeyboardControl = false;
}
if (Event.current.type == EventType.ExecuteCommand)
{
string commandName = Event.current.commandName;
if (commandName != null)
{
int num2;
if (<>f__switch$map15 == null)
{
Dictionary<string, int> dictionary = new Dictionary<string, int>(3);
dictionary.Add("EyeDropperUpdate", 0);
dictionary.Add("EyeDropperClicked", 1);
dictionary.Add("EyeDropperCancelled", 2);
<>f__switch$map15 = dictionary;
}
if (<>f__switch$map15.TryGetValue(commandName, out num2))
{
switch (num2)
{
case 0:
base.Repaint();
break;
case 1:
{
Color lastPickedColor = EyeDropper.GetLastPickedColor();
this.m_R = lastPickedColor.r;
this.m_G = lastPickedColor.g;
this.m_B = lastPickedColor.b;
this.RGBToHSV();
this.m_ColorBoxMode = this.m_OldColorBoxMode;
this.m_Color = new Color(this.m_R, this.m_G, this.m_B, this.m_A);
this.SendEvent(true);
break;
}
case 2:
base.Repaint();
this.m_ColorBoxMode = this.m_OldColorBoxMode;
break;
}
}
}
}
Rect rect = EditorGUILayout.BeginVertical(styles.background, new GUILayoutOption[0]);
float width = EditorGUILayout.GetControlRect(false, 1f, EditorStyles.numberField, new GUILayoutOption[0]).width;
EditorGUIUtility.labelWidth = width - this.fieldWidth;
EditorGUIUtility.fieldWidth = this.fieldWidth;
EditorGUI.BeginChangeCheck();
GUILayout.Space(10f);
this.DoColorSwatchAndEyedropper();
GUILayout.Space(10f);
if (this.m_HDR)
{
this.TonemappingControls();
GUILayout.Space(10f);
}
this.DoColorSpaceGUI();
GUILayout.Space(10f);
if (this.m_HDR)
{
GUILayout.Space(5f);
this.BrightnessField();
GUILayout.Space(10f);
}
this.DoColorSliders();
GUILayout.Space(5f);
this.DoHexField(width);
GUILayout.Space(10f);
if (EditorGUI.EndChangeCheck())
{
this.colorChanged = true;
}
this.DoPresetsGUI();
this.HandleCopyPasteEvents();
if (this.colorChanged)
{
this.colorChanged = false;
this.m_Color = new Color(this.m_R, this.m_G, this.m_B, this.m_A);
this.SendEvent(true);
}
EditorGUILayout.EndVertical();
if ((rect.height > 0f) && (Event.current.type == EventType.Repaint))
{
this.SetHeight(rect.height);
}
if (Event.current.type != EventType.KeyDown)
{
goto Label_0321;
}
KeyCode keyCode = Event.current.keyCode;
if (keyCode == KeyCode.Return)
{
goto Label_0316;
}
if (keyCode != KeyCode.Escape)
{
if (keyCode == KeyCode.KeypadEnter)
{
goto Label_0316;
}
}
else
{
Undo.RevertAllDownToGroup(this.m_ModalUndoGroup);
this.m_Color = this.m_OriginalColor;
this.SendEvent(false);
base.Close();
GUIUtility.ExitGUI();
}
goto Label_0321;
Label_0316:
base.Close();
Label_0321:
if (((Event.current.type == EventType.MouseDown) && (Event.current.button != 1)) || (Event.current.type == EventType.ContextClick))
{
GUIUtility.keyboardControl = 0;
base.Repaint();
}
}