diff --git a/Assets/Editor/CardSystem/CardSystemTesterWindow.cs b/Assets/Editor/CardSystem/CardSystemTesterWindow.cs index dcd960cd..e1c438b0 100644 --- a/Assets/Editor/CardSystem/CardSystemTesterWindow.cs +++ b/Assets/Editor/CardSystem/CardSystemTesterWindow.cs @@ -1,369 +1,267 @@ -// using UnityEditor; -// using UnityEngine; -// using AppleHills.Data.CardSystem; -// using Data.CardSystem; -// using Core; -// using UI.CardSystem; -// using UnityEngine.UI; -// using System.Collections.Generic; -// -// namespace Editor.CardSystem -// { -// /// -// /// Editor window for testing the Card System in play mode. -// /// Provides buttons to test core functionalities like adding booster packs, opening packs, and generating cards. -// /// -// public class CardSystemTesterWindow : EditorWindow -// { -// // Test Settings -// private int boosterPacksToAdd = 3; -// private int cardsToGenerate = 10; -// private bool autoOpenPacksWhenAdded = false; -// -// // Debug Info -// private int currentBoosterCount; -// private int totalCardsInCollection; -// private string lastActionMessage = ""; -// -// // UI State -// private Vector2 scrollPosition; -// private CardAlbumUI cachedCardAlbumUI; -// -// [MenuItem("AppleHills/Card System Tester")] -// public static void ShowWindow() -// { -// var window = GetWindow(false, "Card System Tester", true); -// window.minSize = new Vector2(400, 500); -// } -// -// private void OnEnable() -// { -// EditorApplication.playModeStateChanged += OnPlayModeStateChanged; -// } -// -// private void OnDisable() -// { -// EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; -// } -// -// private void OnPlayModeStateChanged(PlayModeStateChange state) -// { -// if (state == PlayModeStateChange.EnteredPlayMode) -// { -// cachedCardAlbumUI = null; -// RefreshDebugInfo(); -// } -// else if (state == PlayModeStateChange.ExitingPlayMode) -// { -// cachedCardAlbumUI = null; -// lastActionMessage = ""; -// } -// -// Repaint(); -// } -// -// private void OnGUI() -// { -// scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); -// -// // Header -// EditorGUILayout.Space(10); -// EditorGUILayout.LabelField("Card System Tester", EditorStyles.boldLabel); -// EditorGUILayout.HelpBox("This tool allows you to test the card system in play mode. " + -// "Enter play mode to enable the testing functions.", MessageType.Info); -// -// EditorGUILayout.Space(10); -// -// // Test Settings Section -// DrawTestSettings(); -// -// EditorGUILayout.Space(10); -// -// // Debug Info Section -// DrawDebugInfo(); -// -// EditorGUILayout.Space(10); -// -// // Test Actions Section -// DrawTestActions(); -// -// EditorGUILayout.EndScrollView(); -// } -// -// private void DrawTestSettings() -// { -// EditorGUILayout.LabelField("Test Settings", EditorStyles.boldLabel); -// -// EditorGUI.BeginDisabledGroup(!Application.isPlaying); -// -// boosterPacksToAdd = EditorGUILayout.IntSlider("Booster Packs to Add", boosterPacksToAdd, 1, 10); -// cardsToGenerate = EditorGUILayout.IntSlider("Cards to Generate", cardsToGenerate, 1, 100); -// autoOpenPacksWhenAdded = EditorGUILayout.Toggle("Auto-Open Packs When Added", autoOpenPacksWhenAdded); -// -// EditorGUI.EndDisabledGroup(); -// } -// -// private void DrawDebugInfo() -// { -// EditorGUILayout.LabelField("Debug Info", EditorStyles.boldLabel); -// -// if (Application.isPlaying) -// { -// EditorGUI.BeginDisabledGroup(true); -// EditorGUILayout.IntField("Current Booster Count", currentBoosterCount); -// EditorGUILayout.IntField("Total Cards in Collection", totalCardsInCollection); -// EditorGUI.EndDisabledGroup(); -// -// if (!string.IsNullOrEmpty(lastActionMessage)) -// { -// EditorGUILayout.Space(5); -// EditorGUILayout.HelpBox(lastActionMessage, MessageType.None); -// } -// -// EditorGUILayout.Space(5); -// if (GUILayout.Button("Refresh Debug Info")) -// { -// RefreshDebugInfo(); -// } -// } -// else -// { -// EditorGUILayout.HelpBox("Debug info available in play mode.", MessageType.Warning); -// } -// } -// -// private void DrawTestActions() -// { -// EditorGUILayout.LabelField("Test Actions", EditorStyles.boldLabel); -// -// if (!Application.isPlaying) -// { -// EditorGUILayout.HelpBox("Enter Play Mode to use these testing functions.", MessageType.Warning); -// return; -// } -// -// // Booster Pack Actions -// EditorGUILayout.Space(5); -// EditorGUILayout.LabelField("Booster Pack Actions", EditorStyles.miniBoldLabel); -// -// if (GUILayout.Button("Add Booster Packs", GUILayout.Height(30))) -// { -// AddBoosterPacks(); -// } -// -// if (GUILayout.Button("Open Card Menu", GUILayout.Height(30))) -// { -// SimulateBackpackClick(); -// } -// -// if (GUILayout.Button("Open Booster Pack", GUILayout.Height(30))) -// { -// OpenBoosterPack(); -// } -// -// if (GUILayout.Button("Open Album View", GUILayout.Height(30))) -// { -// OpenAlbumView(); -// } -// -// // Card Generation Actions -// EditorGUILayout.Space(10); -// EditorGUILayout.LabelField("Card Generation Actions", EditorStyles.miniBoldLabel); -// -// if (GUILayout.Button("Generate Random Cards", GUILayout.Height(30))) -// { -// GenerateRandomCards(); -// } -// -// EditorGUILayout.Space(5); -// -// // Danger Zone -// EditorGUILayout.Space(10); -// EditorGUILayout.LabelField("Danger Zone", EditorStyles.miniBoldLabel); -// -// GUI.backgroundColor = new Color(1f, 0.6f, 0.6f); -// if (GUILayout.Button("Clear All Cards", GUILayout.Height(30))) -// { -// if (EditorUtility.DisplayDialog("Clear All Cards", -// "Are you sure you want to clear all cards from the inventory? This cannot be undone in this play session.", -// "Clear All", "Cancel")) -// { -// ClearAllCards(); -// } -// } -// GUI.backgroundColor = Color.white; -// } -// -// // Refresh the debug information -// private void RefreshDebugInfo() -// { -// if (!Application.isPlaying) -// return; -// -// if (CardSystemManager.Instance != null) -// { -// currentBoosterCount = CardSystemManager.Instance.GetBoosterPackCount(); -// totalCardsInCollection = CardSystemManager.Instance.GetCardInventory().GetAllCards().Count; -// Repaint(); -// } -// } -// -// private CardAlbumUI GetCardAlbumUI() -// { -// if (cachedCardAlbumUI == null) -// { -// cachedCardAlbumUI = Object.FindAnyObjectByType(); -// -// if (cachedCardAlbumUI == null) -// { -// lastActionMessage = "Error: No CardAlbumUI found in the scene!"; -// Debug.LogError("[CardSystemTesterWindow] " + lastActionMessage); -// Repaint(); -// } -// } -// -// return cachedCardAlbumUI; -// } -// -// // Test Action Methods -// -// private void AddBoosterPacks() -// { -// if (CardSystemManager.Instance != null) -// { -// CardSystemManager.Instance.AddBoosterPack(boosterPacksToAdd); -// lastActionMessage = $"Added {boosterPacksToAdd} booster pack(s)"; -// Logging.Debug($"[CardSystemTesterWindow] {lastActionMessage}"); -// RefreshDebugInfo(); -// -// if (autoOpenPacksWhenAdded && GetCardAlbumUI() != null) -// { -// SimulateBackpackClick(); -// cachedCardAlbumUI.OpenBoosterPack(); -// } -// } -// else -// { -// lastActionMessage = "Error: CardSystemManager instance not found!"; -// Debug.LogError("[CardSystemTesterWindow] " + lastActionMessage); -// Repaint(); -// } -// } -// -// private void SimulateBackpackClick() -// { -// CardAlbumUI cardAlbumUI = GetCardAlbumUI(); -// -// if (cardAlbumUI != null) -// { -// if (cardAlbumUI.BackpackIcon != null) -// { -// Button backpackButton = cardAlbumUI.BackpackIcon.GetComponent