コード例 #1
0
        /// <summary>
        /// Draws the GUI for the color property.
        /// </summary>
        /// <param name="position">Rectangle on the screen to use for the property GUI.</param>
        /// <param name="property">The SerializedProperty to make the custom GUI for.</param>
        /// <param name="label">The label of this property.</param>
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);
            position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
            var h   = property.FindPropertyRelative("h");
            var s   = property.FindPropertyRelative("s");
            var y   = property.FindPropertyRelative("y");
            var a   = property.FindPropertyRelative("a");
            var hcy = new ColorHSY(h.floatValue, s.floatValue, y.floatValue, a.floatValue);

            hcy          = EditorGUI.ColorField(position, hcy);
            h.floatValue = hcy.h;
            s.floatValue = hcy.s;
            y.floatValue = hcy.y;
            a.floatValue = hcy.a;
            EditorGUI.EndProperty();
        }
コード例 #2
0
ファイル: ColorCMY.cs プロジェクト: againey/MakeIt.Colorful
 /// <summary>
 /// Initializes a color by converting the given HSY color to the CMY color space.
 /// </summary>
 /// <param name="hsy">The HSY color to convert to CMY.</param>
 public ColorCMY(ColorHSY hsy)
 {
     this = FromHSY(hsy.h, hsy.s, hsy.y, hsy.a);
 }