static NoteColor ColorChooser(Rect rect)
        {
            const float colorBtnSize = 32f;
            const float halfBtnSize  = colorBtnSize / 2f;
            const float spacing      = 7f;

            int N = Colors.Values.Length;
            /* width = buttons + spacings + half-button */
            float colorsRowWidth = N * colorBtnSize + (N - 1) * spacing;

            var x      = (rect.width - colorsRowWidth) / 2f + halfBtnSize;
            var colors = Colors.Values;

            for (int i = 0; i < colors.Length; i++, x += (colorBtnSize + spacing))
            {
                var color = colors[i];
                if (color == NoteColor.None)
                {
                    continue;
                }

                var         noteColors = Colors.ColorById(color);
                const float yOffset    = colorBtnSize;
                if (StickiesGUI.ColorButton(new Rect(x, rect.y + yOffset, colorBtnSize, colorBtnSize), noteColors.main,
                                            noteColors.chooserOutline))
                {
                    return(color);
                }
            }

            return(NoteColor.None);
        }
Beispiel #2
0
        static void AddRevealerIcon(string guid, Rect rect, ViewType viewType)
        {
            // Just return if couldn't load saved
            if (NoteStorage.Instance == null)
            {
                return;
            }

            var iconRect = StickiesGUI.GetProjectViewIconRect(rect, viewType);

            var hasNoteAttached = NoteStorage.Instance.HasItem(guid);

            if (hasNoteAttached)
            {
                // OnGUI note
                DrawNoteButton(iconRect, guid);
                return;
            }

            var isInFocus = rect.HasMouseInside();

            if (isInFocus)
            {
                // Add note
                DrawAddNoteButton(iconRect, guid);
                return;
            }
        }
Beispiel #3
0
        public void OnGUI(Rect rect, Colors.NoteColorCollection colors)
        {
            var headerRect = GetHeaderRect(rect);

            StickiesGUI.ColorRect(headerRect, colors.header, Color.clear);

            DrawDeleteButton(headerRect);
            DrawColorPickerButton(headerRect);
        }
        public void OnGUI(Rect rect, Colors.NoteColorCollection colors)
        {
            var colorPickerRect = new Rect(rect.x, rect.y, rect.width, ColorPickerHeaderHeight);

            StickiesGUI.ColorRect(colorPickerRect, colors.header, Color.clear);

            var newColor = ColorChooser(colorPickerRect);

            if (newColor != NoteColor.None)
            {
                _onColorSelected(newColor);
            }
        }
Beispiel #5
0
        static void DrawNoteButton(Rect iconRect, string guid)
        {
            var noteData = NoteStorage.Instance.ItemByGuid(guid);
            var iconTex  = Assets.Textures.NoteByColor(noteData.color);

            GUI.DrawTexture(iconRect, iconTex);
            if (!string.IsNullOrEmpty(noteData.text))
            {
                GUI.DrawTexture(iconRect, Assets.Textures.HasText);
            }
            if (StickiesGUI.EmptyButton(iconRect))
            {
                ShowNote(iconRect, guid);
            }
        }
 static void DrawRectNote(Rect rect, Color main, Color header)
 {
     StickiesGUI.DrawSolidRectangleWithOutline(rect, main, header);
 }
Beispiel #7
0
 void DrawNoteBackground(Rect rect, Color backgroundColor)
 {
     StickiesGUI.ColorRect(rect, backgroundColor, Color.clear);
 }
Beispiel #8
0
 static bool ColorPickerButton(Rect headerRect)
 {
     return(StickiesGUI.TextureButton(GetPickColorBtnRect(headerRect), Assets.Textures.MoreOptionsTexture));
 }
Beispiel #9
0
 static bool DeleteButton(Rect headerRect)
 {
     return(StickiesGUI.TextureButton(GetDeleteBtnRect(headerRect), Assets.Textures.DeleteTexture));
 }