Ejemplo n.º 1
0
    private void DrawWindow(int windowID)
    {
        // Layout three sliders as a simple color picker
        GUILayout.BeginHorizontal();
        GUILayout.Label("Hue", GUILayout.MaxWidth(70));
        color.h = GUILayout.HorizontalSlider(color.h, 0, 1);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Saturation", GUILayout.MaxWidth(70));
        color.s = GUILayout.HorizontalSlider(color.s, 0, 1);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Lightness", GUILayout.MaxWidth(70));
        color.l = GUILayout.HorizontalSlider(color.l, 0, 1);
        GUILayout.EndHorizontal();

        // Draw a nice big box showing off the current color
        DrawColorPreview(color);

        // Finally, add some buttons to test various features
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Random Bright Color"))
        {
            color = ColorHelper.RandomBrightColor();
        }
        if (GUILayout.Button("Random Pastel Color"))
        {
            color = ColorHelper.RandomPastelColor();
        }
        if (GUILayout.Button("Random Dark Color"))
        {
            color = ColorHelper.RandomDarkColor();
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Invert Hue"))
        {
            color.InvertHue();
        }
        if (GUILayout.Button("Invert Saturation"))
        {
            color.InvertSaturation();
        }
        if (GUILayout.Button("Invert Lightness"))
        {
            color.InvertLightness();
        }
        if (GUILayout.Button("Invert"))
        {
            color.Invert();
        }
        GUILayout.EndHorizontal();
    }