}         //LoadCustomColors

    public void SHow()
    {
        //ColorPicker.Show(new RGBColor(Color.red));
        Material mat = Mat.GetComponent <Renderer>().sharedMaterial; //share才能保留住

        ColorPicker.Show(mat);
    }
Beispiel #2
0
    }     //Start

    void OnGUI()
    {
        if (Skin != null)
        {
            GUI.skin = Skin;
        }

        GUI.Label(new Rect(_boxRect.width + 10, 2, 300, 20), "Click on a Color Box To The Left To Open Color Picker");
        GUI.Box(_boxRect, "Color Chooser");
        if (ColorPicker == null)
        {
            GUI.Label(new Rect(10, 40, _boxRect.width - 80, 20), "Error Finding RTColorPicker");
        }        //if
        else
        {
            GUI.BeginGroup(_boxRect);

            //Left Column
            GUI.BeginGroup(new Rect(10, 20, _boxRect.width / 2 - 5, 140));
            //Ball01
            GUI.Label(new Rect(0, 0, _boxRect.width - 20, 18), "Face");
            if (ColorPicker.ColorSampleBox(new Rect(0, 20, 30, 20), Ball01.transform.renderer.material.color, true))
            {
                //Pass in the object material. The materials main color
                //will automatically be the colorpicker target.
                ColorPicker.Show(Ball01.transform.renderer.material);
            }            //if



            //SpotLight1

            /*GUI.Label(new Rect(0, 45, _boxRect.width/2-10, 20), "SpotLight 1");
             * if(ColorPicker.ColorSampleBox(new Rect(0, 65, 30, 20), SpotLight1.color, true)){
             *      //Pass in the Light Object. The light color will be the
             *      //colorpicker target. The Alpha value of the color will
             *      //adjust the light intensity.
             *      ColorPicker.Show(SpotLight1);
             * }//if*/

            //Camera Color

            /*GUI.Label(new Rect(0, 90, _boxRect.width/2-10, 18), "Camera");
             * if(ColorPicker.ColorSampleBox(new Rect(0, 110, 30, 20), CameraObject.backgroundColor, true)){
             *      //Pass in the Camera Object. The camera background color
             *      //will be the colorpicker target.
             *      ColorPicker.Show(CameraObject);
             * }//if*/

            GUI.EndGroup();

            //Right Column
            GUI.BeginGroup(new Rect(_boxRect.width / 2, 20, _boxRect.width / 2 - 5, 140));
            //Ball02
            GUI.Label(new Rect(0, 0, _boxRect.width - 20, 18), "Ball 2");
            if (ColorPicker.ColorSampleBox(new Rect(0, 20, 30, 20), Ball02.transform.renderer.material.color, true))
            {
                //Pass in the object material. The materials main color
                //will automatically be the colorpicker target.
                ColorPicker.Show(Ball02.transform.renderer.material);
            }            //if

            //SpotLight2

            /*GUI.Label(new Rect(0, 45, _boxRect.width/2-10, 20), "SpotLight 1");
             * if(ColorPicker.ColorSampleBox(new Rect(0, 65, 30, 20), SpotLight2.color, true)){
             *      //Pass in the Light Object. The light color will be the
             *      //colorpicker target. The Alpha value of the color will
             *      //adjust the light intensity.
             *      ColorPicker.Show(SpotLight2);
             * }//if*/

            //Ambient Light
            //GUI.Label(new Rect(0, 90, _boxRect.width/2-10, 20), "Ambient Light");
            if (ColorPicker.ColorSampleBox(new Rect(0, 110, 30, 20), RenderSettings.ambientLight, true))
            {
                //Here we pass in the color, target string, and a callback
                //function (defined below)
                //The callback function will be called everytime the color changes on the colorpicker
                ColorPicker.Show(RenderSettings.ambientLight, "ambient_light"); //, OnColorChange);
            }                                                                   //if

            GUI.EndGroup();

            //Particle Colors
            //Iterator over the Particle Animator colorAnimations array
            GUI.BeginGroup(new Rect(10, 160, _boxRect.width - 20, 45));
            int ButtonXOffset = 0;
            int pcIdx         = 0;

            /*GUI.Label(new Rect(0, 0, _boxRect.width-20, 20), "Particle Colors");
             * foreach(Color pc in ParticleSystem.colorAnimation){
             *      if(ColorPicker.ColorSampleBox(new Rect(ButtonXOffset, 20, 30, 20), pc, true)){
             *              ColorPicker.Show(pc, "pColor_" + pcIdx);//, OnColorChange);
             *      }//if
             *
             *      ButtonXOffset += 35;
             *      pcIdx++;
             * }//for*/
            GUI.EndGroup();

            //GUI.BeginGroup(new Rect(10, 210, _boxRect.width-20, 140));
            //GUI.Label(new Rect(0, 0, _boxRect.width, 20), "RTColorPicker Options");
            //ColorPicker.AllowWindowDrag = GUI.Toggle(new Rect(0, 20, _boxRect.width/2-10, 20), ColorPicker.AllowWindowDrag, "Can Drag");
            //ColorPicker.ShowColorSelection = GUI.Toggle(new Rect(_boxRect.width/2, 20, _boxRect.width/2-10, 20), ColorPicker.ShowColorSelection, "Color Select");

            //ColorPicker.ShowHSVGroup = GUI.Toggle(new Rect(0, 40, _boxRect.width/2-10, 20), ColorPicker.ShowHSVGroup, "HSV Group");
            //ColorPicker.ShowRGBGroup = GUI.Toggle(new Rect(_boxRect.width/2, 40, _boxRect.width/2-10, 20), ColorPicker.ShowRGBGroup, "RGB Group");

            //ColorPicker.ShowAlphaSlider = GUI.Toggle(new Rect(0, 60, _boxRect.width/2-10, 20), ColorPicker.ShowAlphaSlider, "Alpha Slider");
            //ColorPicker.AllowEyeDropper = GUI.Toggle(new Rect(_boxRect.width/2, 60, _boxRect.width/2-10, 20), ColorPicker.AllowEyeDropper, "Eye Dropper");

            //ColorPicker.ShowHexField = GUI.Toggle(new Rect(0, 80, _boxRect.width/2-10, 20), ColorPicker.ShowHexField, "Hex Field");
            //ColorPicker.AllowWheelBoxToggle = GUI.Toggle(new Rect(_boxRect.width/2, 80, _boxRect.width/2-10, 20), ColorPicker.AllowWheelBoxToggle, "Select Btns");

            //ColorPicker.AllowOrientationChange = GUI.Toggle(new Rect(0, 100, _boxRect.width/2-10, 20), ColorPicker.AllowOrientationChange, "Orientation Btn");
            //ColorPicker.AllowColorPanel = GUI.Toggle(new Rect(_boxRect.width/2, 100, _boxRect.width/2-10, 20), ColorPicker.AllowColorPanel, "Color Panel");

            //ColorPicker.AllowCustomColors = GUI.Toggle(new Rect(0, 120, _boxRect.width/2-10, 20), ColorPicker.AllowCustomColors, "Custom Colors");
            //ColorPicker.ShowTooltips = GUI.Toggle(new Rect(_boxRect.width/2, 120, _boxRect.width/2-10, 20), ColorPicker.ShowTooltips, "Tooltips");
            GUI.EndGroup();

            //GUI.EndGroup();
        } //else
    }     //OnGUI
 public void PickColor(Material material)
 {
     ColorPicker.Show(material);
 }