Lifecycle System Refactor & Logging Centralization #56
@@ -71,7 +71,6 @@ namespace AppleHills.Editor
|
||||
{
|
||||
CardSystemManager.Instance.OnBoosterOpened += OnBoosterOpened;
|
||||
CardSystemManager.Instance.OnCardCollected += OnCardCollected;
|
||||
CardSystemManager.Instance.OnCardRarityUpgraded += OnCardRarityUpgraded;
|
||||
CardSystemManager.Instance.OnBoosterCountChanged += OnBoosterCountChanged;
|
||||
|
||||
isSubscribed = true;
|
||||
@@ -87,7 +86,6 @@ namespace AppleHills.Editor
|
||||
{
|
||||
CardSystemManager.Instance.OnBoosterOpened -= OnBoosterOpened;
|
||||
CardSystemManager.Instance.OnCardCollected -= OnCardCollected;
|
||||
CardSystemManager.Instance.OnCardRarityUpgraded -= OnCardRarityUpgraded;
|
||||
CardSystemManager.Instance.OnBoosterCountChanged -= OnBoosterCountChanged;
|
||||
}
|
||||
|
||||
@@ -109,13 +107,6 @@ namespace AppleHills.Editor
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnCardRarityUpgraded(CardData card)
|
||||
{
|
||||
lastEventMessage = $"Card upgraded: {card.Name} → {card.Rarity}!";
|
||||
RefreshData();
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnBoosterCountChanged(int count)
|
||||
{
|
||||
boosterCount = count;
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace Editor
|
||||
string scenePath = AssetDatabase.GUIDToAssetPath(guid);
|
||||
var scene = EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Additive);
|
||||
|
||||
var allComponents = GameObject.FindObjectsOfType<Component>(true);
|
||||
var allComponents = GameObject.FindObjectsByType<Component>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||
foreach (var component in allComponents)
|
||||
{
|
||||
if (component == null || component.gameObject.scene != scene) continue;
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace Cinematics
|
||||
private float _holdStartTime;
|
||||
private bool _isHolding;
|
||||
private bool _skipPerformed;
|
||||
private bool _initialized = false;
|
||||
|
||||
public override int ManagedAwakePriority => 180; // Cinematic UI
|
||||
|
||||
|
||||
@@ -142,7 +142,6 @@ namespace Core
|
||||
{
|
||||
s.OnCorrectItemSlotted -= ItemSlot_OnCorrectItemSlotted;
|
||||
s.OnIncorrectItemSlotted -= ItemSlot_OnIncorrectItemSlotted;
|
||||
s.OnForbiddenItemSlotted -= ItemSlot_OnForbiddenItemSlotted;
|
||||
s.OnItemSlotRemoved -= ItemSlot_OnItemSlotRemoved;
|
||||
}
|
||||
}
|
||||
@@ -189,7 +188,6 @@ namespace Core
|
||||
// Subscribe to all slot events
|
||||
slot.OnCorrectItemSlotted += ItemSlot_OnCorrectItemSlotted;
|
||||
slot.OnIncorrectItemSlotted += ItemSlot_OnIncorrectItemSlotted;
|
||||
slot.OnForbiddenItemSlotted += ItemSlot_OnForbiddenItemSlotted;
|
||||
slot.OnItemSlotRemoved += ItemSlot_OnItemSlotRemoved;
|
||||
}
|
||||
}
|
||||
@@ -202,7 +200,6 @@ namespace Core
|
||||
// Unsubscribe from all slot events
|
||||
slot.OnCorrectItemSlotted -= ItemSlot_OnCorrectItemSlotted;
|
||||
slot.OnIncorrectItemSlotted -= ItemSlot_OnIncorrectItemSlotted;
|
||||
slot.OnForbiddenItemSlotted -= ItemSlot_OnForbiddenItemSlotted;
|
||||
slot.OnItemSlotRemoved -= ItemSlot_OnItemSlotRemoved;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace Data.CardSystem
|
||||
// Event callbacks using System.Action
|
||||
public event Action<List<CardData>> OnBoosterOpened;
|
||||
public event Action<CardData> OnCardCollected;
|
||||
public event Action<CardData> OnCardRarityUpgraded;
|
||||
public event Action<int> OnBoosterCountChanged;
|
||||
public event Action<CardData> OnPendingCardAdded;
|
||||
public event Action<CardData> OnCardPlacedInAlbum;
|
||||
|
||||
@@ -184,8 +184,10 @@ namespace Dialogue
|
||||
return null;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
|
||||
// Unregister from events
|
||||
if (PuzzleManager.Instance != null)
|
||||
PuzzleManager.Instance.OnStepCompleted -= OnAnyPuzzleStepCompleted;
|
||||
|
||||
@@ -68,8 +68,6 @@ namespace Interactions
|
||||
public event Action<PickupItemData, PickupItemData> OnIncorrectItemSlotted;
|
||||
|
||||
public UnityEvent onForbiddenItemSlotted;
|
||||
// Native C# event alternative for code-only subscribers
|
||||
public event Action<PickupItemData, PickupItemData> OnForbiddenItemSlotted;
|
||||
|
||||
public GameObject GetSlottedObject()
|
||||
{
|
||||
|
||||
@@ -35,11 +35,7 @@ namespace Levels
|
||||
[SerializeField] private bool startUnlocked = false;
|
||||
|
||||
private SpriteRenderer iconRenderer;
|
||||
|
||||
// Settings reference
|
||||
private IInteractionSettings interactionSettings;
|
||||
|
||||
private bool switchActive = true;
|
||||
private bool isUnlocked;
|
||||
|
||||
/// <summary>
|
||||
@@ -48,8 +44,7 @@ namespace Levels
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
base.OnManagedAwake();
|
||||
|
||||
switchActive = true;
|
||||
|
||||
if (iconRenderer == null)
|
||||
iconRenderer = GetComponent<SpriteRenderer>();
|
||||
|
||||
@@ -143,15 +138,7 @@ namespace Levels
|
||||
{
|
||||
return base.CanBeClicked() && isUnlocked;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup: Prevent re-entry while interaction is in progress.
|
||||
/// </summary>
|
||||
protected override void OnInteractionStarted()
|
||||
{
|
||||
switchActive = false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Main interaction logic: Spawn menu and switch input mode.
|
||||
/// </summary>
|
||||
@@ -202,7 +189,7 @@ namespace Levels
|
||||
|
||||
private void OnMenuCancel()
|
||||
{
|
||||
switchActive = true; // Allow interaction again if cancelled
|
||||
|
||||
InputManager.Instance.SetInputMode(InputMode.GameAndUI);
|
||||
}
|
||||
|
||||
|
||||
@@ -914,7 +914,7 @@ public class FollowerController : ManagedBehaviour
|
||||
/// </summary>
|
||||
public static FollowerController FindInstance()
|
||||
{
|
||||
return FindObjectOfType<FollowerController>();
|
||||
return FindFirstObjectByType<FollowerController>();
|
||||
}
|
||||
|
||||
#endregion Save/Load Lifecycle Hooks
|
||||
|
||||
@@ -34,7 +34,6 @@ namespace UI.CardSystem
|
||||
[SerializeField] private float cardSpacing = 150f;
|
||||
|
||||
[Header("Settings")]
|
||||
[SerializeField] private float cardRevealDelay = 0.5f;
|
||||
[SerializeField] private float boosterDisappearDuration = 0.5f;
|
||||
[SerializeField] private CinemachineImpulseSource impulseSource;
|
||||
[SerializeField] private ParticleSystem openingParticleSystem;
|
||||
@@ -77,8 +76,10 @@ namespace UI.CardSystem
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
|
||||
// Unsubscribe from dismiss button
|
||||
if (_dismissButton != null)
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace UI.CardSystem
|
||||
albumCard.SetParentSlot(this);
|
||||
|
||||
// Register with AlbumViewPage for enlarge/shrink handling
|
||||
AlbumViewPage albumPage = FindObjectOfType<AlbumViewPage>();
|
||||
AlbumViewPage albumPage = FindFirstObjectByType<AlbumViewPage>();
|
||||
if (albumPage != null)
|
||||
{
|
||||
albumPage.RegisterAlbumCard(albumCard);
|
||||
@@ -208,7 +208,7 @@ namespace UI.CardSystem
|
||||
}
|
||||
|
||||
// Register with AlbumViewPage for enlarge/shrink handling
|
||||
AlbumViewPage albumPage = FindObjectOfType<AlbumViewPage>();
|
||||
AlbumViewPage albumPage = FindFirstObjectByType<AlbumViewPage>();
|
||||
if (albumPage != null)
|
||||
{
|
||||
albumPage.RegisterAlbumCard(albumCard);
|
||||
@@ -284,7 +284,7 @@ namespace UI.CardSystem
|
||||
previewCardDisplay.transform.localScale = _previewOriginalScale;
|
||||
|
||||
// Get AlbumViewPage to show backdrop and reparent
|
||||
AlbumViewPage albumPage = FindObjectOfType<AlbumViewPage>();
|
||||
AlbumViewPage albumPage = FindFirstObjectByType<AlbumViewPage>();
|
||||
if (albumPage != null)
|
||||
{
|
||||
albumPage.ShowSlotPreview(this, previewCardDisplay.transform);
|
||||
@@ -311,7 +311,7 @@ namespace UI.CardSystem
|
||||
previewCardDisplay.SetPreviewMode(false, null);
|
||||
|
||||
// Get AlbumViewPage to hide backdrop
|
||||
AlbumViewPage albumPage = FindObjectOfType<AlbumViewPage>();
|
||||
AlbumViewPage albumPage = FindFirstObjectByType<AlbumViewPage>();
|
||||
if (albumPage != null)
|
||||
{
|
||||
albumPage.HideSlotPreview(this, previewCardDisplay.transform, () =>
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace UI.CardSystem
|
||||
// State
|
||||
private bool _isFlipped = false;
|
||||
private bool _isFlipping = false;
|
||||
private bool _isHovering = false;
|
||||
private TweenBase _idleHoverTween;
|
||||
private CardData _cardData;
|
||||
private Vector2 _originalPosition; // Track original spawn position
|
||||
@@ -242,8 +241,6 @@ namespace UI.CardSystem
|
||||
if (_isFlipped || _isFlipping)
|
||||
return;
|
||||
|
||||
_isHovering = true;
|
||||
|
||||
// Scale up slightly on hover
|
||||
Tween.LocalScale(transform, Vector3.one * hoverScaleMultiplier, 0.2f, 0f, Tween.EaseOutBack);
|
||||
}
|
||||
@@ -253,8 +250,6 @@ namespace UI.CardSystem
|
||||
if (_isFlipped || _isFlipping)
|
||||
return;
|
||||
|
||||
_isHovering = false;
|
||||
|
||||
// Scale back to normal
|
||||
Tween.LocalScale(transform, Vector3.one, 0.2f, 0f, Tween.EaseOutBack);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace UI.CardSystem
|
||||
[Header("Animation Settings")]
|
||||
[SerializeField] private float hoverAmount = 20f;
|
||||
[SerializeField] private float hoverDuration = 1.5f;
|
||||
[SerializeField] private float glowPulseMin = 0.9f;
|
||||
[SerializeField] private float glowPulseMax = 1.1f;
|
||||
[SerializeField] private float glowPulseDuration = 1.2f;
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ namespace UI.DragAndDrop.Core
|
||||
|
||||
protected virtual void FindAndSnapToSlot()
|
||||
{
|
||||
SlotContainer[] containers = FindObjectsOfType<SlotContainer>();
|
||||
SlotContainer[] containers = FindObjectsByType<SlotContainer>(FindObjectsSortMode.None);
|
||||
DraggableSlot closestSlot = null;
|
||||
float closestDistance = float.MaxValue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user