├── .gitattributes ├── .gitignore ├── Editor.meta ├── Editor ├── ExtendedEditor.cs ├── ExtendedEditor.cs.meta ├── LazyNoteEditor.cs ├── LazyNoteEditor.cs.meta ├── NoteArrowEditor.cs ├── NoteArrowEditor.cs.meta ├── NoteEditor.cs ├── NoteEditor.cs.meta ├── NoteUtility.cs ├── NoteUtility.cs.meta ├── NotesSettings.cs ├── NotesSettings.cs.meta ├── NotesSettingsWindow.cs └── NotesSettingsWindow.cs.meta ├── Gizmos.meta ├── Gizmos ├── Runtime.meta └── Runtime │ ├── Note Author Icon.png │ ├── Note Author Icon.png.meta │ ├── Note Icon.png │ ├── Note Icon.png.meta │ ├── Note Type Icon.png │ └── Note Type Icon.png.meta ├── LICENSE ├── LICENSE.meta ├── Notes-Unity.asmdef ├── Notes-Unity.asmdef.meta ├── README-RU.md ├── README-RU.md.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── Consts.cs ├── Consts.cs.meta ├── LazyNote.cs ├── LazyNote.cs.meta ├── Note.cs ├── Note.cs.meta ├── NoteArrow.cs ├── NoteArrow.cs.meta ├── Utils.meta └── Utils │ ├── AuthorInfo.cs │ ├── AuthorInfo.cs.meta │ ├── NotePropertyInfo.cs │ ├── NotePropertyInfo.cs.meta │ ├── NoteTypeInfo.cs │ └── NoteTypeInfo.cs.meta ├── package.json └── package.json.meta /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Uu]ser[Ss]ettings/ 12 | 13 | # MemoryCaptures can get excessive in size. 14 | # They also could contain extremely sensitive data 15 | /[Mm]emoryCaptures/ 16 | 17 | # Recordings can get excessive in size 18 | /[Rr]ecordings/ 19 | 20 | # Uncomment this line if you wish to ignore the asset store tools plugin 21 | # /[Aa]ssets/AssetStoreTools* 22 | 23 | # Autogenerated Jetbrains Rider plugin 24 | /[Aa]ssets/Plugins/Editor/JetBrains* 25 | 26 | # Visual Studio cache directory 27 | .vs/ 28 | 29 | # Gradle cache directory 30 | .gradle/ 31 | 32 | # Autogenerated VS/MD/Consulo solution and project files 33 | ExportedObj/ 34 | .consulo/ 35 | *.csproj 36 | *.unityproj 37 | *.sln 38 | *.suo 39 | *.tmp 40 | *.user 41 | *.userprefs 42 | *.pidb 43 | *.booproj 44 | *.svd 45 | *.pdb 46 | *.mdb 47 | *.opendb 48 | *.VC.db 49 | 50 | # Unity3D generated meta files 51 | *.pidb.meta 52 | *.pdb.meta 53 | *.mdb.meta 54 | 55 | # Unity3D generated file on crash reports 56 | sysinfo.txt 57 | 58 | # Builds 59 | *.apk 60 | *.aab 61 | *.unitypackage 62 | *.app 63 | 64 | # Crashlytics generated file 65 | crashlytics-build.properties 66 | 67 | # Packed Addressables 68 | /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* 69 | 70 | # Temporary auto-generated Android Assets 71 | /[Aa]ssets/[Ss]treamingAssets/aa.meta 72 | /[Aa]ssets/[Ss]treamingAssets/aa/* 73 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d14a5fa0c5341674f8c5572f9443803d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/ExtendedEditor.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | namespace DCFApixels.Notes.Editors 3 | { 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Reflection; 7 | using Unity.Collections.LowLevel.Unsafe; 8 | using UnityEditor; 9 | using UnityEngine; 10 | using UnityObject = UnityEngine.Object; 11 | 12 | internal abstract class ExtendedEditor : Editor 13 | { 14 | private bool _isStaticInit = false; 15 | private bool _isInit = false; 16 | 17 | protected bool IsMultipleTargets { get { return targets.Length > 1; } } 18 | protected float OneLineHeight { get => EditorGUIUtility.singleLineHeight; } 19 | protected float Spacing { get => EditorGUIUtility.standardVerticalSpacing; } 20 | protected virtual bool IsStaticInit { get { return _isStaticInit; } } 21 | protected virtual bool IsInit { get { return _isInit; } } 22 | protected NotesSettings Settings { get { return NotesSettings.Instance; } } 23 | 24 | protected void StaticInit() 25 | { 26 | if (IsStaticInit) { return; } 27 | _isStaticInit = true; 28 | OnStaticInit(); 29 | } 30 | protected void Init() 31 | { 32 | if (IsInit) { return; } 33 | _isInit = true; 34 | OnInit(); 35 | } 36 | protected virtual void OnStaticInit() { } 37 | protected virtual void OnInit() { } 38 | 39 | public sealed override void OnInspectorGUI() 40 | { 41 | EditorGUI.BeginChangeCheck(); 42 | StaticInit(); 43 | Init(); 44 | DrawCustom(); 45 | if (EditorGUI.EndChangeCheck()) 46 | { 47 | serializedObject.ApplyModifiedProperties(); 48 | } 49 | } 50 | 51 | protected abstract void DrawCustom(); 52 | protected void DrawDefault() 53 | { 54 | base.OnInspectorGUI(); 55 | } 56 | 57 | protected SerializedProperty FindProperty(string name) 58 | { 59 | return serializedObject.FindProperty(name); 60 | } 61 | } 62 | internal abstract class ExtendedEditor : ExtendedEditor 63 | { 64 | public T Target 65 | { 66 | get 67 | { 68 | var obj = target; 69 | return UnsafeUtility.As(ref obj); 70 | } 71 | } 72 | public T[] Targets 73 | { 74 | get 75 | { 76 | var obj = targets; 77 | return UnsafeUtility.As(ref obj); 78 | } 79 | } 80 | } 81 | internal abstract class ExtendedPropertyDrawer : PropertyDrawer 82 | { 83 | private bool _isStaticInit = false; 84 | private bool _isInit = false; 85 | 86 | private IEnumerable _attributes = null; 87 | 88 | protected IEnumerable Attributes 89 | { 90 | get 91 | { 92 | if (_attributes == null) 93 | { 94 | _attributes = fieldInfo.GetCustomAttributes(); 95 | } 96 | return _attributes; 97 | } 98 | } 99 | protected float OneLineHeight { get => EditorGUIUtility.singleLineHeight; } 100 | protected float Spacing { get => EditorGUIUtility.standardVerticalSpacing; } 101 | protected virtual bool IsStaticInit { get { return _isStaticInit; } } 102 | protected virtual bool IsInit { get { return _isInit; } } 103 | protected NotesSettings Settings { get { return NotesSettings.Instance; } } 104 | 105 | 106 | protected void StaticInit() 107 | { 108 | if (IsStaticInit) { return; } 109 | _isStaticInit = true; 110 | OnStaticInit(); 111 | } 112 | protected void Init() 113 | { 114 | if (IsInit) { return; } 115 | _isInit = true; 116 | OnInit(); 117 | } 118 | protected virtual void OnStaticInit() { } 119 | protected virtual void OnInit() { } 120 | 121 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 122 | { 123 | EditorGUI.BeginChangeCheck(); 124 | StaticInit(); 125 | Init(); 126 | DrawCustom(position, property, label); 127 | if (EditorGUI.EndChangeCheck()) 128 | { 129 | property.serializedObject.ApplyModifiedProperties(); 130 | } 131 | } 132 | protected abstract void DrawCustom(Rect position, SerializedProperty property, GUIContent label); 133 | } 134 | internal abstract class ExtendedPropertyDrawer : ExtendedPropertyDrawer 135 | { 136 | protected TAttribute Attribute 137 | { 138 | get 139 | { 140 | var obj = attribute; 141 | return UnsafeUtility.As(ref obj); 142 | } 143 | } 144 | } 145 | } 146 | #endif -------------------------------------------------------------------------------- /Editor/ExtendedEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b96a3f52881b366409b697910bd396db 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/LazyNoteEditor.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace DCFApixels.Notes.Editors 6 | { 7 | using static NotesConsts; 8 | [CustomEditor(typeof(LazyNote))] 9 | internal class LazyNoteEditor : ExtendedEditor 10 | { 11 | private Rect _fullRect = new Rect(); 12 | private Texture2D _lineTex; 13 | 14 | private SerializedProperty _heightProp; 15 | private SerializedProperty _textProp; 16 | private SerializedProperty _drawIconProp; 17 | private SerializedProperty _colorProp; 18 | 19 | private static GUIStyle _textAreaStyle; 20 | 21 | #region Init 22 | protected override bool IsStaticInit => _textAreaStyle != null; 23 | protected override bool IsInit => _textProp != null; 24 | protected override void OnStaticInit() 25 | { 26 | _textAreaStyle = new GUIStyle(EditorStyles.wordWrappedLabel); 27 | 28 | _textAreaStyle.fontSize = 14; 29 | _textAreaStyle.normal.textColor = Color.black; 30 | _textAreaStyle.hover = _textAreaStyle.normal; 31 | _textAreaStyle.focused = _textAreaStyle.normal; 32 | _textAreaStyle.richText = true; 33 | } 34 | protected override void OnInit() 35 | { 36 | _lineTex = CreateTexture(2, 2, Color.black); 37 | 38 | _heightProp = FindProperty("_height"); 39 | _textProp = FindProperty("_text"); 40 | _drawIconProp = FindProperty("_drawIcon"); 41 | _colorProp = FindProperty("_color"); 42 | } 43 | private static Texture2D CreateTexture(int width, int height, Color32 color32) 44 | { 45 | var pixels = new Color32[width * height]; 46 | for (var i = 0; i < pixels.Length; ++i) 47 | pixels[i] = color32; 48 | 49 | var result = new Texture2D(width, height); 50 | result.SetPixels32(pixels); 51 | result.Apply(); 52 | return result; 53 | } 54 | #endregion 55 | 56 | #region Draw 57 | protected override void DrawCustom() 58 | { 59 | Color defaultColor = GUI.color; 60 | Color defaultBackgroundColor = GUI.backgroundColor; 61 | 62 | Color color = _colorProp.colorValue; 63 | 64 | Color elemcolor = NormalizeBackgroundColor(color); 65 | _fullRect = new Rect(0, 0, EditorGUIUtility.currentViewWidth, EditorGUIUtility.singleLineHeight * 2 + _heightProp.floatValue + 5); 66 | 67 | EditorGUI.DrawRect(_fullRect, color); 68 | 69 | GUI.backgroundColor = elemcolor; 70 | 71 | 72 | EditorGUILayout.BeginHorizontal(); 73 | 74 | _drawIconProp.boolValue = EditorGUILayout.Toggle(_drawIconProp.boolValue, GUILayout.MaxWidth(16)); 75 | GUILayout.Label(""); 76 | 77 | float originalValue = EditorGUIUtility.labelWidth; 78 | EditorGUIUtility.labelWidth = 14; 79 | GUI.color = new Color(0.2f, 0.2f, 0.2f); 80 | GUI.backgroundColor = Color.white; 81 | 82 | GUIStyle gUIStylex = new GUIStyle(EditorStyles.helpBox); 83 | _heightProp.floatValue = EditorGUILayout.FloatField("↕", _heightProp.floatValue, gUIStylex, GUILayout.MaxWidth(58)); 84 | _heightProp.floatValue = Mathf.Max(MIN_NOTE_HEIGHT, _heightProp.floatValue); 85 | GUI.color = defaultColor; 86 | EditorGUIUtility.labelWidth = originalValue; 87 | 88 | Color newColor = EditorGUILayout.ColorField(_colorProp.colorValue, GUILayout.MaxWidth(40)); 89 | newColor.a = 1f; 90 | _colorProp.colorValue = newColor; 91 | 92 | EditorGUILayout.EndHorizontal(); 93 | 94 | GUILayout.Box(_lineTex, GUILayout.Height(1), GUILayout.ExpandWidth(true)); 95 | 96 | _textProp.stringValue = EditorGUILayout.TextArea(_textProp.stringValue, _textAreaStyle, GUILayout.Height(_heightProp.floatValue)); 97 | GUI.backgroundColor = defaultBackgroundColor; 98 | } 99 | 100 | public override void DrawPreview(Rect previewArea) 101 | { 102 | _fullRect = previewArea; 103 | base.DrawPreview(previewArea); 104 | } 105 | private static Color NormalizeBackgroundColor(Color color) 106 | { 107 | Color.RGBToHSV(color, out float H, out float S, out float V); 108 | S -= S * 0.62f; 109 | return Color.HSVToRGB(H, S, V) * 3f; 110 | } 111 | #endregion 112 | } 113 | } 114 | #endif -------------------------------------------------------------------------------- /Editor/LazyNoteEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f9d3a4e73f1ea74ab9c58d32d57adb6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/NoteArrowEditor.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DCFApixels/Unity-Notes/20bba03e2d09c6a90ffc305d950348243eeb2690/Editor/NoteArrowEditor.cs -------------------------------------------------------------------------------- /Editor/NoteArrowEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ab82dac2e02d8a45bf3a359ee03893b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/NoteEditor.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace DCFApixels.Notes.Editors 6 | { 7 | using static NotesConsts; 8 | 9 | [CustomEditor(typeof(Note))] 10 | [CanEditMultipleObjects] 11 | internal class NoteEditor : ExtendedEditor 12 | { 13 | private const float HEADER_HEIGHT = 27; 14 | 15 | private Rect fullRect = new Rect(); 16 | private Texture2D _lineTex; 17 | 18 | private GUIStyle _settingsButtonStyle; 19 | 20 | private GenericMenu _authorsGenericMenu; 21 | private int _authorsGenericMenuCount; 22 | private GenericMenu _typesGenericMenu; 23 | private int _typesGenericMenuCount; 24 | 25 | private SerializedProperty _heightProp; 26 | private SerializedProperty _textProp; 27 | private SerializedProperty _drawIconProp; 28 | private SerializedProperty _authorProp; 29 | private SerializedProperty _typeProp; 30 | 31 | private static GUIStyle _textAreaStyle; 32 | 33 | #region Init 34 | protected override bool IsStaticInit => _textAreaStyle != null; 35 | protected override bool IsInit => _textProp != null; 36 | protected override void OnStaticInit() 37 | { 38 | _textAreaStyle = new GUIStyle(EditorStyles.wordWrappedLabel); 39 | 40 | _textAreaStyle.fontSize = 14; 41 | _textAreaStyle.normal.textColor = Color.black; 42 | _textAreaStyle.hover = _textAreaStyle.normal; 43 | _textAreaStyle.focused = _textAreaStyle.normal; 44 | _textAreaStyle.richText = true; 45 | } 46 | protected override void OnInit() 47 | { 48 | _lineTex = CreateTexture(2, 2, Color.black); 49 | 50 | _settingsButtonStyle = new GUIStyle(EditorStyles.miniButton); 51 | _settingsButtonStyle.padding = new RectOffset(0, 0, 0, 0); 52 | 53 | _heightProp = FindProperty("_height"); 54 | _textProp = FindProperty("_text"); 55 | _drawIconProp = FindProperty("_drawIcon"); 56 | _authorProp = FindProperty("_authorID"); 57 | _typeProp = FindProperty("_typeID"); 58 | } 59 | private static Texture2D CreateTexture(int width, int height, Color32 color32) 60 | { 61 | var pixels = new Color32[width * height]; 62 | for (var i = 0; i < pixels.Length; ++i) 63 | { 64 | pixels[i] = color32; 65 | } 66 | 67 | var result = new Texture2D(width, height); 68 | result.SetPixels32(pixels); 69 | result.Apply(); 70 | return result; 71 | } 72 | public GenericMenu GetAuthorsGenericMenu() 73 | { 74 | if (_authorsGenericMenu == null || _authorsGenericMenuCount != Settings.AuthorsCount) 75 | { 76 | _authorsGenericMenuCount = Settings.AuthorsCount; 77 | _authorsGenericMenu = new GenericMenu(); 78 | foreach (var author in Settings.Authors) 79 | { 80 | _authorsGenericMenu.AddItem(new GUIContent(author.name), false, OnAuthorSelected, author); 81 | } 82 | } 83 | return _authorsGenericMenu; 84 | } 85 | private void OnAuthorSelected(object obj) 86 | { 87 | AuthorInfo author = (AuthorInfo)obj; 88 | serializedObject.FindProperty("_authorID").intValue = author._id; 89 | serializedObject.ApplyModifiedProperties(); 90 | foreach (Note note in Targets) 91 | { 92 | note.UpdateRefs(); 93 | } 94 | } 95 | public GenericMenu GetTypesGenericMenu() 96 | { 97 | if (_typesGenericMenu == null || _typesGenericMenuCount != Settings.TypesCount) 98 | { 99 | _typesGenericMenuCount = Settings.TypesCount; 100 | _typesGenericMenu = new GenericMenu(); 101 | foreach (var type in Settings.Types) 102 | { 103 | _typesGenericMenu.AddItem(new GUIContent(type.name), false, OnTypeSelected, type); 104 | } 105 | } 106 | return _typesGenericMenu; 107 | } 108 | private void OnTypeSelected(object obj) 109 | { 110 | NoteTypeInfo type = (NoteTypeInfo)obj; 111 | serializedObject.FindProperty("_typeID").intValue = type._id; 112 | serializedObject.ApplyModifiedProperties(); 113 | foreach (Note note in Targets) 114 | { 115 | note.UpdateRefs(); 116 | } 117 | } 118 | #endregion 119 | 120 | #region Draw 121 | protected override void DrawCustom() 122 | { 123 | Color defaultColor = GUI.color; 124 | Color defaultBackgroundColor = GUI.backgroundColor; 125 | 126 | AuthorInfo author = Settings.GetAuthorInfoOrDummy(_authorProp.hasMultipleDifferentValues ? 0 : _authorProp.intValue); 127 | NoteTypeInfo noteType = Settings.GetNoteTypeInfoOrDummy(_typeProp.hasMultipleDifferentValues ? 0 : _typeProp.intValue); 128 | Color headerColor = author.color; 129 | Color bodyColor = noteType.color; 130 | 131 | 132 | Color headerBackColor = NormalizeBackgroundColor(headerColor); 133 | 134 | fullRect = new Rect(0, 0, EditorGUIUtility.currentViewWidth, EditorGUIUtility.singleLineHeight * 2 + _heightProp.floatValue + 5); 135 | Rect headerRect = fullRect; 136 | headerRect.height = HEADER_HEIGHT; 137 | Rect bodyRect = fullRect; 138 | bodyRect.yMin += HEADER_HEIGHT; 139 | 140 | EditorGUI.DrawRect(headerRect, headerColor); 141 | EditorGUI.DrawRect(bodyRect, bodyColor); 142 | 143 | GUI.backgroundColor = headerBackColor; 144 | 145 | EditorGUILayout.BeginHorizontal(); 146 | _drawIconProp.boolValue = EditorGUILayout.Toggle(_drawIconProp.boolValue, GUILayout.MaxWidth(16)); 147 | 148 | GUI.backgroundColor = Color.white; 149 | 150 | GUI.color = Color.black; 151 | GUILayout.Label("Author:", GUILayout.Width(44)); 152 | GUI.color = headerColor; 153 | if (GUILayout.Button(author.IsDummy() ? "-" : author.name, EditorStyles.popup)) 154 | { 155 | GetAuthorsGenericMenu().ShowAsContext(); 156 | } 157 | GUI.color = Color.black; 158 | GUILayout.Label("Type:", GUILayout.Width(36)); 159 | GUI.color = headerColor; 160 | if (GUILayout.Button(noteType.IsDummy() ? "-" : noteType.name, EditorStyles.popup)) 161 | { 162 | GetTypesGenericMenu().ShowAsContext(); 163 | } 164 | if (GUILayout.Button(EditorGUIUtility.IconContent("_Popup"), _settingsButtonStyle, GUILayout.Width(18f))) 165 | { 166 | NotesSettingsWindow.Open(); 167 | } 168 | GUILayout.Label(""); 169 | 170 | float originalValue = EditorGUIUtility.labelWidth; 171 | EditorGUIUtility.labelWidth = 14; 172 | GUI.color = new Color(0.2f, 0.2f, 0.2f); 173 | 174 | GUIStyle gUIStylex = new GUIStyle(EditorStyles.helpBox); 175 | EditorGUI.BeginChangeCheck(); 176 | float newHeight = EditorGUILayout.FloatField("↕", _heightProp.hasMultipleDifferentValues ? DEFAULT_NOTE_HEIGHT : _heightProp.floatValue, gUIStylex, GUILayout.MaxWidth(58)); 177 | if (EditorGUI.EndChangeCheck()) 178 | { 179 | _heightProp.floatValue = Mathf.Max(newHeight, MIN_NOTE_HEIGHT); 180 | } 181 | EditorGUIUtility.labelWidth = originalValue; 182 | 183 | 184 | GUI.color = defaultColor; 185 | 186 | //Color newColor = EditorGUILayout.ColorField(colorProp.colorValue, GUILayout.MaxWidth(40)); 187 | //newColor.a = 1f; 188 | //colorProp.colorValue = newColor; 189 | 190 | EditorGUILayout.EndHorizontal(); 191 | 192 | GUILayout.Box(_lineTex, GUILayout.Height(1), GUILayout.ExpandWidth(true)); 193 | 194 | EditorGUI.BeginChangeCheck(); 195 | string newValue = EditorGUILayout.TextArea(_textProp.hasMultipleDifferentValues ? "-" : _textProp.stringValue, _textAreaStyle, GUILayout.Height(_heightProp.floatValue)); 196 | if (EditorGUI.EndChangeCheck()) 197 | { 198 | _textProp.stringValue = newValue; 199 | } 200 | 201 | GUI.backgroundColor = defaultBackgroundColor; 202 | } 203 | 204 | public override void DrawPreview(Rect previewArea) 205 | { 206 | fullRect = previewArea; 207 | base.DrawPreview(previewArea); 208 | } 209 | private static Color NormalizeBackgroundColor(Color color) 210 | { 211 | Color.RGBToHSV(color, out float H, out float S, out float V); 212 | S -= S * 0.62f; 213 | return Color.HSVToRGB(H, S, V) * 3f; 214 | } 215 | #endregion 216 | } 217 | } 218 | #endif -------------------------------------------------------------------------------- /Editor/NoteEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c618c381a76fd144a57a6bcd0102e82 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/NoteUtility.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System.Reflection; 3 | using UnityEditor; 4 | using UnityEditorInternal; 5 | using UnityEngine; 6 | 7 | namespace DCFApixels.Notes.Editors 8 | { 9 | using static NotesConsts; 10 | internal static class NoteUtility 11 | { 12 | private static string _gizmosPath; 13 | private static string _noteIconPath; 14 | private static string _authorNoteIconPath; 15 | private static string _typeNoteIconPath; 16 | private static GUIStyle _textStyle; 17 | //private static GUIStyle _textStyle; 18 | 19 | private static bool _isInit = false; 20 | 21 | 22 | private static void Init() 23 | { 24 | if (_isInit && _textStyle != null) { return; } 25 | _noteIconPath = GetGizmosPath() + "/Runtime/Note Icon.png"; 26 | _authorNoteIconPath = GetGizmosPath() + "/Runtime/Note Author Icon.png"; 27 | _typeNoteIconPath = GetGizmosPath() + "/Runtime/Note Type Icon.png"; 28 | _textStyle = new GUIStyle(EditorStyles.boldLabel); 29 | //_textStyle = new GUIStyle(EditorStyles.helpBox); 30 | _textStyle.richText = true; 31 | _textStyle.alignment = TextAnchor.MiddleCenter; 32 | _textStyle.wordWrap = true; 33 | _isInit = true; 34 | } 35 | 36 | private static GUIContent _label; 37 | public static GUIContent GetLabel(string text, string tooltip) 38 | { 39 | if (_label == null) 40 | { 41 | _label = new GUIContent(); 42 | } 43 | _label.text = text; 44 | _label.tooltip = tooltip; 45 | return _label; 46 | } 47 | public static GUIContent GetLabel(string text) 48 | { 49 | if (_label == null) 50 | { 51 | _label = new GUIContent(); 52 | } 53 | _label.text = text; 54 | return _label; 55 | } 56 | 57 | #region CreateLazyNote 58 | [MenuItem("GameObject/" + ASSET_SHORT_NAME + "/Create " + nameof(LazyNote) + " with arrow")] 59 | public static void CreateLazyNoteWithArrow(MenuCommand menuCommand) 60 | { 61 | CreateLazyNoteInternal(menuCommand, true); 62 | } 63 | [MenuItem("GameObject/" + ASSET_SHORT_NAME + "/Create " + nameof(LazyNote))] 64 | public static void CreateLazyNote(MenuCommand menuCommand) 65 | { 66 | CreateLazyNoteInternal(menuCommand, false); 67 | } 68 | private static GameObject CreateLazyNoteInternal(MenuCommand menuCommand, bool isWithArrow) 69 | { 70 | GameObject go = new GameObject(nameof(LazyNote) + (isWithArrow ? " (Arrow)" : "")); 71 | go.tag = EDITOR_NAME_TAG; 72 | go.AddComponent(); 73 | GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); 74 | if (go.transform.parent == null) 75 | { 76 | go.transform.parent = FindRootTransform().transform; 77 | } 78 | Selection.activeObject = go; 79 | if (isWithArrow) 80 | { 81 | go.AddComponent(); 82 | } 83 | Undo.RegisterCreatedObjectUndo(go, "Create " + go.name); 84 | return go; 85 | } 86 | #endregion 87 | 88 | #region CreateNote 89 | [MenuItem("GameObject/" + ASSET_SHORT_NAME + "/Create " + nameof(Note) + " with arrow")] 90 | public static void CreateNoteWithArrow(MenuCommand menuCommand) 91 | { 92 | CreateNoteInternal(menuCommand, true); 93 | } 94 | [MenuItem("GameObject/" + ASSET_SHORT_NAME + "/Create " + nameof(Note))] 95 | public static void CreateNote(MenuCommand menuCommand) 96 | { 97 | CreateNoteInternal(menuCommand, false); 98 | } 99 | private static GameObject CreateNoteInternal(MenuCommand menuCommand, bool isWithArrow) 100 | { 101 | GameObject go = new GameObject(nameof(Note) + (isWithArrow ? " (Arrow)" : "")); 102 | go.tag = EDITOR_NAME_TAG; 103 | go.AddComponent(); 104 | GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); 105 | if (go.transform.parent == null) 106 | { 107 | go.transform.parent = FindRootTransform().transform; 108 | } 109 | Selection.activeObject = go; 110 | if (isWithArrow) 111 | { 112 | go.AddComponent(); 113 | } 114 | Undo.RegisterCreatedObjectUndo(go, "Create " + go.name); 115 | return go; 116 | } 117 | #endregion 118 | 119 | #region Draw 120 | [DrawGizmo(GizmoType.Selected | GizmoType.NonSelected | GizmoType.Pickable)] 121 | private static void DrawLazyNote(LazyNote note, GizmoType gizmoType) 122 | { 123 | Init(); 124 | 125 | string sceneText = GetSceneNote(note.Text); 126 | DrawWorldLabel(note, note.transform.position, GetLabel(sceneText), _textStyle); 127 | 128 | if (note.DrawIcon) 129 | { 130 | Gizmos.DrawIcon(note.transform.position, _noteIconPath, false, note.Color); 131 | } 132 | } 133 | [DrawGizmo(GizmoType.Selected | GizmoType.NonSelected | GizmoType.Pickable)] 134 | private static void DrawNote(Note note, GizmoType gizmoType) 135 | { 136 | Init(); 137 | 138 | string sceneText = GetSceneNote(note.Text); 139 | DrawWorldLabel(note, note.transform.position, GetLabel(sceneText), _textStyle); 140 | 141 | if (note.DrawIcon) 142 | { 143 | Gizmos.DrawIcon(note.transform.position, _authorNoteIconPath, false, note.AuthorColor); 144 | Gizmos.DrawIcon(note.transform.position, _typeNoteIconPath, false, note.Color); 145 | } 146 | } 147 | private static void DrawWorldLabel(INote note, Vector3 position, GUIContent content, GUIStyle style) 148 | { 149 | if (string.IsNullOrEmpty(content.text)) { return; } 150 | if (!(HandleUtility.WorldToGUIPointWithDepth(position).z < 0f)) 151 | { 152 | Handles.BeginGUI(); 153 | Color dc = GUI.color; 154 | 155 | Rect rect = WorldPointToSizedRect(position, content, style, note.DrawIcon); 156 | Color c = note.Color; 157 | c.a = 0.3f; 158 | GUI.color = c; 159 | EditorGUI.DrawRect(rect, c); 160 | GUI.color = Color.black; 161 | GUI.Label(rect, content, style); 162 | 163 | GUI.color = dc; 164 | Handles.EndGUI(); 165 | } 166 | } 167 | public static Rect WorldPointToSizedRect(Vector3 position, GUIContent content, GUIStyle style, bool isDrawIcon) 168 | { 169 | Vector2 cameraPoints = new Vector2(Camera.current.pixelWidth, Camera.current.pixelHeight); 170 | cameraPoints = EditorGUIUtility.PixelsToPoints(cameraPoints); 171 | 172 | float width = cameraPoints.x / 3.5f; 173 | 174 | Vector2 center = HandleUtility.WorldToGUIPointWithDepth(position); 175 | float height = style.CalcHeight(content, width); 176 | Vector2 size = new Vector2(width, height); 177 | 178 | Rect rect = new Rect(Vector2.zero, size); 179 | if (isDrawIcon) 180 | { 181 | center.y += 19f + size.y / 2f; 182 | } 183 | rect.center = center; 184 | return style.padding.Add(rect); 185 | } 186 | internal static string GetSceneNote(string fullNote) 187 | { 188 | int index = fullNote.IndexOf(NOTE_SEPARATOR) - 1; 189 | if (index < 0) { return string.Empty; } 190 | for (; index >= 0; index--) 191 | { 192 | if (char.IsWhiteSpace(fullNote[index]) == false) 193 | { 194 | break; 195 | } 196 | } 197 | string result = fullNote.Substring(0, index + 1); 198 | return result; 199 | } 200 | #endregion 201 | 202 | #region Utils 203 | private static Transform FindRootTransform(string name = NOTES_ROOT_NAME) 204 | { 205 | GameObject root = GameObject.Find(name); 206 | if (root == null) 207 | { 208 | root = new GameObject(name); 209 | root.tag = EDITOR_NAME_TAG; 210 | root.transform.position = Vector3.zero; 211 | root.transform.rotation = Quaternion.identity; 212 | root.transform.localScale = Vector3.one; 213 | } 214 | return root.transform; 215 | } 216 | internal static string GetGizmosPath() 217 | { 218 | if (string.IsNullOrEmpty(_gizmosPath)) 219 | { 220 | var assembly = Assembly.GetExecutingAssembly(); 221 | string packagePath = null; 222 | if (assembly != null) 223 | { 224 | packagePath = UnityEditor.PackageManager.PackageInfo.FindForAssembly(assembly)?.assetPath; 225 | } 226 | if (string.IsNullOrEmpty(packagePath)) 227 | { 228 | var guids = AssetDatabase.FindAssets($"Notes-Unity t:AssemblyDefinitionAsset"); 229 | for (var i = 0; i < guids.Length; i++) 230 | { 231 | var guid = guids[i]; 232 | var path = AssetDatabase.GUIDToAssetPath(guid); 233 | var asmdef = AssetDatabase.LoadAssetAtPath(path); 234 | if (asmdef != null && asmdef.name == "Notes-Unity") 235 | { 236 | packagePath = path.Substring(0, path.LastIndexOf("/")); 237 | break; 238 | } 239 | } 240 | } 241 | _gizmosPath = packagePath + "/Gizmos"; 242 | } 243 | return _gizmosPath; 244 | } 245 | #endregion 246 | } 247 | } 248 | #endif -------------------------------------------------------------------------------- /Editor/NoteUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53dc3603de3c34f4fae8f14bc86f92a8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/NotesSettings.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEditor; 5 | using UnityEngine; 6 | 7 | namespace DCFApixels.Notes.Editors 8 | { 9 | using static NotesConsts; 10 | [FilePath(AUTHOR + "/NotesSettings", FilePathAttribute.Location.ProjectFolder)] 11 | [InitializeOnLoad] 12 | internal class NotesSettings : ScriptableSingleton, ISerializationCallbackReceiver 13 | { 14 | internal const int NO_INIT_ID = 0; 15 | public static NotesSettings Instance => instance; 16 | 17 | [SerializeField] 18 | private int _authorIDIncrement = NO_INIT_ID + 1; 19 | [SerializeField] 20 | private int _typeIDIncrement = NO_INIT_ID + 1; 21 | 22 | private Dictionary _authorsDict = new Dictionary(); 23 | private Dictionary _typesDict = new Dictionary(); 24 | 25 | public IEnumerable Authors => _authorsDict.Values; 26 | public IEnumerable Types => _typesDict.Values; 27 | public int AuthorsCount => _authorsDict.Count; 28 | public int TypesCount => _typesDict.Count; 29 | 30 | [SerializeField, HideInInspector] 31 | private int _anonymousAuthorInfoID; 32 | [SerializeField, HideInInspector] 33 | private int _stickerAuthorInfoID; 34 | 35 | 36 | 37 | public AuthorInfo NewAuthorInfo() 38 | { 39 | var result = new AuthorInfo(_authorIDIncrement); 40 | _authorsSerialization.Add(result); 41 | _authorsDict.Add(_authorIDIncrement++, result); 42 | return result; 43 | } 44 | public bool TryGetAuthorInfo(int id, out AuthorInfo info) 45 | { 46 | return _authorsDict.TryGetValue(id, out info); 47 | } 48 | public AuthorInfo GetAuthorInfoOrDummy(int id) 49 | { 50 | if (TryGetAuthorInfo(id, out var result)) 51 | { 52 | return result; 53 | } 54 | return DUMMY_AUTHOR; 55 | } 56 | 57 | public NoteTypeInfo NewTypeInfo() 58 | { 59 | var result = new NoteTypeInfo(_typeIDIncrement); 60 | _typesSerialization.Add(result); 61 | _typesDict.Add(_typeIDIncrement++, result); 62 | return result; 63 | } 64 | public bool TryGetTypeInfo(int id, out NoteTypeInfo info) 65 | { 66 | return _typesDict.TryGetValue(id, out info); 67 | } 68 | public NoteTypeInfo GetNoteTypeInfoOrDummy(int id) 69 | { 70 | if (TryGetTypeInfo(id, out var result)) 71 | { 72 | return result; 73 | } 74 | return DUMMY_NOTE_TYPE; 75 | } 76 | 77 | public void Save() 78 | { 79 | foreach (var item in _authorsSerialization) 80 | { 81 | if (item._id == NO_INIT_ID) item._id = _authorIDIncrement++; 82 | item.color.a = 255; 83 | } 84 | foreach (var item in _typesSerialization) 85 | { 86 | if (item._id == NO_INIT_ID) item._id = _typeIDIncrement++; 87 | item.color.a = 255; 88 | } 89 | Save(false); 90 | } 91 | //public void SetNewAuthors(IEnumerable authors) 92 | //{ 93 | // _authorsSerialization = authors.ToArray(); 94 | //} 95 | //public void SetNewNoteTypes(IEnumerable types) 96 | //{ 97 | // _typesSerialization = types.ToArray(); 98 | //} 99 | 100 | #region ISerializationCallbackReceiver 101 | [SerializeField] 102 | private List _authorsSerialization = new List(); 103 | [SerializeField] 104 | private List _typesSerialization = new List(); 105 | private void OnEnable() 106 | { 107 | hideFlags &= ~HideFlags.NotEditable; 108 | } 109 | void ISerializationCallbackReceiver.OnAfterDeserialize() 110 | { 111 | foreach (var item in _authorsSerialization) 112 | { 113 | if (item._id == NO_INIT_ID) item._id = _authorIDIncrement++; 114 | item.color.a = 255; 115 | } 116 | foreach (var item in _typesSerialization) 117 | { 118 | if (item._id == NO_INIT_ID) item._id = _typeIDIncrement++; 119 | item.color.a = 255; 120 | } 121 | _authorsDict = _authorsSerialization.ToDictionary(o => o._id); 122 | _typesDict = _typesSerialization.ToDictionary(o => o._id); 123 | } 124 | void ISerializationCallbackReceiver.OnBeforeSerialize() 125 | { 126 | } 127 | #endregion 128 | } 129 | public static class NotesSettingsExtensions 130 | { 131 | public static bool IsNullOrDummy(this AuthorInfo self) => self == null || self == DUMMY_AUTHOR; 132 | public static bool IsNullOrDummy(this NoteTypeInfo self) => self == null || self == DUMMY_NOTE_TYPE; 133 | public static bool IsDummy(this AuthorInfo self) => self == DUMMY_AUTHOR; 134 | public static bool IsDummy(this NoteTypeInfo self) => self == DUMMY_NOTE_TYPE; 135 | } 136 | } 137 | #endif -------------------------------------------------------------------------------- /Editor/NotesSettings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b77ef07d8293ab498e2a13921518ad2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/NotesSettingsWindow.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace DCFApixels.Notes.Editors 6 | { 7 | internal class NotesSettingsWindow : EditorWindow 8 | { 9 | //[MenuItem("Window/" + AUTHOR + "/" + ASSET_SHORT_NAME + "/Settings")] 10 | internal static void Open() 11 | { 12 | NotesSettingsWindow window = GetWindow(); 13 | window.titleContent = new GUIContent("Notes settings"); 14 | window.Show(); 15 | } 16 | 17 | private NotesSettings Settigns => NotesSettings.Instance; 18 | 19 | private SerializedObject target; 20 | 21 | private Vector2 scrollViewPos; 22 | 23 | private void OnGUI() 24 | { 25 | if (target == null) 26 | { 27 | Settigns.hideFlags = ~HideFlags.HideAndDontSave; 28 | target = new SerializedObject(Settigns); 29 | } 30 | 31 | GUILayout.BeginScrollView(scrollViewPos); 32 | 33 | SerializedProperty authorsProp = target.FindProperty("_authorsSerialization"); 34 | SerializedProperty typesProp = target.FindProperty("_typesSerialization"); 35 | int oldAuthorsCount = authorsProp.arraySize; 36 | int oldTypesCount = typesProp.arraySize; 37 | GUI.enabled = true; 38 | 39 | EditorGUI.BeginChangeCheck(); 40 | EditorGUILayout.PropertyField(authorsProp, new GUIContent("Authors")); 41 | EditorGUILayout.PropertyField(typesProp, new GUIContent("Types")); 42 | if (EditorGUI.EndChangeCheck()) 43 | { 44 | if (authorsProp.arraySize != oldAuthorsCount) 45 | { 46 | for (int i = oldAuthorsCount; i < authorsProp.arraySize; i++) 47 | authorsProp.GetArrayElementAtIndex(i).FindPropertyRelative("_id").intValue = 0; 48 | } 49 | if (typesProp.arraySize != oldTypesCount) 50 | { 51 | for (int i = oldTypesCount; i < typesProp.arraySize; i++) 52 | typesProp.GetArrayElementAtIndex(i).FindPropertyRelative("_id").intValue = 0; 53 | } 54 | target.ApplyModifiedProperties(); 55 | EditorUtility.SetDirty(Settigns); 56 | Settigns.Save(); 57 | } 58 | 59 | GUILayout.EndScrollView(); 60 | } 61 | } 62 | } 63 | #endif -------------------------------------------------------------------------------- /Editor/NotesSettingsWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca63531ed00a6fc439e00fa3053a5173 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Gizmos.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01d7bbc76d6bea74a97b9a4105d90871 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Gizmos/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7f87ea3984891e4a8b5daf946e1c250 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Gizmos/Runtime/Note Author Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DCFApixels/Unity-Notes/20bba03e2d09c6a90ffc305d950348243eeb2690/Gizmos/Runtime/Note Author Icon.png -------------------------------------------------------------------------------- /Gizmos/Runtime/Note Author Icon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 045afb50317175f418910ecd346130cf 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | vTOnly: 0 27 | ignoreMasterTextureLimit: 0 28 | grayScaleToAlpha: 0 29 | generateCubemap: 6 30 | cubemapConvolution: 0 31 | seamlessCubemap: 0 32 | textureFormat: 1 33 | maxTextureSize: 2048 34 | textureSettings: 35 | serializedVersion: 2 36 | filterMode: 1 37 | aniso: 1 38 | mipBias: 0 39 | wrapU: 1 40 | wrapV: 1 41 | wrapW: 1 42 | nPOTScale: 1 43 | lightmap: 0 44 | compressionQuality: 50 45 | spriteMode: 0 46 | spriteExtrude: 1 47 | spriteMeshType: 1 48 | alignment: 0 49 | spritePivot: {x: 0.5, y: 0.5} 50 | spritePixelsToUnits: 100 51 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 52 | spriteGenerateFallbackPhysicsShape: 1 53 | alphaUsage: 1 54 | alphaIsTransparency: 1 55 | spriteTessellationDetail: -1 56 | textureType: 2 57 | textureShape: 1 58 | singleChannelComponent: 0 59 | flipbookRows: 1 60 | flipbookColumns: 1 61 | maxTextureSizeSet: 0 62 | compressionQualitySet: 0 63 | textureFormatSet: 0 64 | ignorePngGamma: 0 65 | applyGammaDecoding: 0 66 | cookieLightType: 0 67 | platformSettings: 68 | - serializedVersion: 3 69 | buildTarget: DefaultTexturePlatform 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 1 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | forceMaximumCompressionQuality_BC6H_BC7: 0 80 | - serializedVersion: 3 81 | buildTarget: Standalone 82 | maxTextureSize: 2048 83 | resizeAlgorithm: 0 84 | textureFormat: -1 85 | textureCompression: 1 86 | compressionQuality: 50 87 | crunchedCompression: 0 88 | allowsAlphaSplitting: 0 89 | overridden: 0 90 | androidETC2FallbackOverride: 0 91 | forceMaximumCompressionQuality_BC6H_BC7: 0 92 | - serializedVersion: 3 93 | buildTarget: Server 94 | maxTextureSize: 2048 95 | resizeAlgorithm: 0 96 | textureFormat: -1 97 | textureCompression: 1 98 | compressionQuality: 50 99 | crunchedCompression: 0 100 | allowsAlphaSplitting: 0 101 | overridden: 0 102 | androidETC2FallbackOverride: 0 103 | forceMaximumCompressionQuality_BC6H_BC7: 0 104 | - serializedVersion: 3 105 | buildTarget: Android 106 | maxTextureSize: 2048 107 | resizeAlgorithm: 0 108 | textureFormat: -1 109 | textureCompression: 1 110 | compressionQuality: 50 111 | crunchedCompression: 0 112 | allowsAlphaSplitting: 0 113 | overridden: 0 114 | androidETC2FallbackOverride: 0 115 | forceMaximumCompressionQuality_BC6H_BC7: 0 116 | - serializedVersion: 3 117 | buildTarget: iPhone 118 | maxTextureSize: 2048 119 | resizeAlgorithm: 0 120 | textureFormat: -1 121 | textureCompression: 1 122 | compressionQuality: 50 123 | crunchedCompression: 0 124 | allowsAlphaSplitting: 0 125 | overridden: 0 126 | androidETC2FallbackOverride: 0 127 | forceMaximumCompressionQuality_BC6H_BC7: 0 128 | spriteSheet: 129 | serializedVersion: 2 130 | sprites: [] 131 | outline: [] 132 | physicsShape: [] 133 | bones: [] 134 | spriteID: 135 | internalID: 0 136 | vertices: [] 137 | indices: 138 | edges: [] 139 | weights: [] 140 | secondaryTextures: [] 141 | nameFileIdTable: {} 142 | spritePackingTag: 143 | pSDRemoveMatte: 0 144 | pSDShowRemoveMatteOption: 0 145 | userData: 146 | assetBundleName: 147 | assetBundleVariant: 148 | -------------------------------------------------------------------------------- /Gizmos/Runtime/Note Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DCFApixels/Unity-Notes/20bba03e2d09c6a90ffc305d950348243eeb2690/Gizmos/Runtime/Note Icon.png -------------------------------------------------------------------------------- /Gizmos/Runtime/Note Icon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6bc2a5caa11f5ac4da78e15024e09493 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | flipGreenChannel: 0 24 | isReadable: 0 25 | streamingMipmaps: 0 26 | streamingMipmapsPriority: 0 27 | vTOnly: 0 28 | ignoreMipmapLimit: 0 29 | grayScaleToAlpha: 0 30 | generateCubemap: 6 31 | cubemapConvolution: 0 32 | seamlessCubemap: 0 33 | textureFormat: 1 34 | maxTextureSize: 2048 35 | textureSettings: 36 | serializedVersion: 2 37 | filterMode: 1 38 | aniso: 1 39 | mipBias: 0 40 | wrapU: 1 41 | wrapV: 1 42 | wrapW: 0 43 | nPOTScale: 0 44 | lightmap: 0 45 | compressionQuality: 50 46 | spriteMode: 0 47 | spriteExtrude: 1 48 | spriteMeshType: 1 49 | alignment: 0 50 | spritePivot: {x: 0.5, y: 0.5} 51 | spritePixelsToUnits: 100 52 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 53 | spriteGenerateFallbackPhysicsShape: 1 54 | alphaUsage: 1 55 | alphaIsTransparency: 1 56 | spriteTessellationDetail: -1 57 | textureType: 2 58 | textureShape: 1 59 | singleChannelComponent: 0 60 | flipbookRows: 1 61 | flipbookColumns: 1 62 | maxTextureSizeSet: 0 63 | compressionQualitySet: 0 64 | textureFormatSet: 0 65 | ignorePngGamma: 0 66 | applyGammaDecoding: 0 67 | swizzle: 50462976 68 | cookieLightType: 0 69 | platformSettings: 70 | - serializedVersion: 3 71 | buildTarget: DefaultTexturePlatform 72 | maxTextureSize: 2048 73 | resizeAlgorithm: 0 74 | textureFormat: -1 75 | textureCompression: 1 76 | compressionQuality: 50 77 | crunchedCompression: 0 78 | allowsAlphaSplitting: 0 79 | overridden: 0 80 | androidETC2FallbackOverride: 0 81 | forceMaximumCompressionQuality_BC6H_BC7: 0 82 | - serializedVersion: 3 83 | buildTarget: Standalone 84 | maxTextureSize: 2048 85 | resizeAlgorithm: 0 86 | textureFormat: -1 87 | textureCompression: 1 88 | compressionQuality: 50 89 | crunchedCompression: 0 90 | allowsAlphaSplitting: 0 91 | overridden: 0 92 | androidETC2FallbackOverride: 0 93 | forceMaximumCompressionQuality_BC6H_BC7: 0 94 | - serializedVersion: 3 95 | buildTarget: Server 96 | maxTextureSize: 2048 97 | resizeAlgorithm: 0 98 | textureFormat: -1 99 | textureCompression: 1 100 | compressionQuality: 50 101 | crunchedCompression: 0 102 | allowsAlphaSplitting: 0 103 | overridden: 0 104 | androidETC2FallbackOverride: 0 105 | forceMaximumCompressionQuality_BC6H_BC7: 0 106 | - serializedVersion: 3 107 | buildTarget: Android 108 | maxTextureSize: 2048 109 | resizeAlgorithm: 0 110 | textureFormat: -1 111 | textureCompression: 1 112 | compressionQuality: 50 113 | crunchedCompression: 0 114 | allowsAlphaSplitting: 0 115 | overridden: 0 116 | androidETC2FallbackOverride: 0 117 | forceMaximumCompressionQuality_BC6H_BC7: 0 118 | spriteSheet: 119 | serializedVersion: 2 120 | sprites: [] 121 | outline: [] 122 | physicsShape: [] 123 | bones: [] 124 | spriteID: 125 | internalID: 0 126 | vertices: [] 127 | indices: 128 | edges: [] 129 | weights: [] 130 | secondaryTextures: [] 131 | nameFileIdTable: {} 132 | mipmapLimitGroupName: 133 | pSDRemoveMatte: 0 134 | userData: 135 | assetBundleName: 136 | assetBundleVariant: 137 | -------------------------------------------------------------------------------- /Gizmos/Runtime/Note Type Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DCFApixels/Unity-Notes/20bba03e2d09c6a90ffc305d950348243eeb2690/Gizmos/Runtime/Note Type Icon.png -------------------------------------------------------------------------------- /Gizmos/Runtime/Note Type Icon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f70e1db12effbc4e8a9f78fa7f3aa75 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 12 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | vTOnly: 0 27 | ignoreMasterTextureLimit: 0 28 | grayScaleToAlpha: 0 29 | generateCubemap: 6 30 | cubemapConvolution: 0 31 | seamlessCubemap: 0 32 | textureFormat: 1 33 | maxTextureSize: 2048 34 | textureSettings: 35 | serializedVersion: 2 36 | filterMode: 1 37 | aniso: 1 38 | mipBias: 0 39 | wrapU: 1 40 | wrapV: 1 41 | wrapW: 1 42 | nPOTScale: 1 43 | lightmap: 0 44 | compressionQuality: 50 45 | spriteMode: 0 46 | spriteExtrude: 1 47 | spriteMeshType: 1 48 | alignment: 0 49 | spritePivot: {x: 0.5, y: 0.5} 50 | spritePixelsToUnits: 100 51 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 52 | spriteGenerateFallbackPhysicsShape: 1 53 | alphaUsage: 1 54 | alphaIsTransparency: 1 55 | spriteTessellationDetail: -1 56 | textureType: 2 57 | textureShape: 1 58 | singleChannelComponent: 0 59 | flipbookRows: 1 60 | flipbookColumns: 1 61 | maxTextureSizeSet: 0 62 | compressionQualitySet: 0 63 | textureFormatSet: 0 64 | ignorePngGamma: 0 65 | applyGammaDecoding: 0 66 | cookieLightType: 0 67 | platformSettings: 68 | - serializedVersion: 3 69 | buildTarget: DefaultTexturePlatform 70 | maxTextureSize: 2048 71 | resizeAlgorithm: 0 72 | textureFormat: -1 73 | textureCompression: 1 74 | compressionQuality: 50 75 | crunchedCompression: 0 76 | allowsAlphaSplitting: 0 77 | overridden: 0 78 | androidETC2FallbackOverride: 0 79 | forceMaximumCompressionQuality_BC6H_BC7: 0 80 | - serializedVersion: 3 81 | buildTarget: Standalone 82 | maxTextureSize: 2048 83 | resizeAlgorithm: 0 84 | textureFormat: -1 85 | textureCompression: 1 86 | compressionQuality: 50 87 | crunchedCompression: 0 88 | allowsAlphaSplitting: 0 89 | overridden: 0 90 | androidETC2FallbackOverride: 0 91 | forceMaximumCompressionQuality_BC6H_BC7: 0 92 | - serializedVersion: 3 93 | buildTarget: Server 94 | maxTextureSize: 2048 95 | resizeAlgorithm: 0 96 | textureFormat: -1 97 | textureCompression: 1 98 | compressionQuality: 50 99 | crunchedCompression: 0 100 | allowsAlphaSplitting: 0 101 | overridden: 0 102 | androidETC2FallbackOverride: 0 103 | forceMaximumCompressionQuality_BC6H_BC7: 0 104 | - serializedVersion: 3 105 | buildTarget: Android 106 | maxTextureSize: 2048 107 | resizeAlgorithm: 0 108 | textureFormat: -1 109 | textureCompression: 1 110 | compressionQuality: 50 111 | crunchedCompression: 0 112 | allowsAlphaSplitting: 0 113 | overridden: 0 114 | androidETC2FallbackOverride: 0 115 | forceMaximumCompressionQuality_BC6H_BC7: 0 116 | - serializedVersion: 3 117 | buildTarget: iPhone 118 | maxTextureSize: 2048 119 | resizeAlgorithm: 0 120 | textureFormat: -1 121 | textureCompression: 1 122 | compressionQuality: 50 123 | crunchedCompression: 0 124 | allowsAlphaSplitting: 0 125 | overridden: 0 126 | androidETC2FallbackOverride: 0 127 | forceMaximumCompressionQuality_BC6H_BC7: 0 128 | spriteSheet: 129 | serializedVersion: 2 130 | sprites: [] 131 | outline: [] 132 | physicsShape: [] 133 | bones: [] 134 | spriteID: 135 | internalID: 0 136 | vertices: [] 137 | indices: 138 | edges: [] 139 | weights: [] 140 | secondaryTextures: [] 141 | nameFileIdTable: {} 142 | spritePackingTag: 143 | pSDRemoveMatte: 0 144 | pSDShowRemoveMatteOption: 0 145 | userData: 146 | assetBundleName: 147 | assetBundleVariant: 148 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Mikhail 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a45a27c695469e44ac9aa3842ff3d39 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Notes-Unity.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DCFApixels.Notes", 3 | "rootNamespace": "DCFApixels", 4 | "references": [], 5 | "includePlatforms": [], 6 | "excludePlatforms": [], 7 | "allowUnsafeCode": false, 8 | "overrideReferences": false, 9 | "precompiledReferences": [], 10 | "autoReferenced": true, 11 | "defineConstraints": [], 12 | "versionDefines": [], 13 | "noEngineReferences": false 14 | } -------------------------------------------------------------------------------- /Notes-Unity.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22f707c42ae067247b7e20e89862eeeb 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README-RU.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 |

