UnityEditor.ColorPicker.TexturedSlider C# (CSharp) Method

TexturedSlider() private method

private TexturedSlider ( Texture2D background, string text, float val, float min, float max, float displayScale, string formatString, Action onFloatFieldChanged ) : float
background UnityEngine.Texture2D
text string
val float
min float
max float
displayScale float
formatString string
onFloatFieldChanged Action
return float
        private float TexturedSlider(Texture2D background, string text, float val, float min, float max, float displayScale, string formatString, Action<float> onFloatFieldChanged)
        {
            Rect rect = GUILayoutUtility.GetRect(16f, 16f, GUI.skin.label);
            GUI.Label(new Rect(rect.x, rect.y, 20f, 16f), text);
            rect.x += 14f;
            rect.width -= 20f + this.fieldWidth;
            if (Event.current.type == EventType.Repaint)
            {
                Rect screenRect = new Rect(rect.x + 1f, rect.y + 2f, rect.width - 2f, rect.height - 4f);
                Graphics.DrawTexture(screenRect, background, new Rect(0.5f / ((float) background.width), 0.5f / ((float) background.height), 1f - (1f / ((float) background.width)), 1f - (1f / ((float) background.height))), 0, 0, 0, 0, Color.grey);
            }
            int id = GUIUtility.GetControlID(0xd42b5, EditorGUIUtility.native, base.position);
            EditorGUI.BeginChangeCheck();
            val = GUI.HorizontalSlider(new Rect(rect.x, rect.y + 1f, rect.width, rect.height - 2f), val, min, max, styles.pickerBox, styles.thumbHoriz);
            if (EditorGUI.EndChangeCheck())
            {
                if (EditorGUI.s_RecycledEditor.IsEditingControl(id))
                {
                    EditorGUI.s_RecycledEditor.EndEditing();
                }
                val = (float) Math.Round((double) val, 3);
                GUIUtility.keyboardControl = 0;
            }
            Rect position = new Rect(rect.xMax + 6f, rect.y, this.fieldWidth, 16f);
            EditorGUI.BeginChangeCheck();
            val = EditorGUI.DoFloatField(EditorGUI.s_RecycledEditor, position, new Rect(0f, 0f, 0f, 0f), id, val * displayScale, formatString, EditorStyles.numberField, false);
            if (EditorGUI.EndChangeCheck() && (onFloatFieldChanged != null))
            {
                onFloatFieldChanged(val);
            }
            val = Mathf.Clamp(val / displayScale, min, max);
            GUILayout.Space(3f);
            return val;
        }