Hammer out some last flows of the booster opening page

This commit is contained in:
Michal Pikulski
2025-11-06 23:51:57 +01:00
parent fda67e4b92
commit debe70c9b1
7 changed files with 793 additions and 82 deletions

View File

@@ -13,6 +13,7 @@ namespace UI.CardSystem
[Header("References")]
[SerializeField] private Button openAlbumButton;
[SerializeField] private AlbumViewPage albumViewPage;
[SerializeField] private BoosterOpeningPage boosterOpeningPage;
private void Awake()
{
@@ -48,24 +49,41 @@ namespace UI.CardSystem
private void OnOpenAlbumClicked()
{
if (openAlbumButton != null)
if (UIPageController.Instance == null) return;
// Check if we're currently on the booster opening page
if (UIPageController.Instance.CurrentPage == boosterOpeningPage)
{
openAlbumButton.gameObject.SetActive(false);
// We're in booster opening page, pop back to album main page
UIPageController.Instance.PopPage();
}
else if (UIPageController.Instance.CurrentPage != albumViewPage)
{
// We're not in the album at all, open it
if (openAlbumButton != null)
{
openAlbumButton.gameObject.SetActive(false);
}
if (albumViewPage != null && UIPageController.Instance != null)
{
UIPageController.Instance.PushPage(albumViewPage);
if (albumViewPage != null)
{
UIPageController.Instance.PushPage(albumViewPage);
}
}
// If we're already on the album main page, do nothing
}
private void OnPageChanged(UIPage currentPage)
{
// If the album page is no longer active, show the button again
if (currentPage != albumViewPage && openAlbumButton != null)
{
openAlbumButton.gameObject.SetActive(true);
}
if (openAlbumButton == null) return;
// Show the button when:
// 1. We're on the booster opening page (acts as "back to album" button)
// 2. We're NOT on the album main page (acts as "open album" button)
// Hide the button only when we're on the album main page
bool shouldShowButton = currentPage == boosterOpeningPage || currentPage != albumViewPage;
openAlbumButton.gameObject.SetActive(shouldShowButton);
}
}
}