Setup booster page opening
This commit is contained in:
@@ -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
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// 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.
|
||||
// /// </summary>
|
||||
// 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<CardSystemTesterWindow>(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<CardAlbumUI>();
|
||||
//
|
||||
// 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<Button>();
|
||||
// if (backpackButton != null)
|
||||
// {
|
||||
// backpackButton.onClick.Invoke();
|
||||
// lastActionMessage = "Opened card menu via backpack click";
|
||||
// Logging.Debug($"[CardSystemTesterWindow] {lastActionMessage}");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// lastActionMessage = "Failed to find Button component on backpack icon";
|
||||
// Logging.Warning($"[CardSystemTesterWindow] {lastActionMessage}");
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// lastActionMessage = "BackpackIcon reference is null";
|
||||
// Logging.Warning($"[CardSystemTesterWindow] {lastActionMessage}");
|
||||
// }
|
||||
//
|
||||
// Repaint();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void OpenBoosterPack()
|
||||
// {
|
||||
// CardAlbumUI cardAlbumUI = GetCardAlbumUI();
|
||||
//
|
||||
// if (cardAlbumUI != null)
|
||||
// {
|
||||
// SimulateBackpackClick();
|
||||
// cardAlbumUI.OpenBoosterPack();
|
||||
// lastActionMessage = "Opening booster pack";
|
||||
// Logging.Debug($"[CardSystemTesterWindow] {lastActionMessage}");
|
||||
// RefreshDebugInfo();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void OpenAlbumView()
|
||||
// {
|
||||
// CardAlbumUI cardAlbumUI = GetCardAlbumUI();
|
||||
//
|
||||
// if (cardAlbumUI != null)
|
||||
// {
|
||||
// SimulateBackpackClick();
|
||||
// cardAlbumUI.OpenAlbumView();
|
||||
// lastActionMessage = "Opening album view";
|
||||
// Logging.Debug($"[CardSystemTesterWindow] {lastActionMessage}");
|
||||
// Repaint();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void GenerateRandomCards()
|
||||
// {
|
||||
// if (CardSystemManager.Instance != null)
|
||||
// {
|
||||
// int cardsAdded = 0;
|
||||
// List<CardDefinition> allDefinitions = CardSystemManager.Instance.GetAllCardDefinitions();
|
||||
//
|
||||
// if (allDefinitions.Count == 0)
|
||||
// {
|
||||
// lastActionMessage = "Error: No card definitions available";
|
||||
// Logging.Warning($"[CardSystemTesterWindow] {lastActionMessage}");
|
||||
// Repaint();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// for (int i = 0; i < cardsToGenerate; i++)
|
||||
// {
|
||||
// // Get a random card definition
|
||||
// CardDefinition randomDef = allDefinitions[Random.Range(0, allDefinitions.Count)];
|
||||
//
|
||||
// // Create a card data instance and add it to inventory
|
||||
// CardData newCard = randomDef.CreateCardData();
|
||||
// CardSystemManager.Instance.GetCardInventory().AddCard(newCard);
|
||||
// cardsAdded++;
|
||||
// }
|
||||
//
|
||||
// lastActionMessage = $"Generated {cardsAdded} random cards";
|
||||
// Logging.Debug($"[CardSystemTesterWindow] {lastActionMessage}");
|
||||
// RefreshDebugInfo();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// lastActionMessage = "Error: CardSystemManager instance not found!";
|
||||
// Debug.LogError("[CardSystemTesterWindow] " + lastActionMessage);
|
||||
// Repaint();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void ClearAllCards()
|
||||
// {
|
||||
// if (CardSystemManager.Instance != null)
|
||||
// {
|
||||
// int count = CardSystemManager.Instance.GetCardInventory().GetAllCards().Count;
|
||||
// CardSystemManager.Instance.GetCardInventory().ClearAllCards();
|
||||
// lastActionMessage = $"Cleared {count} cards from inventory";
|
||||
// Logging.Debug($"[CardSystemTesterWindow] {lastActionMessage}");
|
||||
// RefreshDebugInfo();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// lastActionMessage = "Error: CardSystemManager instance not found!";
|
||||
// Debug.LogError("[CardSystemTesterWindow] " + lastActionMessage);
|
||||
// Repaint();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public class CardSystemTesterWindow : EditorWindow
|
||||
{
|
||||
// Test Settings
|
||||
private int boosterPacksToAdd = 3;
|
||||
private int cardsToGenerate = 10;
|
||||
|
||||
// Debug Info
|
||||
private int currentBoosterCount;
|
||||
private int totalCardsInCollection;
|
||||
private string lastActionMessage = "";
|
||||
|
||||
// UI State
|
||||
private Vector2 scrollPosition;
|
||||
|
||||
[MenuItem("AppleHills/Card System Tester")]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
var window = GetWindow<CardSystemTesterWindow>(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)
|
||||
{
|
||||
RefreshDebugInfo();
|
||||
}
|
||||
else if (state == PlayModeStateChange.ExitingPlayMode)
|
||||
{
|
||||
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);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
else
|
||||
{
|
||||
lastActionMessage = "Error: CardSystemManager instance not found!";
|
||||
Debug.LogError("[CardSystemTesterWindow] " + lastActionMessage);
|
||||
Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateRandomCards()
|
||||
{
|
||||
if (CardSystemManager.Instance != null)
|
||||
{
|
||||
int cardsAdded = 0;
|
||||
List<CardDefinition> allDefinitions = CardSystemManager.Instance.GetAllCardDefinitions();
|
||||
|
||||
if (allDefinitions.Count == 0)
|
||||
{
|
||||
lastActionMessage = "Error: No card definitions available";
|
||||
Logging.Warning($"[CardSystemTesterWindow] {lastActionMessage}");
|
||||
Repaint();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < cardsToGenerate; i++)
|
||||
{
|
||||
// Get a random card definition
|
||||
CardDefinition randomDef = allDefinitions[Random.Range(0, allDefinitions.Count)];
|
||||
|
||||
// Create a card data instance and add it to inventory
|
||||
CardData newCard = randomDef.CreateCardData();
|
||||
CardSystemManager.Instance.GetCardInventory().AddCard(newCard);
|
||||
cardsAdded++;
|
||||
}
|
||||
|
||||
lastActionMessage = $"Generated {cardsAdded} random cards";
|
||||
Logging.Debug($"[CardSystemTesterWindow] {lastActionMessage}");
|
||||
RefreshDebugInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
lastActionMessage = "Error: CardSystemManager instance not found!";
|
||||
Debug.LogError("[CardSystemTesterWindow] " + lastActionMessage);
|
||||
Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearAllCards()
|
||||
{
|
||||
if (CardSystemManager.Instance != null)
|
||||
{
|
||||
int count = CardSystemManager.Instance.GetCardInventory().GetAllCards().Count;
|
||||
CardSystemManager.Instance.GetCardInventory().ClearAllCards();
|
||||
lastActionMessage = $"Cleared {count} cards from inventory";
|
||||
Logging.Debug($"[CardSystemTesterWindow] {lastActionMessage}");
|
||||
RefreshDebugInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
lastActionMessage = "Error: CardSystemManager instance not found!";
|
||||
Debug.LogError("[CardSystemTesterWindow] " + lastActionMessage);
|
||||
Repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
334
Assets/Prefabs/UI/Cards/BoosterNotifications.prefab
Normal file
334
Assets/Prefabs/UI/Cards/BoosterNotifications.prefab
Normal file
@@ -0,0 +1,334 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3555924788298046233
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2510839793683184596}
|
||||
- component: {fileID: 7931090856607470176}
|
||||
- component: {fileID: 3867938905670777662}
|
||||
m_Layer: 5
|
||||
m_Name: NotificationDot
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2510839793683184596
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3555924788298046233}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8243838592031101330}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7931090856607470176
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3555924788298046233}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3867938905670777662
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3555924788298046233}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 1454986794490068504, guid: dad47d8bcf29e4742803088801ae4b04, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &3813704348964656314
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8243838592031101330}
|
||||
m_Layer: 5
|
||||
m_Name: Container
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8243838592031101330
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3813704348964656314}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2510839793683184596}
|
||||
- {fileID: 912809337432025300}
|
||||
m_Father: {fileID: 4399514539281523652}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &4367103374191057909
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 912809337432025300}
|
||||
- component: {fileID: 2674835159736628855}
|
||||
- component: {fileID: 7140808185011848511}
|
||||
m_Layer: 5
|
||||
m_Name: BoosterCount
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &912809337432025300
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4367103374191057909}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8243838592031101330}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2674835159736628855
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4367103374191057909}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7140808185011848511
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4367103374191057909}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 1
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 40
|
||||
m_fontSizeBase: 40
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 1
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_TextWrappingMode: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 0
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_EmojiFallbackSupport: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &6686144552275602124
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4399514539281523652}
|
||||
- component: {fileID: 7701049314552813552}
|
||||
- component: {fileID: 6728421751561708195}
|
||||
m_Layer: 5
|
||||
m_Name: BoosterNotifications
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4399514539281523652
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6686144552275602124}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 8243838592031101330}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 37.5, y: 37.5}
|
||||
m_SizeDelta: {x: 75, y: 75}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!114 &7701049314552813552
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6686144552275602124}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5845ed3764635fe429b6f1063effdd8a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::AppleHills.UI.CardSystem.BoosterNotificationDot
|
||||
dotBackground: {fileID: 3555924788298046233}
|
||||
countText: {fileID: 7140808185011848511}
|
||||
hideWhenZero: 1
|
||||
useAnimation: 1
|
||||
textPrefix:
|
||||
textSuffix:
|
||||
textColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
useTween: 1
|
||||
pulseDuration: 0.3
|
||||
pulseScale: 1.2
|
||||
animator: {fileID: 0}
|
||||
animationTrigger: Update
|
||||
--- !u!95 &6728421751561708195
|
||||
Animator:
|
||||
serializedVersion: 7
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6686144552275602124}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 0}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_StabilizeFeet: 0
|
||||
m_AnimatePhysics: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorStateOnDisable: 0
|
||||
m_WriteDefaultValuesOnDisable: 0
|
||||
7
Assets/Prefabs/UI/Cards/BoosterNotifications.prefab.meta
Normal file
7
Assets/Prefabs/UI/Cards/BoosterNotifications.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd3f9527253841847a5a204072bec7bb
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -140,6 +140,81 @@ MonoBehaviour:
|
||||
selectedScale: 2
|
||||
normalScale: 1
|
||||
scaleTransitionDuration: 0.2
|
||||
--- !u!1 &1216465079156012345
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 350533035305033130}
|
||||
- component: {fileID: 8048204881213048739}
|
||||
- component: {fileID: 5738749057790084506}
|
||||
m_Layer: 5
|
||||
m_Name: GameObject
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &350533035305033130
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1216465079156012345}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 691082512065824864}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8048204881213048739
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1216465079156012345}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &5738749057790084506
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1216465079156012345}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 0.43137255}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &1661343575874124514
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -606,7 +681,7 @@ GameObject:
|
||||
- component: {fileID: 4655070334633964078}
|
||||
- component: {fileID: 982405227736437572}
|
||||
m_Layer: 5
|
||||
m_Name: Button (2)
|
||||
m_Name: Booster2
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -727,6 +802,76 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.AspectRatioFitter
|
||||
m_AspectMode: 1
|
||||
m_AspectRatio: 0.56378603
|
||||
--- !u!1 &5184507515108885408
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 691082512065824864}
|
||||
- component: {fileID: 3129206684028946970}
|
||||
- component: {fileID: 304904072851265091}
|
||||
m_Layer: 0
|
||||
m_Name: BoosterOpeningPage
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &691082512065824864
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5184507515108885408}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 350533035305033130}
|
||||
m_Father: {fileID: 8113036759791843642}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!225 &3129206684028946970
|
||||
CanvasGroup:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5184507515108885408}
|
||||
m_Enabled: 1
|
||||
m_Alpha: 1
|
||||
m_Interactable: 1
|
||||
m_BlocksRaycasts: 1
|
||||
m_IgnoreParentGroups: 0
|
||||
--- !u!114 &304904072851265091
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5184507515108885408}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 91691a5efb1346b5b34482dd8200c868, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::UI.CardSystem.BoosterOpeningPage
|
||||
PageName: Booster Opening Page
|
||||
transitionDuration: 0.3
|
||||
canvasGroup: {fileID: 3129206684028946970}
|
||||
closeButton: {fileID: 0}
|
||||
cardDisplayContainer: {fileID: 0}
|
||||
cardDisplayPrefab: {fileID: 0}
|
||||
cardRevealDelay: 0.5
|
||||
cardSpacing: 50
|
||||
--- !u!1 &5894929957585504571
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -962,7 +1107,8 @@ RectTransform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Children:
|
||||
- {fileID: 8268404978292125473}
|
||||
m_Father: {fileID: 8113036759791843642}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
@@ -1118,7 +1264,7 @@ GameObject:
|
||||
- component: {fileID: 3176006474186944314}
|
||||
- component: {fileID: 2938846613341841058}
|
||||
m_Layer: 5
|
||||
m_Name: Button
|
||||
m_Name: Booster3
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -1272,6 +1418,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5906828909529466605}
|
||||
- {fileID: 691082512065824864}
|
||||
- {fileID: 4472180225153869618}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -1371,7 +1518,7 @@ GameObject:
|
||||
- component: {fileID: 2682813042770983550}
|
||||
- component: {fileID: 7409731688398821684}
|
||||
m_Layer: 5
|
||||
m_Name: Button (1)
|
||||
m_Name: Booster1
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -1600,6 +1747,26 @@ PrefabInstance:
|
||||
propertyPath: exitButton
|
||||
value:
|
||||
objectReference: {fileID: 2193243227233893301}
|
||||
- target: {fileID: 2162084082982493373, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
propertyPath: boosterOpeningPage
|
||||
value:
|
||||
objectReference: {fileID: 304904072851265091}
|
||||
- target: {fileID: 2162084082982493373, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
propertyPath: boosterPackButtons.Array.size
|
||||
value: 3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2162084082982493373, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
propertyPath: 'boosterPackButtons.Array.data[0]'
|
||||
value:
|
||||
objectReference: {fileID: 9208173931017297427}
|
||||
- target: {fileID: 2162084082982493373, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
propertyPath: 'boosterPackButtons.Array.data[1]'
|
||||
value:
|
||||
objectReference: {fileID: 4385084760331272994}
|
||||
- target: {fileID: 2162084082982493373, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
propertyPath: 'boosterPackButtons.Array.data[2]'
|
||||
value:
|
||||
objectReference: {fileID: 8678042374005579956}
|
||||
- target: {fileID: 2432304785419660060, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
@@ -2003,3 +2170,105 @@ MonoBehaviour:
|
||||
selectedScale: 1.5
|
||||
normalScale: 1
|
||||
scaleTransitionDuration: 0.2
|
||||
--- !u!1001 &5742495987250154725
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 4472180225153869618}
|
||||
m_Modifications:
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_Pivot.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 75
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 75
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -164
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6686144552275602124, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: BoosterNotifications
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
--- !u!224 &8268404978292125473 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 4399514539281523652, guid: fd3f9527253841847a5a204072bec7bb, type: 3}
|
||||
m_PrefabInstance: {fileID: 5742495987250154725}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Pixelplacement;
|
||||
using Bootstrap;
|
||||
using Data.CardSystem;
|
||||
using Pixelplacement;
|
||||
using UI.Core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -7,13 +9,19 @@ namespace UI.CardSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// UI page for viewing the player's card collection in an album.
|
||||
/// Manages booster pack button visibility and opening flow.
|
||||
/// </summary>
|
||||
public class AlbumViewPage : UIPage
|
||||
{
|
||||
[Header("UI References")]
|
||||
[SerializeField] private CanvasGroup canvasGroup;
|
||||
[SerializeField] private Button exitButton;
|
||||
[SerializeField] private BookCurlPro.BookPro book;
|
||||
|
||||
[Header("Booster Pack UI")]
|
||||
[SerializeField] private GameObject[] boosterPackButtons;
|
||||
[SerializeField] private BoosterOpeningPage boosterOpeningPage;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// Make sure we have a CanvasGroup for transitions
|
||||
@@ -28,16 +36,73 @@ namespace UI.CardSystem
|
||||
exitButton.onClick.AddListener(OnExitButtonClicked);
|
||||
}
|
||||
|
||||
// Set up booster pack button listeners
|
||||
SetupBoosterButtonListeners();
|
||||
|
||||
// Register for post-boot initialization
|
||||
BootCompletionService.RegisterInitAction(InitializePostBoot);
|
||||
|
||||
// UI pages should start disabled
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void InitializePostBoot()
|
||||
{
|
||||
// Subscribe to CardSystemManager events
|
||||
if (CardSystemManager.Instance != null)
|
||||
{
|
||||
CardSystemManager.Instance.OnBoosterCountChanged += OnBoosterCountChanged;
|
||||
|
||||
// Update initial button visibility
|
||||
int initialCount = CardSystemManager.Instance.GetBoosterPackCount();
|
||||
UpdateBoosterButtons(initialCount);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupBoosterButtonListeners()
|
||||
{
|
||||
if (boosterPackButtons == null) return;
|
||||
|
||||
for (int i = 0; i < boosterPackButtons.Length; i++)
|
||||
{
|
||||
if (boosterPackButtons[i] == null) continue;
|
||||
|
||||
Button button = boosterPackButtons[i].GetComponent<Button>();
|
||||
if (button != null)
|
||||
{
|
||||
button.onClick.AddListener(OnBoosterButtonClicked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
// Unsubscribe from CardSystemManager
|
||||
if (CardSystemManager.Instance != null)
|
||||
{
|
||||
CardSystemManager.Instance.OnBoosterCountChanged -= OnBoosterCountChanged;
|
||||
}
|
||||
|
||||
// Clean up exit button
|
||||
if (exitButton != null)
|
||||
{
|
||||
exitButton.onClick.RemoveListener(OnExitButtonClicked);
|
||||
}
|
||||
|
||||
// Clean up booster button listeners
|
||||
if (boosterPackButtons != null)
|
||||
{
|
||||
foreach (var buttonObj in boosterPackButtons)
|
||||
{
|
||||
if (buttonObj == null) continue;
|
||||
|
||||
Button button = buttonObj.GetComponent<Button>();
|
||||
if (button != null)
|
||||
{
|
||||
button.onClick.RemoveListener(OnBoosterButtonClicked);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnExitButtonClicked()
|
||||
@@ -64,6 +129,34 @@ namespace UI.CardSystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBoosterCountChanged(int newCount)
|
||||
{
|
||||
UpdateBoosterButtons(newCount);
|
||||
}
|
||||
|
||||
private void UpdateBoosterButtons(int boosterCount)
|
||||
{
|
||||
if (boosterPackButtons == null || boosterPackButtons.Length == 0) return;
|
||||
|
||||
int visibleCount = Mathf.Min(boosterCount, boosterPackButtons.Length);
|
||||
|
||||
for (int i = 0; i < boosterPackButtons.Length; i++)
|
||||
{
|
||||
if (boosterPackButtons[i] != null)
|
||||
{
|
||||
boosterPackButtons[i].SetActive(i < visibleCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBoosterButtonClicked()
|
||||
{
|
||||
if (boosterOpeningPage != null && UIPageController.Instance != null)
|
||||
{
|
||||
UIPageController.Instance.PushPage(boosterOpeningPage);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void DoTransitionIn(System.Action onComplete)
|
||||
{
|
||||
// Simple fade in animation
|
||||
|
||||
225
Assets/Scripts/UI/CardSystem/BoosterNotificationDot.cs
Normal file
225
Assets/Scripts/UI/CardSystem/BoosterNotificationDot.cs
Normal file
@@ -0,0 +1,225 @@
|
||||
using Bootstrap;
|
||||
using Data.CardSystem;
|
||||
using Pixelplacement;
|
||||
using Pixelplacement.TweenSystem;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UI.CardSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages a notification dot that displays a count (e.g., booster packs)
|
||||
/// Can be reused across different UI elements that need to show numeric notifications
|
||||
/// Automatically syncs with CardSystemManager to display booster pack count
|
||||
/// </summary>
|
||||
public class BoosterNotificationDot : MonoBehaviour
|
||||
{
|
||||
[Header("UI References")]
|
||||
[SerializeField] private GameObject dotBackground;
|
||||
[SerializeField] private TextMeshProUGUI countText;
|
||||
|
||||
[Header("Settings")]
|
||||
[SerializeField] private bool hideWhenZero = true;
|
||||
[SerializeField] private bool useAnimation = false;
|
||||
[SerializeField] private string textPrefix = "";
|
||||
[SerializeField] private string textSuffix = "";
|
||||
[SerializeField] private Color textColor = Color.white;
|
||||
|
||||
[Header("Animation")]
|
||||
[SerializeField] private bool useTween = true;
|
||||
[SerializeField] private float pulseDuration = 0.3f;
|
||||
[SerializeField] private float pulseScale = 1.2f;
|
||||
|
||||
// Optional animator reference
|
||||
[SerializeField] private Animator animator;
|
||||
[SerializeField] private string animationTrigger = "Update";
|
||||
|
||||
// Current count value
|
||||
private int _currentCount;
|
||||
private Vector3 _originalScale;
|
||||
|
||||
private TweenBase _activeTween;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// Store original scale for pulse animation
|
||||
if (dotBackground != null)
|
||||
{
|
||||
_originalScale = dotBackground.transform.localScale;
|
||||
}
|
||||
|
||||
// Apply text color
|
||||
if (countText != null)
|
||||
{
|
||||
countText.color = textColor;
|
||||
}
|
||||
|
||||
// Register for post-boot initialization
|
||||
BootCompletionService.RegisterInitAction(InitializePostBoot);
|
||||
}
|
||||
|
||||
private void InitializePostBoot()
|
||||
{
|
||||
// Subscribe to CardSystemManager events
|
||||
if (CardSystemManager.Instance != null)
|
||||
{
|
||||
CardSystemManager.Instance.OnBoosterCountChanged += OnBoosterCountChanged;
|
||||
|
||||
// Poll initial count and display it
|
||||
int initialCount = CardSystemManager.Instance.GetBoosterPackCount();
|
||||
SetCount(initialCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If CardSystemManager isn't available yet, set to default count
|
||||
SetCount(_currentCount);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
// Unsubscribe from CardSystemManager events to prevent memory leaks
|
||||
if (CardSystemManager.Instance != null)
|
||||
{
|
||||
CardSystemManager.Instance.OnBoosterCountChanged -= OnBoosterCountChanged;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback when booster count changes in CardSystemManager
|
||||
/// </summary>
|
||||
private void OnBoosterCountChanged(int newCount)
|
||||
{
|
||||
SetCount(newCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the count displayed on the notification dot
|
||||
/// Also handles visibility based on settings
|
||||
/// </summary>
|
||||
public void SetCount(int count)
|
||||
{
|
||||
bool countChanged = count != _currentCount;
|
||||
_currentCount = count;
|
||||
|
||||
// Update text
|
||||
if (countText != null)
|
||||
{
|
||||
countText.text = textPrefix + count.ToString() + textSuffix;
|
||||
}
|
||||
|
||||
// Handle visibility
|
||||
if (hideWhenZero)
|
||||
{
|
||||
SetVisibility(count > 0);
|
||||
}
|
||||
|
||||
// Play animation if value changed and animation is enabled
|
||||
if (countChanged && count > 0)
|
||||
{
|
||||
if (useAnimation)
|
||||
{
|
||||
Animate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current count value
|
||||
/// </summary>
|
||||
public int GetCount()
|
||||
{
|
||||
return _currentCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set text formatting options
|
||||
/// </summary>
|
||||
public void SetFormatting(string prefix, string suffix, Color color)
|
||||
{
|
||||
textPrefix = prefix;
|
||||
textSuffix = suffix;
|
||||
textColor = color;
|
||||
|
||||
if (countText != null)
|
||||
{
|
||||
countText.color = color;
|
||||
// Update text with new formatting
|
||||
countText.text = textPrefix + _currentCount.ToString() + textSuffix;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Explicitly control the notification dot visibility
|
||||
/// </summary>
|
||||
public void SetVisibility(bool isVisible)
|
||||
{
|
||||
if (dotBackground != null)
|
||||
{
|
||||
dotBackground.SetActive(isVisible);
|
||||
}
|
||||
|
||||
if (countText != null)
|
||||
{
|
||||
countText.gameObject.SetActive(isVisible);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show the notification dot
|
||||
/// </summary>
|
||||
public void Show()
|
||||
{
|
||||
SetVisibility(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hide the notification dot
|
||||
/// </summary>
|
||||
public void Hide()
|
||||
{
|
||||
SetVisibility(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play animation manually - either using Animator or Tween
|
||||
/// </summary>
|
||||
public void Animate()
|
||||
{
|
||||
if (useAnimation)
|
||||
{
|
||||
if (animator != null)
|
||||
{
|
||||
animator.SetTrigger(animationTrigger);
|
||||
}
|
||||
else if (useTween && dotBackground != null)
|
||||
{
|
||||
// Cancel any existing tweens on this transform
|
||||
if(_activeTween != null)
|
||||
_activeTween.Cancel();
|
||||
|
||||
// Reset to original scale
|
||||
dotBackground.transform.localScale = _originalScale;
|
||||
|
||||
// Pulse animation using Tween
|
||||
_activeTween = Tween.LocalScale(dotBackground.transform,
|
||||
_originalScale * pulseScale,
|
||||
pulseDuration/2,
|
||||
0,
|
||||
Tween.EaseOut,
|
||||
Tween.LoopType.None,
|
||||
null,
|
||||
() => {
|
||||
// Scale back to original size
|
||||
Tween.LocalScale(dotBackground.transform,
|
||||
_originalScale,
|
||||
pulseDuration/2,
|
||||
0,
|
||||
Tween.EaseIn);
|
||||
},
|
||||
obeyTimescale: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5845ed3764635fe429b6f1063effdd8a
|
||||
94
Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs
Normal file
94
Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AppleHills.Data.CardSystem;
|
||||
using Data.CardSystem;
|
||||
using Pixelplacement;
|
||||
using UI.Core;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI.CardSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// UI page for opening booster packs and displaying the cards received.
|
||||
/// Automatically triggers the opening when the page is shown.
|
||||
/// </summary>
|
||||
public class BoosterOpeningPage : UIPage
|
||||
{
|
||||
[Header("UI References")]
|
||||
[SerializeField] private CanvasGroup canvasGroup;
|
||||
[SerializeField] private Button closeButton;
|
||||
|
||||
[Header("Card Display")]
|
||||
[SerializeField] private Transform cardDisplayContainer;
|
||||
[SerializeField] private CardDisplay cardDisplayPrefab;
|
||||
|
||||
[Header("Settings")]
|
||||
[SerializeField] private float cardRevealDelay = 0.5f;
|
||||
[SerializeField] private float cardSpacing = 50f;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// Make sure we have a CanvasGroup for transitions
|
||||
if (canvasGroup == null)
|
||||
canvasGroup = GetComponent<CanvasGroup>();
|
||||
if (canvasGroup == null)
|
||||
canvasGroup = gameObject.AddComponent<CanvasGroup>();
|
||||
|
||||
// Set up close button
|
||||
if (closeButton != null)
|
||||
{
|
||||
closeButton.onClick.AddListener(OnCloseButtonClicked);
|
||||
}
|
||||
|
||||
// UI pages should start disabled
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (closeButton != null)
|
||||
{
|
||||
closeButton.onClick.RemoveListener(OnCloseButtonClicked);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCloseButtonClicked()
|
||||
{
|
||||
if (UIPageController.Instance != null)
|
||||
{
|
||||
UIPageController.Instance.PopPage();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void DoTransitionIn(System.Action onComplete)
|
||||
{
|
||||
// Simple fade in animation
|
||||
if (canvasGroup != null)
|
||||
{
|
||||
canvasGroup.alpha = 0f;
|
||||
Tween.Value(0f, 1f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete, obeyTimescale: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fallback if no CanvasGroup
|
||||
onComplete?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void DoTransitionOut(System.Action onComplete)
|
||||
{
|
||||
// Simple fade out animation
|
||||
if (canvasGroup != null)
|
||||
{
|
||||
Tween.Value(canvasGroup.alpha, 0f, (value) => canvasGroup.alpha = value, transitionDuration, 0f, Tween.EaseInOut, Tween.LoopType.None, null, onComplete, obeyTimescale: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fallback if no CanvasGroup
|
||||
onComplete?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3
Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs.meta
Normal file
3
Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91691a5efb1346b5b34482dd8200c868
|
||||
timeCreated: 1762418615
|
||||
Reference in New Issue
Block a user