REbase changes, update issues with BootCompletionService
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AppleHills.Data.CardSystem;
|
using AppleHills.Data.CardSystem;
|
||||||
using Bootstrap;
|
|
||||||
using Data.CardSystem;
|
using Data.CardSystem;
|
||||||
using Pixelplacement;
|
using Pixelplacement;
|
||||||
using UI.Core;
|
using UI.Core;
|
||||||
@@ -41,8 +40,10 @@ namespace UI.CardSystem
|
|||||||
private List<AlbumCardPlacementDraggable> _activeCards = new List<AlbumCardPlacementDraggable>();
|
private List<AlbumCardPlacementDraggable> _activeCards = new List<AlbumCardPlacementDraggable>();
|
||||||
private const int MAX_VISIBLE_CARDS = 3;
|
private const int MAX_VISIBLE_CARDS = 3;
|
||||||
|
|
||||||
private void Awake()
|
protected override void OnManagedAwake()
|
||||||
{
|
{
|
||||||
|
base.OnManagedAwake();
|
||||||
|
|
||||||
// Make sure we have a CanvasGroup for transitions
|
// Make sure we have a CanvasGroup for transitions
|
||||||
if (canvasGroup == null)
|
if (canvasGroup == null)
|
||||||
canvasGroup = GetComponent<CanvasGroup>();
|
canvasGroup = GetComponent<CanvasGroup>();
|
||||||
@@ -64,16 +65,7 @@ namespace UI.CardSystem
|
|||||||
// Set up booster pack button listeners
|
// Set up booster pack button listeners
|
||||||
SetupBoosterButtonListeners();
|
SetupBoosterButtonListeners();
|
||||||
|
|
||||||
// Register for post-boot initialization
|
// Subscribe to CardSystemManager events (managers are guaranteed to be initialized)
|
||||||
BootCompletionService.RegisterInitAction(InitializePostBoot);
|
|
||||||
|
|
||||||
// UI pages should start disabled
|
|
||||||
gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializePostBoot()
|
|
||||||
{
|
|
||||||
// Subscribe to CardSystemManager events
|
|
||||||
if (CardSystemManager.Instance != null)
|
if (CardSystemManager.Instance != null)
|
||||||
{
|
{
|
||||||
CardSystemManager.Instance.OnBoosterCountChanged += OnBoosterCountChanged;
|
CardSystemManager.Instance.OnBoosterCountChanged += OnBoosterCountChanged;
|
||||||
@@ -84,6 +76,9 @@ namespace UI.CardSystem
|
|||||||
int initialCount = CardSystemManager.Instance.GetBoosterPackCount();
|
int initialCount = CardSystemManager.Instance.GetBoosterPackCount();
|
||||||
UpdateBoosterButtons(initialCount);
|
UpdateBoosterButtons(initialCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UI pages should start disabled
|
||||||
|
gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetupBoosterButtonListeners()
|
private void SetupBoosterButtonListeners()
|
||||||
@@ -102,7 +97,7 @@ namespace UI.CardSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
protected override void OnDestroy()
|
||||||
{
|
{
|
||||||
// Unsubscribe from CardSystemManager
|
// Unsubscribe from CardSystemManager
|
||||||
if (CardSystemManager.Instance != null)
|
if (CardSystemManager.Instance != null)
|
||||||
@@ -134,6 +129,9 @@ namespace UI.CardSystem
|
|||||||
|
|
||||||
// Clean up active cards
|
// Clean up active cards
|
||||||
CleanupActiveCards();
|
CleanupActiveCards();
|
||||||
|
|
||||||
|
// Call base implementation
|
||||||
|
base.OnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnExitButtonClicked()
|
private void OnExitButtonClicked()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Bootstrap;
|
using Core.Lifecycle;
|
||||||
using Data.CardSystem;
|
using Data.CardSystem;
|
||||||
using Pixelplacement;
|
using Pixelplacement;
|
||||||
using Pixelplacement.TweenSystem;
|
using Pixelplacement.TweenSystem;
|
||||||
@@ -12,7 +12,7 @@ namespace UI.CardSystem
|
|||||||
/// Can be reused across different UI elements that need to show numeric notifications
|
/// Can be reused across different UI elements that need to show numeric notifications
|
||||||
/// Automatically syncs with CardSystemManager to display booster pack count
|
/// Automatically syncs with CardSystemManager to display booster pack count
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BoosterNotificationDot : MonoBehaviour
|
public class BoosterNotificationDot : ManagedBehaviour
|
||||||
{
|
{
|
||||||
[Header("UI References")]
|
[Header("UI References")]
|
||||||
[SerializeField] private GameObject dotBackground;
|
[SerializeField] private GameObject dotBackground;
|
||||||
@@ -40,8 +40,10 @@ namespace UI.CardSystem
|
|||||||
|
|
||||||
private TweenBase _activeTween;
|
private TweenBase _activeTween;
|
||||||
|
|
||||||
private void Awake()
|
protected override void OnManagedAwake()
|
||||||
{
|
{
|
||||||
|
base.OnManagedAwake();
|
||||||
|
|
||||||
// Store original scale for pulse animation
|
// Store original scale for pulse animation
|
||||||
if (dotBackground != null)
|
if (dotBackground != null)
|
||||||
{
|
{
|
||||||
@@ -54,13 +56,7 @@ namespace UI.CardSystem
|
|||||||
countText.color = textColor;
|
countText.color = textColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register for post-boot initialization
|
// Subscribe to CardSystemManager events (managers are guaranteed to be initialized)
|
||||||
BootCompletionService.RegisterInitAction(InitializePostBoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializePostBoot()
|
|
||||||
{
|
|
||||||
// Subscribe to CardSystemManager events
|
|
||||||
if (CardSystemManager.Instance != null)
|
if (CardSystemManager.Instance != null)
|
||||||
{
|
{
|
||||||
CardSystemManager.Instance.OnBoosterCountChanged += OnBoosterCountChanged;
|
CardSystemManager.Instance.OnBoosterCountChanged += OnBoosterCountChanged;
|
||||||
@@ -76,13 +72,16 @@ namespace UI.CardSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
protected override void OnDestroy()
|
||||||
{
|
{
|
||||||
// Unsubscribe from CardSystemManager events to prevent memory leaks
|
// Unsubscribe from CardSystemManager events to prevent memory leaks
|
||||||
if (CardSystemManager.Instance != null)
|
if (CardSystemManager.Instance != null)
|
||||||
{
|
{
|
||||||
CardSystemManager.Instance.OnBoosterCountChanged -= OnBoosterCountChanged;
|
CardSystemManager.Instance.OnBoosterCountChanged -= OnBoosterCountChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call base implementation
|
||||||
|
base.OnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user