Working bottom-corner card display

This commit is contained in:
Michal Pikulski
2025-11-17 23:38:34 +01:00
parent b5364a2bbc
commit e18f1b9963
7 changed files with 49467 additions and 15232 deletions

View File

@@ -216,6 +216,13 @@ namespace Editor.CardSystem
EditorGUILayout.Space(5);
if (GUILayout.Button("Populate Pending (6 Unique Cards)", GUILayout.Height(30)))
{
PopulatePendingCards();
}
EditorGUILayout.Space(5);
// Danger Zone
EditorGUILayout.Space(10);
EditorGUILayout.LabelField("Danger Zone", EditorStyles.miniBoldLabel);
@@ -304,6 +311,53 @@ namespace Editor.CardSystem
}
}
private void PopulatePendingCards()
{
if (CardSystemManager.Instance != null)
{
List<CardDefinition> allDefinitions = CardSystemManager.Instance.GetAllCardDefinitions();
if (allDefinitions.Count == 0)
{
lastActionMessage = "Error: No card definitions available";
Logging.Warning($"[CardSystemTesterWindow] {lastActionMessage}");
Repaint();
return;
}
// Ensure we have enough definitions to pick 6 unique cards
int cardsToAdd = Mathf.Min(6, allDefinitions.Count);
// Shuffle definitions to get random unique cards
List<CardDefinition> shuffledDefs = new List<CardDefinition>(allDefinitions);
for (int i = 0; i < shuffledDefs.Count; i++)
{
int randomIndex = Random.Range(i, shuffledDefs.Count);
(shuffledDefs[i], shuffledDefs[randomIndex]) = (shuffledDefs[randomIndex], shuffledDefs[i]);
}
// Add first 6 unique cards to pending
// AddCardToInventoryDelayed automatically routes NEW cards to pending queue
int cardsAdded = 0;
for (int i = 0; i < cardsToAdd; i++)
{
CardData newCard = shuffledDefs[i].CreateCardData();
CardSystemManager.Instance.AddCardToInventoryDelayed(newCard);
cardsAdded++;
}
lastActionMessage = $"Added {cardsAdded} unique cards to pending reveal queue";
Logging.Debug($"[CardSystemTesterWindow] {lastActionMessage}");
RefreshDebugInfo();
}
else
{
lastActionMessage = "Error: CardSystemManager instance not found!";
Debug.LogError("[CardSystemTesterWindow] " + lastActionMessage);
Repaint();
}
}
private void ClearAllCards()
{
if (CardSystemManager.Instance != null)