6 | Version 7 | License 8 |

9 | 10 | # Заметки для Редактора Unity 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 31 | 32 |
Readme Languages:
20 | 21 |
22 | Русский 23 |
24 |
26 | 27 |
28 | English 29 |
30 |
33 | 34 |
35 | 36 | 37 |

38 | 39 |
40 | Заметки в Scene View для дизайнеров. 41 |

42 | 43 | ## Установка 44 | Семантика версионирования - [Открыть](https://gist.github.com/DCFApixels/e53281d4628b19fe5278f3e77a7da9e8#file-dcfapixels_versioning_ru-md) 45 | 46 | * ### Unity-модуль 47 | Добавьте git-URL в [PackageManager](https://docs.unity3d.com/2023.2/Documentation/Manual/upm-ui-giturl.html) или вручную в `Packages/manifest.json` файл. Используйте этот git-URL: 48 | ``` 49 | https://github.com/DCFApixels/Unity-Notes.git 50 | ``` 51 | * ### В виде исходников 52 | Можно установит просто скопировав исходники в папку проекта 53 | 54 |
55 | 56 | ## Как использовать 57 | Просто добавьте компонент `Note` или `LazyNote` на любой GameObject. Либо используйте ПКМ + "GameObject/Notes/Create Note"(или LazyNote) для автоматического создания объекта с заметкой. 58 | 59 | Чтобы добавить пресеты Авторов или Типов Заметок нажмите на иконку ![gear](https://github.com/DCFApixels/Unity-Notes/assets/99481254/0d0efe29-6f54-44d1-a8a6-90f895e101ee) в компоненте заметки. 60 | 61 | Чтобы отобразить текст заметки в Scene View, используйте разделитель ">-<", весь текст перед разделителем будет отображен. 62 | 63 | Заметки предназначены для использования только в редакторе, все данные из заметок будут удалены в Release сборке. 64 | -------------------------------------------------------------------------------- /README-RU.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7514dee65c56ecc4f8dc1d4e29316196 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 |

