Merge branch 'main' of https://homelab.tailf7f81b.ts.net/tschesky/AppleHillsProduction
This commit is contained in:
@@ -728,10 +728,18 @@ PrefabInstance:
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2162084082982493373, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
propertyPath: tabContainer
|
||||
value:
|
||||
objectReference: {fileID: 7104076737882304566}
|
||||
- target: {fileID: 2162084082982493373, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
propertyPath: boosterOpeningPage
|
||||
value:
|
||||
objectReference: {fileID: 304904072851265091}
|
||||
- target: {fileID: 2162084082982493373, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
propertyPath: zoneTabs.Array.size
|
||||
value: 6
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2162084082982493373, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
propertyPath: cardEnlargedBackdrop
|
||||
value:
|
||||
@@ -740,6 +748,10 @@ PrefabInstance:
|
||||
propertyPath: cardEnlargedContainer
|
||||
value:
|
||||
objectReference: {fileID: 8702856743180718180}
|
||||
- target: {fileID: 2162084082982493373, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
propertyPath: 'zoneTabs.Array.data[5]'
|
||||
value:
|
||||
objectReference: {fileID: 5733094729750047914}
|
||||
- target: {fileID: 2222053324174596529, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0
|
||||
@@ -1705,8 +1717,24 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
--- !u!114 &5733094729750047914 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 185814890104990467, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
m_PrefabInstance: {fileID: 5549612182461073321}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ff50caabb55742bc8d24a6ddffeda815, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::UI.CardSystem.BookTabButton
|
||||
--- !u!224 &5906828909529466605 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 2088943967680250180, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
m_PrefabInstance: {fileID: 5549612182461073321}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!224 &7104076737882304566 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 3428064805021480863, guid: 88a05fdd940194543ade1cc2bcdada5f, type: 3}
|
||||
m_PrefabInstance: {fileID: 5549612182461073321}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
||||
@@ -95,6 +95,7 @@ namespace AppleHills.Data.CardSystem
|
||||
|
||||
public enum CardZone
|
||||
{
|
||||
NotApplicable,
|
||||
AppleHills,
|
||||
Quarry,
|
||||
CementFactory,
|
||||
|
||||
@@ -24,7 +24,9 @@ namespace UI.CardSystem
|
||||
[SerializeField] private BookCurlPro.BookPro book;
|
||||
|
||||
[Header("Zone Navigation")]
|
||||
[SerializeField] private BookTabButton[] zoneTabs; // All zone tab buttons
|
||||
[SerializeField] private Transform tabContainer; // Container holding all BookTabButton children
|
||||
|
||||
private BookTabButton[] zoneTabs; // Discovered zone tab buttons
|
||||
|
||||
[Header("Album Card Reveal")]
|
||||
[SerializeField] private SlotContainer bottomRightSlots;
|
||||
@@ -46,6 +48,9 @@ namespace UI.CardSystem
|
||||
{
|
||||
base.OnManagedAwake();
|
||||
|
||||
// Discover zone tabs from container
|
||||
DiscoverZoneTabs();
|
||||
|
||||
// Make sure we have a CanvasGroup for transitions
|
||||
if (canvasGroup == null)
|
||||
canvasGroup = GetComponent<CanvasGroup>();
|
||||
@@ -67,6 +72,17 @@ namespace UI.CardSystem
|
||||
// Set up booster pack button listeners
|
||||
SetupBoosterButtonListeners();
|
||||
|
||||
// Subscribe to book page flip events
|
||||
if (book != null)
|
||||
{
|
||||
book.OnFlip.AddListener(OnPageFlipped);
|
||||
Debug.Log("[AlbumViewPage] Subscribed to book.OnFlip event");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[AlbumViewPage] Book reference is null, cannot subscribe to OnFlip event!");
|
||||
}
|
||||
|
||||
// Subscribe to CardSystemManager events (managers are guaranteed to be initialized)
|
||||
if (CardSystemManager.Instance != null)
|
||||
{
|
||||
@@ -83,6 +99,36 @@ namespace UI.CardSystem
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Discover all BookTabButton components from the tab container
|
||||
/// </summary>
|
||||
private void DiscoverZoneTabs()
|
||||
{
|
||||
if (tabContainer == null)
|
||||
{
|
||||
Debug.LogError("[AlbumViewPage] Tab container is not assigned! Cannot discover zone tabs.");
|
||||
zoneTabs = new BookTabButton[0];
|
||||
return;
|
||||
}
|
||||
|
||||
// Get all BookTabButton components from children
|
||||
zoneTabs = tabContainer.GetComponentsInChildren<BookTabButton>(includeInactive: false);
|
||||
|
||||
if (zoneTabs == null || zoneTabs.Length == 0)
|
||||
{
|
||||
Debug.LogWarning($"[AlbumViewPage] No BookTabButton components found in tab container '{tabContainer.name}'!");
|
||||
zoneTabs = new BookTabButton[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"[AlbumViewPage] Discovered {zoneTabs.Length} zone tabs from container '{tabContainer.name}'");
|
||||
foreach (var tab in zoneTabs)
|
||||
{
|
||||
Debug.Log($" - Tab: {tab.name}, Zone: {tab.Zone}, TargetPage: {tab.TargetPage}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupBoosterButtonListeners()
|
||||
{
|
||||
if (boosterPackButtons == null) return;
|
||||
@@ -90,6 +136,12 @@ namespace UI.CardSystem
|
||||
for (int i = 0; i < boosterPackButtons.Length; i++)
|
||||
{
|
||||
if (boosterPackButtons[i] == null) continue;
|
||||
// Unsubscribe from book events
|
||||
if (book != null)
|
||||
{
|
||||
book.OnFlip.RemoveListener(OnPageFlipped);
|
||||
}
|
||||
|
||||
|
||||
Button button = boosterPackButtons[i].GetComponent<Button>();
|
||||
if (button != null)
|
||||
@@ -217,8 +269,16 @@ namespace UI.CardSystem
|
||||
CardSystemManager.Instance.OnPendingCardAdded += OnPendingCardAdded;
|
||||
}
|
||||
|
||||
// Spawn pending cards when opening album
|
||||
SpawnPendingCards();
|
||||
// Only spawn pending cards if we're already on an album page (not the menu)
|
||||
if (IsInAlbumProper())
|
||||
{
|
||||
Debug.Log("[AlbumViewPage] Opening directly to album page - spawning cards immediately");
|
||||
SpawnPendingCards();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[AlbumViewPage] Opening to menu page - cards will spawn when entering album");
|
||||
}
|
||||
|
||||
base.TransitionIn();
|
||||
}
|
||||
@@ -307,6 +367,50 @@ namespace UI.CardSystem
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if we're currently viewing the album proper (not the menu page)
|
||||
/// </summary>
|
||||
private bool IsInAlbumProper()
|
||||
{
|
||||
if (book == null)
|
||||
{
|
||||
Debug.LogWarning("[AlbumViewPage] Book reference is null in IsInAlbumProper check");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Page 1 is the menu/cover, page 2+ are album pages with card slots
|
||||
bool inAlbum = book.CurrentPaper > 1;
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] IsInAlbumProper check - CurrentPage: {book.CurrentPaper}, InAlbum: {inAlbum}");
|
||||
return inAlbum;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when book page flips - show/hide pending cards based on whether we're in the album proper
|
||||
/// </summary>
|
||||
private void OnPageFlipped()
|
||||
{
|
||||
bool isInAlbum = IsInAlbumProper();
|
||||
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] OnPageFlipped - CurrentPage: {book.CurrentPaper}, IsInAlbum: {isInAlbum}, CardsCurrentlySpawned: {_activeCards.Count}");
|
||||
|
||||
if (isInAlbum && _activeCards.Count == 0)
|
||||
{
|
||||
// Entering album proper and no cards spawned yet - spawn them with animation
|
||||
Debug.Log("[AlbumViewPage] Entering album proper - spawning pending cards with animation");
|
||||
SpawnPendingCards();
|
||||
}
|
||||
else if (!isInAlbum && _activeCards.Count > 0)
|
||||
{
|
||||
// Returning to menu page - cleanup cards
|
||||
Debug.Log("[AlbumViewPage] Returning to menu page - cleaning up pending cards");
|
||||
CleanupActiveCards();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"[AlbumViewPage] Page flipped but no card state change needed (already in correct state)");
|
||||
}
|
||||
}
|
||||
|
||||
#region Album Card Reveal System
|
||||
|
||||
/// <summary>
|
||||
@@ -427,6 +531,7 @@ namespace UI.CardSystem
|
||||
private void OnCardRevealed(AlbumCardPlacementDraggable cardPlacement, CardData cardData)
|
||||
{
|
||||
Debug.Log($"[AlbumViewPage] Card revealed: {cardData.Name} (Zone: {cardData.Zone}, CopiesOwned: {cardData.CopiesOwned})");
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] OnCardRevealed - Card: {cardData.Name}, CardZone: {cardData.Zone}");
|
||||
|
||||
// IMMEDIATELY move card from pending to inventory upon reveal
|
||||
if (CardSystemManager.Instance != null)
|
||||
@@ -441,15 +546,19 @@ namespace UI.CardSystem
|
||||
// Check if we're currently viewing the correct zone for this card
|
||||
CardZone currentZone = GetCurrentZone();
|
||||
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Zone comparison - CurrentZone: {currentZone}, CardZone: {cardData.Zone}, Match: {currentZone == cardData.Zone}");
|
||||
|
||||
if (currentZone != cardData.Zone)
|
||||
{
|
||||
// Card is from a different zone - navigate to its zone
|
||||
Debug.Log($"[AlbumViewPage] Card zone ({cardData.Zone}) doesn't match current zone ({currentZone}). Navigating to card's zone...");
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] ZONE MISMATCH - Calling NavigateToZone({cardData.Zone})");
|
||||
NavigateToZone(cardData.Zone);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"[AlbumViewPage] Card zone ({cardData.Zone}) matches current zone - no navigation needed.");
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Zones match - skipping navigation");
|
||||
}
|
||||
|
||||
// Shuffle remaining cards to front and spawn next unique card
|
||||
@@ -547,22 +656,31 @@ namespace UI.CardSystem
|
||||
/// </summary>
|
||||
public CardZone GetCurrentZone()
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] GetCurrentZone() called");
|
||||
|
||||
if (book == null || zoneTabs == null || zoneTabs.Length == 0)
|
||||
{
|
||||
Debug.LogWarning($"[PAGE-NAV-DEBUG] GetCurrentZone - Missing references! book: {(book != null)}, zoneTabs: {(zoneTabs != null)}, zoneTabs.Length: {(zoneTabs != null ? zoneTabs.Length : 0)}");
|
||||
return CardZone.AppleHills; // Default
|
||||
}
|
||||
|
||||
int currentPage = book.CurrentPaper;
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Current book page: {currentPage}");
|
||||
|
||||
// Find tab with matching target page
|
||||
foreach (var tab in zoneTabs)
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Checking tab - Zone: {tab.Zone}, TargetPage: {tab.TargetPage}");
|
||||
if (tab.TargetPage == currentPage)
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Found matching tab! Zone: {tab.Zone}");
|
||||
return tab.Zone;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to first zone
|
||||
return zoneTabs[0].Zone;
|
||||
Debug.LogWarning($"[PAGE-NAV-DEBUG] No tab matched current page {currentPage}, falling back to first zone: {CardZone.NotApplicable}");
|
||||
return CardZone.NotApplicable;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -570,16 +688,27 @@ namespace UI.CardSystem
|
||||
/// </summary>
|
||||
public BookTabButton GetTabForZone(CardZone zone)
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] GetTabForZone({zone}) called");
|
||||
|
||||
if (zoneTabs == null)
|
||||
{
|
||||
Debug.LogError($"[PAGE-NAV-DEBUG] zoneTabs is NULL! Cannot find tab for zone {zone}");
|
||||
return null;
|
||||
}
|
||||
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Searching through {zoneTabs.Length} tabs for zone {zone}");
|
||||
|
||||
foreach (var tab in zoneTabs)
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Checking tab - Zone: {tab.Zone}, TargetPage: {tab.TargetPage}, Match: {tab.Zone == zone}");
|
||||
if (tab.Zone == zone)
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] FOUND matching tab for zone {zone}! TargetPage: {tab.TargetPage}");
|
||||
return tab;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.LogError($"[PAGE-NAV-DEBUG] NO TAB FOUND for zone {zone}! Navigation will fail.");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -588,11 +717,18 @@ namespace UI.CardSystem
|
||||
/// </summary>
|
||||
public void NavigateToZone(CardZone zone)
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] NavigateToZone({zone}) called");
|
||||
|
||||
BookTabButton tab = GetTabForZone(zone);
|
||||
if (tab != null)
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Tab found! Calling ActivateTab() on {tab.name}");
|
||||
tab.ActivateTab();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"[PAGE-NAV-DEBUG] NAVIGATION FAILED - No tab found for zone {zone}!");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -67,12 +67,17 @@ namespace UI.CardSystem
|
||||
|
||||
private void OnButtonClicked()
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] BookTabButton.OnButtonClicked() - Tab: {gameObject.name}, Zone: {zone}, TargetPage: {targetPage}");
|
||||
|
||||
if (book == null)
|
||||
{
|
||||
Debug.LogWarning($"[BookTabButton] No BookPro reference assigned on {gameObject.name}");
|
||||
Debug.LogError($"[PAGE-NAV-DEBUG] BOOK REFERENCE IS NULL! Cannot flip page.");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Book reference valid. Current book page: {book.CurrentPaper}");
|
||||
|
||||
// Notify all tabs that this one was clicked
|
||||
OnTabClicked?.Invoke(this);
|
||||
|
||||
@@ -80,11 +85,18 @@ namespace UI.CardSystem
|
||||
BookCurlPro.AutoFlip autoFlip = book.GetComponent<BookCurlPro.AutoFlip>();
|
||||
if (autoFlip == null)
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] AutoFlip component not found, adding new component");
|
||||
autoFlip = book.gameObject.AddComponent<BookCurlPro.AutoFlip>();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] AutoFlip component found, enabled: {autoFlip.enabled}");
|
||||
}
|
||||
|
||||
autoFlip.enabled = true;
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Calling autoFlip.StartFlipping({targetPage})");
|
||||
autoFlip.StartFlipping(targetPage);
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Page flip initiated to page {targetPage}");
|
||||
}
|
||||
|
||||
private void OnAnyTabClicked(BookTabButton clickedTab)
|
||||
@@ -116,6 +128,7 @@ namespace UI.CardSystem
|
||||
// Public method to programmatically trigger this tab
|
||||
public void ActivateTab()
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] ActivateTab() called on {gameObject.name} (Zone: {zone}, TargetPage: {targetPage})");
|
||||
OnButtonClicked();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,15 +63,24 @@ namespace UI.CardSystem
|
||||
/// </summary>
|
||||
public void RevealCard()
|
||||
{
|
||||
if (_isRevealed) return;
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] RevealCard() called - _isRevealed: {_isRevealed}");
|
||||
|
||||
if (_isRevealed)
|
||||
{
|
||||
Debug.LogWarning($"[PAGE-NAV-DEBUG] Card already revealed, skipping reveal");
|
||||
return;
|
||||
}
|
||||
|
||||
_isRevealed = true;
|
||||
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Setting _isRevealed = true, card zone: {(_cardData != null ? _cardData.Zone.ToString() : "NULL")}");
|
||||
|
||||
if (flippableCard != null)
|
||||
{
|
||||
flippableCard.FlipToReveal();
|
||||
}
|
||||
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Invoking OnCardRevealed event (subscribers: {(OnCardRevealed != null ? OnCardRevealed.GetInvocationList().Length : 0)})");
|
||||
OnCardRevealed?.Invoke(this, _cardData);
|
||||
}
|
||||
|
||||
@@ -199,9 +208,14 @@ namespace UI.CardSystem
|
||||
// Cancel hold timer if running
|
||||
if (_holdRevealCoroutine != null)
|
||||
{
|
||||
Debug.LogWarning($"[PAGE-NAV-DEBUG] OnPointerUpHook - CANCELLING HoldRevealTimer coroutine! Card was released before reveal completed.");
|
||||
StopCoroutine(_holdRevealCoroutine);
|
||||
_holdRevealCoroutine = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] OnPointerUpHook - No hold timer to cancel (either completed or never started)");
|
||||
}
|
||||
|
||||
// Handle tap (not dragged)
|
||||
if (!_wasDragged)
|
||||
@@ -243,15 +257,23 @@ namespace UI.CardSystem
|
||||
/// </summary>
|
||||
private IEnumerator HoldRevealTimer()
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] HoldRevealTimer started, waiting {holdRevealDelay}s...");
|
||||
yield return new WaitForSeconds(holdRevealDelay);
|
||||
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] HoldRevealTimer completed - _isRevealed: {_isRevealed}, _isHolding: {_isHolding}");
|
||||
|
||||
// If still holding after delay, reveal the card
|
||||
if (!_isRevealed && _isHolding)
|
||||
{
|
||||
Debug.Log($"[PAGE-NAV-DEBUG] Hold timer conditions met - calling RevealCard() for zone: {(_cardData != null ? _cardData.Zone.ToString() : "NULL")}");
|
||||
RevealCard();
|
||||
_isDragRevealing = true;
|
||||
Debug.Log("[AlbumCardDraggable] Card revealed via hold");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"[PAGE-NAV-DEBUG] Hold timer completed but conditions NOT met - _isRevealed: {_isRevealed}, _isHolding: {_isHolding}. Card will NOT reveal!");
|
||||
}
|
||||
|
||||
_holdRevealCoroutine = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user