Skip to content

Commit 02a3f35

Browse files
committed
fixes
1 parent 7da7341 commit 02a3f35

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

Editor/NotesSettings.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ public NoteTypeInfo GetNoteTypeInfoOrDummy(int id)
7171

7272
public void Save()
7373
{
74+
foreach (var item in _authorsSerialization)
75+
{
76+
if (item._id == NO_INIT_ID) item._id = _authorIDIncrement++;
77+
item.color.a = 255;
78+
}
79+
foreach (var item in _typesSerialization)
80+
{
81+
if (item._id == NO_INIT_ID) item._id = _typeIDIncrement++;
82+
item.color.a = 255;
83+
}
7484
Save(false);
7585
}
7686
//public void SetNewAuthors(IEnumerable<AuthorInfo> authors)
@@ -98,7 +108,6 @@ void ISerializationCallbackReceiver.OnAfterDeserialize()
98108
if (item._id == NO_INIT_ID) item._id = _authorIDIncrement++;
99109
item.color.a = 255;
100110
}
101-
102111
foreach (var item in _typesSerialization)
103112
{
104113
if (item._id == NO_INIT_ID) item._id = _typeIDIncrement++;

Editor/NotesSettingsWindow.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ internal static void Open()
1818

1919
private SerializedObject target;
2020

21+
private Vector2 scrollViewPos;
22+
2123
private void OnGUI()
2224
{
2325
if(target == null)
@@ -26,10 +28,12 @@ private void OnGUI()
2628
target = new SerializedObject(Settigns);
2729
}
2830

31+
GUILayout.BeginScrollView(scrollViewPos);
32+
2933
SerializedProperty authorsProp = target.FindProperty("_authorsSerialization");
3034
SerializedProperty typesProp = target.FindProperty("_typesSerialization");
3135
int oldAuthorsCount = authorsProp.arraySize;
32-
int typesCount = typesProp.arraySize;
36+
int oldTypesCount = typesProp.arraySize;
3337
GUI.enabled = true;
3438

3539
EditorGUI.BeginChangeCheck();
@@ -42,15 +46,17 @@ private void OnGUI()
4246
for (int i = oldAuthorsCount; i < authorsProp.arraySize; i++)
4347
authorsProp.GetArrayElementAtIndex(i).FindPropertyRelative("_id").intValue = 0;
4448
}
45-
if(typesProp.arraySize != typesCount)
49+
if(typesProp.arraySize != oldTypesCount)
4650
{
47-
for (int i = oldAuthorsCount; i < typesProp.arraySize; i++)
51+
for (int i = oldTypesCount; i < typesProp.arraySize; i++)
4852
typesProp.GetArrayElementAtIndex(i).FindPropertyRelative("_id").intValue = 0;
4953
}
5054
target.ApplyModifiedProperties();
5155
EditorUtility.SetDirty(Settigns);
5256
Settigns.Save();
5357
}
58+
59+
GUILayout.EndScrollView();
5460
}
5561
}
5662
}

0 commit comments

Comments
 (0)