Move some tools for consistency, audo add feature for card debugger
This commit is contained in:
@@ -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";
|
||||
|
||||
|
||||
@@ -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<CardSystemLivePreview>("Card Collection Live");
|
||||
|
||||
@@ -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<CardSystemTesterWindow>(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()
|
||||
|
||||
3
Assets/Editor/Developer.meta
Normal file
3
Assets/Editor/Developer.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 101d8cab829741d0bafb3512ff5ca313
|
||||
timeCreated: 1762504148
|
||||
@@ -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<RemoveInteractableBaseComponents>("Remove InteractableBase");
|
||||
@@ -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<RemoveOldInteractableReferences>("Clean Old Interactables");
|
||||
@@ -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<StateMachineMigrationTool>("StateMachine Migration");
|
||||
@@ -15,7 +15,7 @@ namespace AppleHills.Core.Settings.Editor
|
||||
private Dictionary<string, SerializedObject> serializedSettingsObjects = new Dictionary<string, SerializedObject>();
|
||||
private GUIStyle headerStyle;
|
||||
|
||||
[MenuItem("AppleHills/Developer Settings Editor")]
|
||||
[MenuItem("AppleHills/Settings/Developer Settings Editor")]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
GetWindow<DeveloperSettingsEditorWindow>("Developer Settings");
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace AppleHills.Core.Settings.Editor
|
||||
private Dictionary<string, SerializedObject> serializedSettingsObjects = new Dictionary<string, SerializedObject>();
|
||||
private GUIStyle headerStyle;
|
||||
|
||||
[MenuItem("AppleHills/Settings Editor")]
|
||||
[MenuItem("AppleHills/Settings/Settings Editor")]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
GetWindow<SettingsEditorWindow>("Game Settings");
|
||||
|
||||
Reference in New Issue
Block a user