GetPickedColor() public static method

public static GetPickedColor ( ) : Color
return UnityEngine.Color
Beispiel #1
0
        private void OnGUI()
        {
            EventType type = Event.current.type;

            if (type != EventType.MouseMove)
            {
                if (type != EventType.MouseDown)
                {
                    if (type == EventType.KeyDown)
                    {
                        if (Event.current.keyCode == KeyCode.Escape)
                        {
                            base.window.Close();
                            this.SendEvent("EyeDropperCancelled", true);
                        }
                    }
                }
                else if (Event.current.button == 0)
                {
                    EyeDropper.s_PickCoordinates = GUIUtility.GUIToScreenPoint(Event.current.mousePosition);
                    base.window.Close();
                    EyeDropper.s_LastPickedColor = EyeDropper.GetPickedColor();
                    this.SendEvent("EyeDropperClicked", true);
                }
            }
            else
            {
                EyeDropper.s_PickCoordinates = GUIUtility.GUIToScreenPoint(Event.current.mousePosition);
                base.StealMouseCapture();
                this.SendEvent("EyeDropperUpdate", true);
            }
        }
Beispiel #2
0
        private void OnGUI()
        {
            switch (Event.current.type)
            {
            case EventType.MouseDown:
                if (Event.current.button == 0)
                {
                    EyeDropper.s_PickCoordinates = GUIUtility.GUIToScreenPoint(Event.current.mousePosition);
                    base.window.Close();
                    EyeDropper.s_LastPickedColor = EyeDropper.GetPickedColor();
                    this.SendEvent("EyeDropperClicked");
                }
                break;

            case EventType.MouseMove:
                EyeDropper.s_PickCoordinates = GUIUtility.GUIToScreenPoint(Event.current.mousePosition);
                base.StealMouseCapture();
                this.SendEvent("EyeDropperUpdate");
                break;

            case EventType.KeyDown:
                if (Event.current.keyCode == KeyCode.Escape)
                {
                    base.window.Close();
                    this.SendEvent("EyeDropperCancelled");
                }
                break;
            }
        }