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); }
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; } }
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); } }
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); }
void DrawNoteBackground(Rect rect, Color backgroundColor) { StickiesGUI.ColorRect(rect, backgroundColor, Color.clear); }
static bool ColorPickerButton(Rect headerRect) { return(StickiesGUI.TextureButton(GetPickColorBtnRect(headerRect), Assets.Textures.MoreOptionsTexture)); }
static bool DeleteButton(Rect headerRect) { return(StickiesGUI.TextureButton(GetDeleteBtnRect(headerRect), Assets.Textures.DeleteTexture)); }