public ColorPicker() { base.hideFlags = HideFlags.DontSave; this.m_ShowSliders = (EditorPrefs.GetInt("CPSliderShow", 1) != 0); this.m_SliderMode = (ColorPicker.SliderMode)EditorPrefs.GetInt("CPSliderMode", 0); this.m_ShowColors = (EditorPrefs.GetInt("CPColorShow", 1) != 0); this.m_ColorBoxMode = (ColorPicker.ColorBoxMode)EditorPrefs.GetInt("CPColorMode", 0); this.m_IsOSColorPicker = EditorPrefs.GetBool("UseOSColorPicker"); this.m_ShowPresets = (EditorPrefs.GetInt("CPPresetsShow", 1) != 0); EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.update, new EditorApplication.CallbackFunction(this.PollOSColorPicker)); EditorGUIUtility.editingTextField = true; }
private void DoColorSliders() { GUILayout.BeginHorizontal(new GUILayoutOption[0]); this.m_ShowSliders = GUILayout.Toggle(this.m_ShowSliders, ColorPicker.styles.sliderToggle, EditorStyles.foldout, new GUILayoutOption[0]); GUI.enabled = this.m_ShowSliders; if (GUILayout.Button(ColorPicker.styles.sliderCycle, GUIStyle.none, new GUILayoutOption[] { GUILayout.ExpandWidth(false) })) { this.m_SliderMode = (this.m_SliderMode + 1) % (ColorPicker.SliderMode) 2; GUI.changed = true; } GUI.enabled = true; GUILayout.EndHorizontal(); if (this.m_ShowSliders) { ColorPicker.SliderMode sliderMode = this.m_SliderMode; if (sliderMode != ColorPicker.SliderMode.RGB) { if (sliderMode == ColorPicker.SliderMode.HSV) { this.HSVSliders(); } } else { this.RGBSliders(); } if (this.m_ShowAlpha) { this.m_AlphaTexture = ColorPicker.Update1DSlider(this.m_AlphaTexture, 8, 0f, 0f, ref this.m_OldAlpha, ref this.m_OldAlpha, 3, false); this.m_A = this.TexturedSlider(this.m_AlphaTexture, "A", Mathf.Round(this.m_A * 255f), 0f, 255f) / 255f; } } }
private void DoColorSliders() { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(ColorPicker.styles.sliderCycle, GUIStyle.none, new GUILayoutOption[1]{ GUILayout.ExpandWidth(false) })) this.m_SliderMode = (ColorPicker.SliderMode) ((int) (this.m_SliderMode + 1) % 2); GUILayout.EndHorizontal(); GUILayout.Space(7f); switch (this.m_SliderMode) { case ColorPicker.SliderMode.RGB: this.RGBSliders(); break; case ColorPicker.SliderMode.HSV: this.HSVSliders(); break; } if (!this.m_ShowAlpha) return; this.m_AlphaTexture = ColorPicker.Update1DSlider(this.m_AlphaTexture, 32, 0.0f, 0.0f, ref this.m_OldAlpha, ref this.m_OldAlpha, 3, false, 1f, -1f, false, this.m_HDRValues.m_TonemappingType); this.m_A = this.TexturedSlider(this.m_AlphaTexture, "A", this.m_A, 0.0f, 1f, !this.m_HDR ? (float) byte.MaxValue : 1f, !this.m_HDR ? EditorGUI.kIntFieldFormatString : EditorGUI.kFloatFieldFormatString, (System.Action<float>) null); }
private void OnEnable() { this.m_HDRValues.m_ExposureAdjustment = EditorPrefs.GetFloat("CPickerExposure", 1f); this.m_UseTonemappingPreview = EditorPrefs.GetInt("CPTonePreview", 0) != 0; this.m_SliderMode = (ColorPicker.SliderMode) EditorPrefs.GetInt("CPSliderMode", 0); this.m_ColorBoxMode = (ColorPicker.ColorBoxMode) EditorPrefs.GetInt("CPColorMode", 0); this.m_ShowPresets = EditorPrefs.GetInt("CPPresetsShow", 1) != 0; }
private void DoColorSliders() { GUILayout.BeginHorizontal(new GUILayoutOption[0]); this.m_ShowSliders = GUILayout.Toggle(this.m_ShowSliders, ColorPicker.styles.sliderToggle, EditorStyles.foldout, new GUILayoutOption[0]); GUI.enabled = this.m_ShowSliders; if (GUILayout.Button(ColorPicker.styles.sliderCycle, GUIStyle.none, new GUILayoutOption[] { GUILayout.ExpandWidth(false) })) { this.m_SliderMode = (this.m_SliderMode + 1) % (ColorPicker.SliderMode)2; GUI.changed = true; } GUI.enabled = true; GUILayout.EndHorizontal(); if (this.m_ShowSliders) { ColorPicker.SliderMode sliderMode = this.m_SliderMode; if (sliderMode != ColorPicker.SliderMode.RGB) { if (sliderMode == ColorPicker.SliderMode.HSV) { this.HSVSliders(); } } else { this.RGBSliders(); } if (this.m_ShowAlpha) { this.m_AlphaTexture = ColorPicker.Update1DSlider(this.m_AlphaTexture, 8, 0f, 0f, ref this.m_OldAlpha, ref this.m_OldAlpha, 3, false); this.m_A = this.TexturedSlider(this.m_AlphaTexture, "A", Mathf.Round(this.m_A * 255f), 0f, 255f) / 255f; } } }