Add seeing mr Cement photos in the album

This commit is contained in:
Michal Pikulski
2025-12-15 15:24:17 +01:00
parent de02394198
commit f72b8f3cf5
20 changed files with 2194 additions and 230 deletions

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using AppleHills.Data.CardSystem;
using CardSystem.Controllers;
using Core;
using Data.CardSystem;
using Pixelplacement;
@@ -8,6 +9,7 @@ using UI.DragAndDrop.Core;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Serialization;
using Utils;
namespace UI.CardSystem
{
@@ -35,6 +37,11 @@ namespace UI.CardSystem
[SerializeField] private GameObject cardEnlargedBackdrop; // Backdrop to block interactions
[SerializeField] private Transform cardEnlargedContainer; // Container for enlarged cards (sits above backdrop)
[Header("Photo Gallery System")]
[SerializeField] private GameObject photoEnlargedBackdrop; // Backdrop for photo enlargement
[SerializeField] private Transform photoEnlargedContainer; // Container for enlarged photos
[SerializeField] private float photoAnimationDuration = 0.3f;
[Header("Booster Pack UI")]
[SerializeField] private GameObject[] boosterPackButtons;
[SerializeField] private BoosterOpeningPage boosterOpeningPage;
@@ -61,6 +68,13 @@ namespace UI.CardSystem
cardEnlargedContainer
);
private AlbumPhotoPageController _photoController;
private AlbumPhotoPageController PhotoController => _photoController ??= new AlbumPhotoPageController(
photoEnlargedBackdrop,
photoEnlargedContainer,
photoAnimationDuration
);
/// <summary>
/// Query method: Check if the book is currently flipping to a page.
/// Used by card states to know if they should wait before placing.
@@ -84,6 +98,12 @@ namespace UI.CardSystem
cardEnlargedBackdrop.SetActive(false);
}
// Hide photo backdrop initially
if (photoEnlargedBackdrop != null)
{
photoEnlargedBackdrop.SetActive(false);
}
// Set up exit button
if (exitButton != null)
{
@@ -283,6 +303,13 @@ namespace UI.CardSystem
Logging.Debug("[AlbumViewPage] Switched to UI-only input mode on first entry");
}
// Initialize photo controller if not already done
if (!PhotoController.IsInitialized)
{
PhotoController.Initialize();
Logging.Debug("[AlbumViewPage] Photo controller initialized");
}
// Only spawn pending cards if we're already on an album page (not the menu)
if (IsInAlbumProper())
{
@@ -305,6 +332,12 @@ namespace UI.CardSystem
// Clean up active pending cards to prevent duplicates on next opening
CleanupPendingCornerCards();
// Clean up photo controller
if (_photoController != null)
{
_photoController.Cleanup();
}
// Don't restore input mode here - only restore when actually exiting (in OnExitButtonClicked)
base.TransitionOut();
}
@@ -329,6 +362,12 @@ namespace UI.CardSystem
// Clean up any enlarged card state before closing
CleanupEnlargedCardState();
// Clean up photo controller
if (_photoController != null)
{
_photoController.Cleanup();
}
// Simple fade out animation
if (canvasGroup != null)
{
@@ -401,6 +440,34 @@ namespace UI.CardSystem
Enlarge.UnregisterCard(card);
}
#endregion
#region Photo Gallery System
/// <summary>
/// Refresh photos for a specific capture type after a new photo is taken
/// </summary>
public void RefreshPhotosForType(CaptureType captureType)
{
if (_photoController != null && _photoController.IsInitialized)
{
_photoController.RefreshPhotosForType(captureType);
Logging.Debug($"[AlbumViewPage] Refreshed photos for {captureType}");
}
}
/// <summary>
/// Get photo count for a specific capture type
/// </summary>
public int GetPhotoCount(CaptureType captureType)
{
if (_photoController != null && _photoController.IsInitialized)
{
return _photoController.GetPhotoCount(captureType);
}
return 0;
}
#endregion
/// <summary>