Fix the sound bird interactaiblity issues.

This commit is contained in:
Michal Pikulski
2025-11-24 11:41:47 +01:00
parent f0abc4760b
commit e33de5da3d
10 changed files with 252 additions and 341 deletions

View File

@@ -2,7 +2,6 @@
using UnityEditor;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace AppleHills.Core.Settings.Editor
{
@@ -164,23 +163,31 @@ namespace AppleHills.Core.Settings.Editor
EditorGUILayout.Space(10);
// Draw all properties
SerializedProperty property = serializedObj.GetIterator();
bool enterChildren = true;
while (property.NextVisible(enterChildren))
// Special handling for DebugSettings
if (settings is DebugSettings)
{
enterChildren = false;
// Skip the script field
if (property.name == "m_Script") continue;
// Group headers
if (property.isArray && property.propertyType == SerializedPropertyType.Generic)
DrawDebugSettingsEditor(serializedObj, settings as DebugSettings);
}
else
{
// Draw all properties for other settings types
SerializedProperty property = serializedObj.GetIterator();
bool enterChildren = true;
while (property.NextVisible(enterChildren))
{
EditorGUILayout.LabelField(property.displayName, EditorStyles.boldLabel);
enterChildren = false;
// Skip the script field
if (property.name == "m_Script") continue;
// Group headers
if (property.isArray && property.propertyType == SerializedPropertyType.Generic)
{
EditorGUILayout.LabelField(property.displayName, EditorStyles.boldLabel);
}
EditorGUILayout.PropertyField(property, true);
}
EditorGUILayout.PropertyField(property, true);
}
// Apply changes
@@ -196,6 +203,37 @@ namespace AppleHills.Core.Settings.Editor
}
}
private void DrawDebugSettingsEditor(SerializedObject serializedObj, DebugSettings debugSettings)
{
SerializedProperty property = serializedObj.GetIterator();
bool enterChildren = true;
bool useSaveLoadSystem = debugSettings.UseSaveLoadSystem;
while (property.NextVisible(enterChildren))
{
enterChildren = false;
// Skip the script field
if (property.name == "m_Script") continue;
// Check if this property should be disabled
bool shouldDisable = false;
if (!useSaveLoadSystem)
{
// Disable save-load related options when useSaveLoadSystem is false
if (property.name == "autoClearSaves" || property.name == "dontSaveOnQuit")
{
shouldDisable = true;
}
}
// Disable GUI for dependent fields
EditorGUI.BeginDisabledGroup(shouldDisable);
EditorGUILayout.PropertyField(property, true);
EditorGUI.EndDisabledGroup();
}
}
// Helper method to highlight important fields
private void DrawHighlightedProperty(SerializedProperty property, string tooltip = null)
{