protected virtual void LayoutTagsField() { using (new EditorGUI.DisabledScope(this.gameProfile == null)) { EditorGUILayout.BeginHorizontal(); this.isTagsExpanded = EditorGUILayout.Foldout(this.isTagsExpanded, "Tags", true); GUILayout.FlexibleSpace(); bool isUndoRequested = EditorGUILayoutExtensions.UndoButton(isUndoEnabled); EditorGUILayout.EndHorizontal(); if (this.isTagsExpanded) { if (this.gameProfile == null) { EditorGUILayout.HelpBox("The Game's Profile is not yet loaded, and thus tags cannot be displayed. Please wait...", MessageType.Warning); } else if (this.gameProfile.tagCategories.Length == 0) { EditorGUILayout.HelpBox("The developers of " + this.gameProfile.name + " have not designated any tagging options", MessageType.Info); } else { var tagsProperty = editableProfileProperty.FindPropertyRelative("tags.value"); var selectedTags = new List <string>(EditorUtilityExtensions.GetSerializedPropertyStringArray(tagsProperty)); bool isDirty = false; ++EditorGUI.indentLevel; foreach (ModTagCategory tagCategory in this.gameProfile.tagCategories) { if (!tagCategory.isHidden) { bool wasSelectionModified; LayoutTagCategoryField(tagCategory, ref selectedTags, out wasSelectionModified); isDirty |= wasSelectionModified; } } --EditorGUI.indentLevel; if (isDirty) { EditorUtilityExtensions.SetSerializedPropertyStringArray(tagsProperty, selectedTags.ToArray()); editableProfileProperty.FindPropertyRelative("tags.isDirty").boolValue = true; } } if (isUndoRequested) { var tagsProperty = editableProfileProperty.FindPropertyRelative("tags.value"); EditorUtilityExtensions.SetSerializedPropertyStringArray(tagsProperty, profile.tagNames.ToArray()); editableProfileProperty.FindPropertyRelative("tags.isDirty").boolValue = false; } } } }
// - Misc Functionality - private void ResetModMedia() { EditorUtilityExtensions.SetSerializedPropertyStringArray(youtubeURLsProp.FindPropertyRelative("value"), profile.media.youtubeURLs); youtubeURLsProp.FindPropertyRelative("isDirty").boolValue = false; EditorUtilityExtensions.SetSerializedPropertyStringArray(sketchfabURLsProp.FindPropertyRelative("value"), profile.media.sketchfabURLs); sketchfabURLsProp.FindPropertyRelative("isDirty").boolValue = false; // - Images - SerializedProperty galleryImagesArray = galleryImagesProp.FindPropertyRelative("value"); galleryImagesArray.arraySize = profile.media.galleryImageLocators.Length; for (int i = 0; i < profile.media.galleryImageLocators.Length; ++i) { galleryImagesArray.GetArrayElementAtIndex(i).FindPropertyRelative("fileName").stringValue = profile.media.galleryImageLocators[i].GetFileName(); galleryImagesArray.GetArrayElementAtIndex(i).FindPropertyRelative("url").stringValue = profile.media.galleryImageLocators[i].GetURL(); } galleryImagesProp.FindPropertyRelative("isDirty").boolValue = false; }