Finish setting up the basic album layout

This commit is contained in:
Michal Pikulski
2025-11-06 01:25:13 +01:00
parent 50c0a12391
commit b17ba7bd98
24 changed files with 4838 additions and 1829 deletions

View File

@@ -0,0 +1,72 @@
using UI.Core;
using UnityEngine;
using UnityEngine.UI;
namespace UI.CardSystem
{
/// <summary>
/// Opens the card album view when the button is pressed.
/// Attach this to a top-level GameObject in the scene.
/// </summary>
public class CardAlbumOpener : MonoBehaviour
{
[Header("References")]
[SerializeField] private Button openAlbumButton;
[SerializeField] private AlbumViewPage albumViewPage;
private void Awake()
{
if (openAlbumButton != null)
{
openAlbumButton.onClick.AddListener(OnOpenAlbumClicked);
}
}
private void Start()
{
if (UIPageController.Instance != null)
{
UIPageController.Instance.OnPageChanged += OnPageChanged;
}
}
private void OnDisable()
{
if (UIPageController.Instance != null)
{
UIPageController.Instance.OnPageChanged -= OnPageChanged;
}
}
private void OnDestroy()
{
if (openAlbumButton != null)
{
openAlbumButton.onClick.RemoveListener(OnOpenAlbumClicked);
}
}
private void OnOpenAlbumClicked()
{
if (openAlbumButton != null)
{
openAlbumButton.gameObject.SetActive(false);
}
if (albumViewPage != null && UIPageController.Instance != null)
{
UIPageController.Instance.PushPage(albumViewPage);
}
}
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);
}
}
}
}