diff --git a/Assets/Editor/CardSystem/CardSystemLivePreview.cs b/Assets/Editor/CardSystem/CardSystemLivePreview.cs index 6bb72118..d8acb541 100644 --- a/Assets/Editor/CardSystem/CardSystemLivePreview.cs +++ b/Assets/Editor/CardSystem/CardSystemLivePreview.cs @@ -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; diff --git a/Assets/Editor/Developer/StateMachineMigrationTool.cs b/Assets/Editor/Developer/StateMachineMigrationTool.cs index 8cbbd57e..5ae5a03f 100644 --- a/Assets/Editor/Developer/StateMachineMigrationTool.cs +++ b/Assets/Editor/Developer/StateMachineMigrationTool.cs @@ -181,7 +181,7 @@ namespace Editor string scenePath = AssetDatabase.GUIDToAssetPath(guid); var scene = EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Additive); - var allComponents = GameObject.FindObjectsOfType(true); + var allComponents = GameObject.FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None); foreach (var component in allComponents) { if (component == null || component.gameObject.scene != scene) continue; diff --git a/Assets/Scripts/Cinematics/SkipCinematic.cs b/Assets/Scripts/Cinematics/SkipCinematic.cs index 2328f2ba..0135f773 100644 --- a/Assets/Scripts/Cinematics/SkipCinematic.cs +++ b/Assets/Scripts/Cinematics/SkipCinematic.cs @@ -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 diff --git a/Assets/Scripts/Core/ItemManager.cs b/Assets/Scripts/Core/ItemManager.cs index a10edf2b..8c6e269b 100644 --- a/Assets/Scripts/Core/ItemManager.cs +++ b/Assets/Scripts/Core/ItemManager.cs @@ -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; } } diff --git a/Assets/Scripts/Data/CardSystem/CardSystemManager.cs b/Assets/Scripts/Data/CardSystem/CardSystemManager.cs index 54526f9d..01ecec84 100644 --- a/Assets/Scripts/Data/CardSystem/CardSystemManager.cs +++ b/Assets/Scripts/Data/CardSystem/CardSystemManager.cs @@ -40,7 +40,6 @@ namespace Data.CardSystem // Event callbacks using System.Action public event Action> OnBoosterOpened; public event Action OnCardCollected; - public event Action OnCardRarityUpgraded; public event Action OnBoosterCountChanged; public event Action OnPendingCardAdded; public event Action OnCardPlacedInAlbum; diff --git a/Assets/Scripts/Dialogue/DialogueComponent.cs b/Assets/Scripts/Dialogue/DialogueComponent.cs index 74879716..c84fe6fb 100644 --- a/Assets/Scripts/Dialogue/DialogueComponent.cs +++ b/Assets/Scripts/Dialogue/DialogueComponent.cs @@ -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; diff --git a/Assets/Scripts/Interactions/ItemSlot.cs b/Assets/Scripts/Interactions/ItemSlot.cs index 2ef93e49..2a12a251 100644 --- a/Assets/Scripts/Interactions/ItemSlot.cs +++ b/Assets/Scripts/Interactions/ItemSlot.cs @@ -68,8 +68,6 @@ namespace Interactions public event Action OnIncorrectItemSlotted; public UnityEvent onForbiddenItemSlotted; - // Native C# event alternative for code-only subscribers - public event Action OnForbiddenItemSlotted; public GameObject GetSlottedObject() { diff --git a/Assets/Scripts/Levels/MinigameSwitch.cs b/Assets/Scripts/Levels/MinigameSwitch.cs index 8f4e9f89..ed5b1754 100644 --- a/Assets/Scripts/Levels/MinigameSwitch.cs +++ b/Assets/Scripts/Levels/MinigameSwitch.cs @@ -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; /// @@ -48,8 +44,7 @@ namespace Levels internal override void OnManagedAwake() { base.OnManagedAwake(); - - switchActive = true; + if (iconRenderer == null) iconRenderer = GetComponent(); @@ -143,15 +138,7 @@ namespace Levels { return base.CanBeClicked() && isUnlocked; } - - /// - /// Setup: Prevent re-entry while interaction is in progress. - /// - protected override void OnInteractionStarted() - { - switchActive = false; - } - + /// /// Main interaction logic: Spawn menu and switch input mode. /// @@ -202,7 +189,7 @@ namespace Levels private void OnMenuCancel() { - switchActive = true; // Allow interaction again if cancelled + InputManager.Instance.SetInputMode(InputMode.GameAndUI); } diff --git a/Assets/Scripts/Movement/FollowerController.cs b/Assets/Scripts/Movement/FollowerController.cs index becbb889..6a40abfe 100644 --- a/Assets/Scripts/Movement/FollowerController.cs +++ b/Assets/Scripts/Movement/FollowerController.cs @@ -914,7 +914,7 @@ public class FollowerController : ManagedBehaviour /// public static FollowerController FindInstance() { - return FindObjectOfType(); + return FindFirstObjectByType(); } #endregion Save/Load Lifecycle Hooks diff --git a/Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs b/Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs index 2a9038f1..5998f090 100644 --- a/Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs +++ b/Assets/Scripts/UI/CardSystem/BoosterOpeningPage.cs @@ -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) { diff --git a/Assets/Scripts/UI/CardSystem/DragDrop/AlbumCardSlot.cs b/Assets/Scripts/UI/CardSystem/DragDrop/AlbumCardSlot.cs index 2ef8810f..e70e87f1 100644 --- a/Assets/Scripts/UI/CardSystem/DragDrop/AlbumCardSlot.cs +++ b/Assets/Scripts/UI/CardSystem/DragDrop/AlbumCardSlot.cs @@ -73,7 +73,7 @@ namespace UI.CardSystem albumCard.SetParentSlot(this); // Register with AlbumViewPage for enlarge/shrink handling - AlbumViewPage albumPage = FindObjectOfType(); + AlbumViewPage albumPage = FindFirstObjectByType(); if (albumPage != null) { albumPage.RegisterAlbumCard(albumCard); @@ -208,7 +208,7 @@ namespace UI.CardSystem } // Register with AlbumViewPage for enlarge/shrink handling - AlbumViewPage albumPage = FindObjectOfType(); + AlbumViewPage albumPage = FindFirstObjectByType(); 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 albumPage = FindFirstObjectByType(); 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 albumPage = FindFirstObjectByType(); if (albumPage != null) { albumPage.HideSlotPreview(this, previewCardDisplay.transform, () => diff --git a/Assets/Scripts/UI/CardSystem/FlippableCard.cs b/Assets/Scripts/UI/CardSystem/FlippableCard.cs index 8b31d610..94fb33c4 100644 --- a/Assets/Scripts/UI/CardSystem/FlippableCard.cs +++ b/Assets/Scripts/UI/CardSystem/FlippableCard.cs @@ -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); } diff --git a/Assets/Scripts/UI/CardSystem/MinigameBoosterGiver.cs b/Assets/Scripts/UI/CardSystem/MinigameBoosterGiver.cs index f7c11f5a..d218f276 100644 --- a/Assets/Scripts/UI/CardSystem/MinigameBoosterGiver.cs +++ b/Assets/Scripts/UI/CardSystem/MinigameBoosterGiver.cs @@ -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; diff --git a/Assets/Scripts/UI/DragAndDrop/Core/DraggableObject.cs b/Assets/Scripts/UI/DragAndDrop/Core/DraggableObject.cs index 8a66dab8..d762c7a0 100644 --- a/Assets/Scripts/UI/DragAndDrop/Core/DraggableObject.cs +++ b/Assets/Scripts/UI/DragAndDrop/Core/DraggableObject.cs @@ -346,7 +346,7 @@ namespace UI.DragAndDrop.Core protected virtual void FindAndSnapToSlot() { - SlotContainer[] containers = FindObjectsOfType(); + SlotContainer[] containers = FindObjectsByType(FindObjectsSortMode.None); DraggableSlot closestSlot = null; float closestDistance = float.MaxValue;