6 | Version 7 | License 8 |

9 | 10 | # Notes for Unity Editor 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 31 | 32 |
Readme Languages:
20 | 21 |
22 | Русский 23 |
24 |
26 | 27 |
28 | English 29 |
30 |
33 | 34 | 35 |

36 | 37 |
38 | Notes on Scene View for designers. 39 |

40 | 41 | ## Installation 42 | Versioning semantics - [Open](https://gist.github.com/DCFApixels/e53281d4628b19fe5278f3e77a7da9e8#file-dcfapixels_versioning_ru-md) 43 | * ### Unity-module 44 | Add the git-URL to the project [using PackageManager](https://docs.unity3d.com/2023.2/Documentation/Manual/upm-ui-giturl.html) or directly to the `Packages/manifest.json` file. Copy this git-URL: 45 | ``` 46 | https://github.com/DCFApixels/Unity-Notes.git 47 | ``` 48 | * ### Using source code 49 | Can install by copying the sources into the project. 50 | 51 |
52 | 53 | ## How to use 54 | Just add the `Note` or `LazyNote` component to any GameObject. Or use RMB + "GameObject/Notes/Create Note"(or LazyNote) to automatically create a note object. 55 | 56 | To add Author or Note Type presets, click on the ![gear](https://github.com/DCFApixels/Unity-Notes/assets/99481254/0d0efe29-6f54-44d1-a8a6-90f895e101ee) icon in the Note component. 57 | 58 | To display text in the Scene View window, use the separator ">-<" all text before it will be displayed 59 | 60 | Intended for use in the editor only, all note data will be removed in the Release build. 61 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2395ec13d44ad1643a36241859399fc2 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90e1b160ebbe77542b07e50d36843a1b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Consts.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace DCFApixels.Notes 4 | { 5 | internal class NotesConsts 6 | { 7 | public const string EDITOR_NAME_TAG = "EditorOnly"; 8 | public const string NOTES_ROOT_NAME = "NOTES (" + EDITOR_NAME_TAG + ")"; 9 | 10 | public const string ASSET_SHORT_NAME = "Notes"; 11 | public const string AUTHOR = "DCFApixels"; 12 | public const string NOTE_SEPARATOR = ">-<"; 13 | 14 | public const float DEFAULT_NOTE_HEIGHT = 100f; 15 | public const float MIN_NOTE_HEIGHT = 20f; 16 | 17 | public const string STICKER_NAME = "Sticker"; 18 | public const string ANONYMOUS_NAME = "Anonymous"; 19 | public static readonly Color STICKER_COLOR = new Color(1f, 0.8f, 0.3f, 1f); 20 | public static readonly Color NEUTRAL_COLOR = new Color(0.68f, 0.73f, 0.77f, 1f); 21 | 22 | public static readonly AuthorInfo DUMMY_AUTHOR = new AuthorInfo(0) 23 | { 24 | name = "Dummy", 25 | color = NEUTRAL_COLOR, 26 | }; 27 | public static readonly NoteTypeInfo DUMMY_NOTE_TYPE = new NoteTypeInfo(0) 28 | { 29 | name = "Dummy", 30 | color = NEUTRAL_COLOR, 31 | }; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Runtime/Consts.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96395fd64cd68844f82f32527492296d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/LazyNote.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable CS0414 2 | using UnityEngine; 3 | 4 | namespace DCFApixels.Notes 5 | { 6 | using static NotesConsts; 7 | [AddComponentMenu(ASSET_SHORT_NAME + "/" + nameof(LazyNote), 30)] 8 | internal class LazyNote : MonoBehaviour, INote 9 | { 10 | #if UNITY_EDITOR 11 | [SerializeField] 12 | private string _text = "Enter text..."; 13 | [SerializeField] 14 | private float _height = DEFAULT_NOTE_HEIGHT; 15 | [SerializeField] 16 | private Color _color = STICKER_COLOR; 17 | [SerializeField] 18 | private bool _drawIcon = true; 19 | #endif 20 | 21 | #region Readonly properties 22 | public float Height 23 | { 24 | get 25 | { 26 | #if UNITY_EDITOR 27 | return _height; 28 | #else 29 | return default; 30 | #endif 31 | } 32 | } 33 | public string Text 34 | { 35 | get 36 | { 37 | #if UNITY_EDITOR 38 | return _text; 39 | #else 40 | return string.Empty; 41 | #endif 42 | } 43 | } 44 | public Color Color 45 | { 46 | get 47 | { 48 | #if UNITY_EDITOR 49 | return _color; 50 | #else 51 | return Color.black; 52 | #endif 53 | } 54 | } 55 | public bool DrawIcon 56 | { 57 | get 58 | { 59 | #if UNITY_EDITOR 60 | return _drawIcon; 61 | #else 62 | return default; 63 | #endif 64 | } 65 | } 66 | #endregion 67 | } 68 | } -------------------------------------------------------------------------------- /Runtime/LazyNote.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd93ea16bcb2eb047a002c59c21b597c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Note.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable CS0414 2 | #if UNITY_EDITOR 3 | using DCFApixels.Notes.Editors; 4 | #endif 5 | using UnityEngine; 6 | 7 | namespace DCFApixels.Notes 8 | { 9 | using static NotesConsts; 10 | public interface INote 11 | { 12 | public string Text { get; } 13 | public Color Color { get; } 14 | public bool DrawIcon { get; } 15 | } 16 | [AddComponentMenu(ASSET_SHORT_NAME + "/" + nameof(Note), 30)] 17 | internal class Note : MonoBehaviour, INote 18 | { 19 | #if UNITY_EDITOR 20 | [SerializeField] 21 | private string _text = "Enter text..."; 22 | [SerializeField] 23 | private float _height = DEFAULT_NOTE_HEIGHT; 24 | [SerializeField] 25 | private bool _drawIcon = true; 26 | 27 | [SerializeField] 28 | private int _authorID; 29 | [SerializeField] 30 | private int _typeID; 31 | 32 | private AuthorInfo _author; 33 | private NoteTypeInfo _type; 34 | #endif 35 | internal void UpdateRefs() 36 | { 37 | #if UNITY_EDITOR 38 | _author = NotesSettings.Instance.GetAuthorInfoOrDummy(_authorID); 39 | _type = NotesSettings.Instance.GetNoteTypeInfoOrDummy(_typeID); 40 | #endif 41 | } 42 | 43 | #region Properties 44 | public float Height 45 | { 46 | get 47 | { 48 | #if UNITY_EDITOR 49 | return _height; 50 | #else 51 | return default; 52 | #endif 53 | } 54 | } 55 | public string Text 56 | { 57 | get 58 | { 59 | #if UNITY_EDITOR 60 | return _text; 61 | #else 62 | return string.Empty; 63 | #endif 64 | } 65 | } 66 | public AuthorInfo Author 67 | { 68 | get 69 | { 70 | #if UNITY_EDITOR 71 | if (_author == null) { UpdateRefs(); } 72 | return _author; 73 | #else 74 | return null; 75 | #endif 76 | } 77 | set 78 | { 79 | #if UNITY_EDITOR 80 | _author = value; 81 | _authorID = value._id; 82 | #endif 83 | } 84 | } 85 | public NoteTypeInfo Type 86 | { 87 | get 88 | { 89 | #if UNITY_EDITOR 90 | if (_type == null) { UpdateRefs(); } 91 | return _type; 92 | #else 93 | return null; 94 | #endif 95 | } 96 | set 97 | { 98 | #if UNITY_EDITOR 99 | _type = value; 100 | _typeID = value._id; 101 | #endif 102 | } 103 | } 104 | public bool DrawIcon 105 | { 106 | get 107 | { 108 | #if UNITY_EDITOR 109 | return _drawIcon; 110 | #else 111 | return default; 112 | #endif 113 | } 114 | } 115 | 116 | public Color AuthorColor 117 | { 118 | get 119 | { 120 | #if UNITY_EDITOR 121 | return Author.color; 122 | #else 123 | return Color.black; 124 | #endif 125 | } 126 | } 127 | public Color Color 128 | { 129 | get 130 | { 131 | #if UNITY_EDITOR 132 | return Type.color; 133 | #else 134 | return Color.black; 135 | #endif 136 | } 137 | } 138 | #endregion 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /Runtime/Note.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd2fa956a42dfda43844f6eb3d23355a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/NoteArrow.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace DCFApixels.Notes 4 | { 5 | using static NotesConsts; 6 | 7 | [AddComponentMenu(ASSET_SHORT_NAME + "/" + nameof(NoteArrow), 30)] 8 | public class NoteArrow : MonoBehaviour 9 | { 10 | #if UNITY_EDITOR 11 | [SerializeField] 12 | private Transform _target; 13 | #endif 14 | public Transform Target 15 | { 16 | get 17 | { 18 | #if UNITY_EDITOR 19 | return _target; 20 | #else 21 | return null; 22 | #endif 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Runtime/NoteArrow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b76c22d713cdc5498537bff6852c27c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 261765210a1294b43aaa97c7cbb9ffb4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Utils/AuthorInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace DCFApixels.Notes 5 | { 6 | [Serializable] 7 | public class AuthorInfo : NotePropertyInfo 8 | { 9 | public Color32 color = new Color32(255, 255, 255, 255); 10 | internal AuthorInfo(int id) : base(id) { } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Runtime/Utils/AuthorInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4a59be2bb4c6f14439725537f85d0a90 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Utils/NotePropertyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace DCFApixels.Notes 5 | { 6 | [Serializable] 7 | public abstract class NotePropertyInfo 8 | { 9 | [SerializeField] 10 | [HideInInspector] 11 | internal int _id; 12 | public string name = "Name"; 13 | 14 | protected NotePropertyInfo(int id) 15 | { 16 | _id = id; 17 | } 18 | 19 | public override int GetHashCode() 20 | { 21 | return _id; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Runtime/Utils/NotePropertyInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb20bd384692fca4ea964522dee93ce2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Utils/NoteTypeInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace DCFApixels.Notes 5 | { 6 | [Serializable] 7 | public class NoteTypeInfo : NotePropertyInfo 8 | { 9 | public Color32 color = new Color32(255, 255, 255, 255); 10 | internal NoteTypeInfo(int id) : base(id) { } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Runtime/Utils/NoteTypeInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5736de54351530640ab1736a7af72362 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.dcfa_pixels.notes", 3 | "author": 4 | { 5 | "name": "DCFApixels", 6 | "url": "https://github.com/DCFApixels" 7 | }, 8 | "displayName": "Notes", 9 | "description": "", 10 | "unity": "2020.3", 11 | "version": "1.0.0", 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/DCFApixels/Unity-Notes.git" 15 | }, 16 | "keywords": 17 | [ 18 | "editor", 19 | "utility" 20 | ] 21 | } -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 737c501242c7cac4db7261e48db45f91 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------