diff --git a/Assets/Editor/CardSystem/CardEditorWindow.cs b/Assets/Editor/CardSystem/CardEditorWindow.cs index 79841020..545cb441 100644 --- a/Assets/Editor/CardSystem/CardEditorWindow.cs +++ b/Assets/Editor/CardSystem/CardEditorWindow.cs @@ -17,7 +17,7 @@ namespace Editor.CardSystem { // Paths private const string CardDefinitionsPath = "Assets/Data/Cards"; - private const string MenuPath = "AppleHills/Card Editor"; + private const string MenuPath = "AppleHills/Cards/Card Editor"; private const string CardUIPrefabPath = "Assets/Prefabs/UI/CardsSystem/Cards/Card.prefab"; private const string CardVisualConfigPath = CardDefinitionsPath + "/CardVisualConfig.asset"; diff --git a/Assets/Editor/CardSystem/CardSystemLivePreview.cs b/Assets/Editor/CardSystem/CardSystemLivePreview.cs index d1ecebde..6bb72118 100644 --- a/Assets/Editor/CardSystem/CardSystemLivePreview.cs +++ b/Assets/Editor/CardSystem/CardSystemLivePreview.cs @@ -25,7 +25,7 @@ namespace AppleHills.Editor private int boosterCount = 0; private string lastEventMessage = ""; - [MenuItem("Tools/Card System/Live Collection Preview")] + [MenuItem("AppleHills/Cards/Live Collection Preview")] public static void ShowWindow() { CardSystemLivePreview window = GetWindow("Card Collection Live"); diff --git a/Assets/Editor/CardSystem/CardSystemTesterWindow.cs b/Assets/Editor/CardSystem/CardSystemTesterWindow.cs index e1c438b0..f1c9bccf 100644 --- a/Assets/Editor/CardSystem/CardSystemTesterWindow.cs +++ b/Assets/Editor/CardSystem/CardSystemTesterWindow.cs @@ -19,6 +19,15 @@ namespace Editor.CardSystem private int boosterPacksToAdd = 3; private int cardsToGenerate = 10; + // Auto-add toggles (always editable) + private bool autoAddBoosters = false; + private bool autoAddCards = false; + + // Scheduling for delayed auto-add after entering play mode + private double scheduledAddTime = -1.0; + private bool scheduledBoosters = false; + private bool scheduledCards = false; + // Debug Info private int currentBoosterCount; private int totalCardsInCollection; @@ -27,7 +36,7 @@ namespace Editor.CardSystem // UI State private Vector2 scrollPosition; - [MenuItem("AppleHills/Card System Tester")] + [MenuItem("AppleHills/Cards/Card System Tester")] public static void ShowWindow() { var window = GetWindow(false, "Card System Tester", true); @@ -37,11 +46,13 @@ namespace Editor.CardSystem private void OnEnable() { EditorApplication.playModeStateChanged += OnPlayModeStateChanged; + EditorApplication.update += EditorUpdate; } private void OnDisable() { EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; + EditorApplication.update -= EditorUpdate; } private void OnPlayModeStateChanged(PlayModeStateChange state) @@ -49,15 +60,52 @@ namespace Editor.CardSystem if (state == PlayModeStateChange.EnteredPlayMode) { RefreshDebugInfo(); + + // Schedule auto-adds after 1 second if toggles are enabled + if (autoAddBoosters || autoAddCards) + { + scheduledAddTime = EditorApplication.timeSinceStartup + 1.0; + scheduledBoosters = autoAddBoosters; + scheduledCards = autoAddCards; + } } else if (state == PlayModeStateChange.ExitingPlayMode) { lastActionMessage = ""; + // clear any scheduled actions when leaving play mode + scheduledAddTime = -1.0; + scheduledBoosters = false; + scheduledCards = false; } Repaint(); } + // Polling update used to execute scheduled actions after a delay + private void EditorUpdate() + { + if (scheduledAddTime > 0 && EditorApplication.timeSinceStartup >= scheduledAddTime) + { + // perform scheduled actions + if (scheduledBoosters) + { + AddBoosterPacks(); + } + + if (scheduledCards) + { + GenerateRandomCards(); + } + + // clear schedule + scheduledAddTime = -1.0; + scheduledBoosters = false; + scheduledCards = false; + + Repaint(); + } + } + private void OnGUI() { scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); @@ -90,12 +138,23 @@ namespace Editor.CardSystem { EditorGUILayout.LabelField("Test Settings", EditorStyles.boldLabel); + // Booster pack slider with always-editable auto-add toggle + EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(!Application.isPlaying); - boosterPacksToAdd = EditorGUILayout.IntSlider("Booster Packs to Add", boosterPacksToAdd, 1, 10); - cardsToGenerate = EditorGUILayout.IntSlider("Cards to Generate", cardsToGenerate, 1, 100); - EditorGUI.EndDisabledGroup(); + GUILayout.FlexibleSpace(); + autoAddBoosters = EditorGUILayout.ToggleLeft("Auto Add", autoAddBoosters, GUILayout.Width(110)); + EditorGUILayout.EndHorizontal(); + + // Card generation slider with always-editable auto-add toggle + EditorGUILayout.BeginHorizontal(); + EditorGUI.BeginDisabledGroup(!Application.isPlaying); + cardsToGenerate = EditorGUILayout.IntSlider("Cards to Generate", cardsToGenerate, 1, 100); + EditorGUI.EndDisabledGroup(); + GUILayout.FlexibleSpace(); + autoAddCards = EditorGUILayout.ToggleLeft("Auto Add", autoAddCards, GUILayout.Width(110)); + EditorGUILayout.EndHorizontal(); } private void DrawDebugInfo() diff --git a/Assets/Editor/Developer.meta b/Assets/Editor/Developer.meta new file mode 100644 index 00000000..24cdf07e --- /dev/null +++ b/Assets/Editor/Developer.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 101d8cab829741d0bafb3512ff5ca313 +timeCreated: 1762504148 \ No newline at end of file diff --git a/Assets/Editor/RemoveInteractableBaseComponents.cs b/Assets/Editor/Developer/RemoveInteractableBaseComponents.cs similarity index 99% rename from Assets/Editor/RemoveInteractableBaseComponents.cs rename to Assets/Editor/Developer/RemoveInteractableBaseComponents.cs index a923ecf1..120d3da9 100644 --- a/Assets/Editor/RemoveInteractableBaseComponents.cs +++ b/Assets/Editor/Developer/RemoveInteractableBaseComponents.cs @@ -17,7 +17,7 @@ namespace Editor private bool hasScanned; private int componentsFound; - [MenuItem("AppleHills/Remove InteractableBase Components")] + [MenuItem("AppleHills/Developer/Remove InteractableBase Components")] public static void ShowWindow() { var window = GetWindow("Remove InteractableBase"); diff --git a/Assets/Editor/RemoveInteractableBaseComponents.cs.meta b/Assets/Editor/Developer/RemoveInteractableBaseComponents.cs.meta similarity index 100% rename from Assets/Editor/RemoveInteractableBaseComponents.cs.meta rename to Assets/Editor/Developer/RemoveInteractableBaseComponents.cs.meta diff --git a/Assets/Editor/RemoveOldInteractableReferences.cs b/Assets/Editor/Developer/RemoveOldInteractableReferences.cs similarity index 99% rename from Assets/Editor/RemoveOldInteractableReferences.cs rename to Assets/Editor/Developer/RemoveOldInteractableReferences.cs index cc287657..32298cac 100644 --- a/Assets/Editor/RemoveOldInteractableReferences.cs +++ b/Assets/Editor/Developer/RemoveOldInteractableReferences.cs @@ -12,7 +12,7 @@ namespace Editor private Vector2 scrollPosition; private bool hasScanned = false; - [MenuItem("AppleHills/Remove Old Interactable References")] + [MenuItem("AppleHills/Developer/Remove Old Interactable References")] public static void ShowWindow() { var window = GetWindow("Clean Old Interactables"); diff --git a/Assets/Editor/RemoveOldInteractableReferences.cs.meta b/Assets/Editor/Developer/RemoveOldInteractableReferences.cs.meta similarity index 100% rename from Assets/Editor/RemoveOldInteractableReferences.cs.meta rename to Assets/Editor/Developer/RemoveOldInteractableReferences.cs.meta diff --git a/Assets/Editor/StateMachineMigrationTool.cs b/Assets/Editor/Developer/StateMachineMigrationTool.cs similarity index 99% rename from Assets/Editor/StateMachineMigrationTool.cs rename to Assets/Editor/Developer/StateMachineMigrationTool.cs index d3fe70c4..8cbbd57e 100644 --- a/Assets/Editor/StateMachineMigrationTool.cs +++ b/Assets/Editor/Developer/StateMachineMigrationTool.cs @@ -17,7 +17,7 @@ namespace Editor private bool showPrefabs = true; private bool showScenes = true; - [MenuItem("Tools/AppleHills/Migrate StateMachines to Saveable")] + [MenuItem("AppleHills/Developer/Migrate StateMachines to Saveable")] public static void ShowWindow() { var window = GetWindow("StateMachine Migration"); diff --git a/Assets/Editor/StateMachineMigrationTool.cs.meta b/Assets/Editor/Developer/StateMachineMigrationTool.cs.meta similarity index 100% rename from Assets/Editor/StateMachineMigrationTool.cs.meta rename to Assets/Editor/Developer/StateMachineMigrationTool.cs.meta diff --git a/Assets/Editor/Settings/DeveloperSettingsEditorWindow.cs b/Assets/Editor/Settings/DeveloperSettingsEditorWindow.cs index 96339675..0a29302f 100644 --- a/Assets/Editor/Settings/DeveloperSettingsEditorWindow.cs +++ b/Assets/Editor/Settings/DeveloperSettingsEditorWindow.cs @@ -15,7 +15,7 @@ namespace AppleHills.Core.Settings.Editor private Dictionary serializedSettingsObjects = new Dictionary(); private GUIStyle headerStyle; - [MenuItem("AppleHills/Developer Settings Editor")] + [MenuItem("AppleHills/Settings/Developer Settings Editor")] public static void ShowWindow() { GetWindow("Developer Settings"); diff --git a/Assets/Editor/Settings/SettingsEditorWindow.cs b/Assets/Editor/Settings/SettingsEditorWindow.cs index 70f9ebb3..a69eef05 100644 --- a/Assets/Editor/Settings/SettingsEditorWindow.cs +++ b/Assets/Editor/Settings/SettingsEditorWindow.cs @@ -15,7 +15,7 @@ namespace AppleHills.Core.Settings.Editor private Dictionary serializedSettingsObjects = new Dictionary(); private GUIStyle headerStyle; - [MenuItem("AppleHills/Settings Editor")] + [MenuItem("AppleHills/Settings/Settings Editor")] public static void ShowWindow() { GetWindow("Game Settings");