From a9df9487f1cfc8832ce94d8e1600fb3f3bf78558 Mon Sep 17 00:00:00 2001 From: Michal Pikulski Date: Fri, 19 Dec 2025 16:02:47 +0100 Subject: [PATCH 1/5] Add boosters to card sorting --- Assets/Scenes/MiniGames/CardQualityControl.unity | 2 +- .../CardSorting/Controllers/SortingScoreController.cs | 5 +++-- .../Scripts/Minigames/CardSorting/Core/SortingGameManager.cs | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Assets/Scenes/MiniGames/CardQualityControl.unity b/Assets/Scenes/MiniGames/CardQualityControl.unity index 83637182..18fb12a8 100644 --- a/Assets/Scenes/MiniGames/CardQualityControl.unity +++ b/Assets/Scenes/MiniGames/CardQualityControl.unity @@ -939,7 +939,7 @@ GameObject: - component: {fileID: 818930088} m_Layer: 5 m_Name: MainCanvas - m_TagString: Untagged + m_TagString: MainCanvas m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 diff --git a/Assets/Scripts/Minigames/CardSorting/Controllers/SortingScoreController.cs b/Assets/Scripts/Minigames/CardSorting/Controllers/SortingScoreController.cs index 493c9da0..a35352e0 100644 --- a/Assets/Scripts/Minigames/CardSorting/Controllers/SortingScoreController.cs +++ b/Assets/Scripts/Minigames/CardSorting/Controllers/SortingScoreController.cs @@ -66,11 +66,12 @@ namespace Minigames.CardSorting.Controllers /// /// Calculate booster pack reward based on performance. + /// Formula: Number of correctly sorted cards divided by 10, rounded down. /// public int CalculateBoosterReward() { - // Simple: 1 booster per correct sort (or use settings multiplier) - return correctSorts * settings.BoosterPacksPerCorrectItem; + // Award 1 booster pack per 10 correctly sorted cards + return (correctSorts / 10) + 1; } /// diff --git a/Assets/Scripts/Minigames/CardSorting/Core/SortingGameManager.cs b/Assets/Scripts/Minigames/CardSorting/Core/SortingGameManager.cs index af78907d..00330500 100644 --- a/Assets/Scripts/Minigames/CardSorting/Core/SortingGameManager.cs +++ b/Assets/Scripts/Minigames/CardSorting/Core/SortingGameManager.cs @@ -325,10 +325,11 @@ namespace Minigames.CardSorting.Core private IEnumerator EndGameSequence() { - // Calculate rewards + // Calculate rewards based on correctly sorted cards int boosterReward = Score.CalculateBoosterReward(); + int sortedCards = Score.CorrectSorts; - Logging.Debug($"[SortingGameManager] Game ended! Score: {Score.TotalScore}, Boosters: {boosterReward}"); + Logging.Debug($"[SortingGameManager] Game ended! Score: {Score.TotalScore}, Cards sorted: {sortedCards}, Boosters: {boosterReward}"); // Show booster pack reward UI and wait for completion if (boosterReward > 0) From 5a5c379f1f6e73e09263e613d6e81ffaac559cf5 Mon Sep 17 00:00:00 2001 From: Michal Pikulski Date: Fri, 19 Dec 2025 16:26:46 +0100 Subject: [PATCH 2/5] Add score to FortFight, clean up the resets --- Assets/Scenes/MiniGames/FortFight.unity | 8 +- .../FortFight/Core/FortFightGameManager.cs | 125 +++++++++++++++++- .../Minigames/FortFight/UI/GameOverUI.cs | 11 +- 3 files changed, 131 insertions(+), 13 deletions(-) diff --git a/Assets/Scenes/MiniGames/FortFight.unity b/Assets/Scenes/MiniGames/FortFight.unity index 36be810c..7ba2d7b0 100644 --- a/Assets/Scenes/MiniGames/FortFight.unity +++ b/Assets/Scenes/MiniGames/FortFight.unity @@ -5529,7 +5529,7 @@ GameObject: - component: {fileID: 1156219949} m_Layer: 5 m_Name: MainCanvas - m_TagString: Untagged + m_TagString: MainCanvas m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 @@ -5613,7 +5613,7 @@ RectTransform: - {fileID: 1585033672} - {fileID: 805585728} m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: -0.079} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} @@ -8511,7 +8511,7 @@ Camera: far clip plane: 1000 field of view: 60 orthographic: 1 - orthographic size: 20 + orthographic size: 35 m_Depth: -1 m_CullingMask: serializedVersion: 2 @@ -8536,7 +8536,7 @@ Transform: m_GameObject: {fileID: 1810521056} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalPosition: {x: 0, y: 13.5999975, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/Assets/Scripts/Minigames/FortFight/Core/FortFightGameManager.cs b/Assets/Scripts/Minigames/FortFight/Core/FortFightGameManager.cs index e880e906..31c49a03 100644 --- a/Assets/Scripts/Minigames/FortFight/Core/FortFightGameManager.cs +++ b/Assets/Scripts/Minigames/FortFight/Core/FortFightGameManager.cs @@ -62,6 +62,7 @@ namespace Minigames.FortFight.Core private PlayerData playerTwo; private bool isGameActive = false; private float gameStartTime = 0f; + private float completionTime = 0f; // Store completion time when game ends public FortFightGameMode CurrentGameMode => currentGameMode; public bool IsGameActive => isGameActive; @@ -73,6 +74,11 @@ namespace Minigames.FortFight.Core { get { + if (!isGameActive && completionTime > 0f) + { + // Game ended, return the stored completion time + return completionTime; + } if (!isGameActive) return 0f; return Time.time - gameStartTime; } @@ -333,6 +339,8 @@ namespace Minigames.FortFight.Core return; } + // Store completion time before setting isGameActive to false + completionTime = Time.time - gameStartTime; isGameActive = false; // Stop turn manager @@ -341,12 +349,123 @@ namespace Minigames.FortFight.Core TurnManager.Instance.SetGameOver(); } - // Manage UI transitions - ShowGameOver(); + // Start the end game sequence (show boosters, then game over screen) + StartCoroutine(EndGameSequence()); OnGameEnded?.Invoke(); - Logging.Debug("[FortFightGameManager] Game ended"); + Logging.Debug($"[FortFightGameManager] Game ended - Duration: {completionTime:F2}s"); + } + + /// + /// End game sequence: award boosters, wait for completion, then show game over screen + /// + private System.Collections.IEnumerator EndGameSequence() + { + // Determine if player won + bool playerWon = DidPlayerWin(); + + // Calculate booster reward based on completion time and win/loss + int boosterReward = CalculateBoosterReward(completionTime, playerWon); + + string resultText = playerWon ? "WON" : "LOST"; + Logging.Debug($"[FortFightGameManager] Game completed in {completionTime:F2}s - Player {resultText}, awarding {boosterReward} booster pack(s)"); + + // Show booster pack reward UI and wait for completion + if (boosterReward > 0) + { + Logging.Debug("[FortFightGameManager] Starting booster giver sequence via GameManager"); + + var task = GameManager.Instance.GiveBoosterPacksAsync(boosterReward); + + // Wait for the task to complete + while (!task.IsCompleted) + { + yield return null; + } + + // Check for exceptions + if (task.IsFaulted) + { + Logging.Warning($"[FortFightGameManager] Booster pack reward failed: {task.Exception?.GetBaseException().Message}"); + } + else + { + Logging.Debug("[FortFightGameManager] Booster giver sequence finished, proceeding to game over screen"); + } + } + else + { + Logging.Debug("[FortFightGameManager] No boosters to award, proceeding directly to game over screen"); + } + + // Now show game over screen + ShowGameOver(); + } + + /// + /// Determine if the player won the game + /// + private bool DidPlayerWin() + { + var fortManager = FortManager.Instance; + if (fortManager == null) + { + Logging.Warning("[FortFightGameManager] Cannot determine winner - FortManager not found"); + return false; + } + + bool playerDefeated = fortManager.PlayerFort?.IsDefeated ?? false; + bool enemyDefeated = fortManager.EnemyFort?.IsDefeated ?? false; + + // Player wins if enemy fort is defeated and player fort is not + return enemyDefeated && !playerDefeated; + } + + /// + /// Calculate booster pack reward based on completion time and game result. + /// + /// If player WON: + /// < 1min: 5 Booster Packs + /// < 3min: 4 Booster Packs + /// < 5min: 3 Booster Packs + /// < 7min: 2 Booster Packs + /// >= 7min: 1 Booster Pack + /// + /// If player LOST: + /// 1 Booster Pack (participation reward) + /// + private int CalculateBoosterReward(float timeInSeconds, bool playerWon) + { + // If player lost, give participation reward + if (!playerWon) + { + return 1; + } + + // If player won, calculate reward based on completion time + float minutes = timeInSeconds / 60f; + + if (minutes < 1f) + { + return 5; + } + else if (minutes < 3f) + { + return 4; + } + else if (minutes < 5f) + { + return 3; + } + else if (minutes < 7f) + { + return 2; + } + else + { + return 1; + } } /// diff --git a/Assets/Scripts/Minigames/FortFight/UI/GameOverUI.cs b/Assets/Scripts/Minigames/FortFight/UI/GameOverUI.cs index 2f4b3087..278198f5 100644 --- a/Assets/Scripts/Minigames/FortFight/UI/GameOverUI.cs +++ b/Assets/Scripts/Minigames/FortFight/UI/GameOverUI.cs @@ -1,4 +1,5 @@ -using Core; +using System; +using Core; using Core.Lifecycle; using TMPro; using UnityEngine; @@ -220,12 +221,10 @@ namespace Minigames.FortFight.UI /// /// Restart the game by reloading the current scene /// - private void RestartGame() + private async void RestartGame() { - // Use Unity's SceneManager to reload current scene - string currentScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name; - Logging.Debug($"[GameOverUI] Reloading scene: {currentScene}"); - UnityEngine.SceneManagement.SceneManager.LoadScene(currentScene); + var progress = new Progress(p => Logging.Debug($"Loading progress: {p * 100:F0}%")); + await SceneManagerService.Instance.ReloadCurrentScene(progress); } #endregion From 24836038035f76055180db8359945ca939d4c0b5 Mon Sep 17 00:00:00 2001 From: MacBuilder Date: Fri, 19 Dec 2025 16:32:21 +0100 Subject: [PATCH 3/5] Fixed build error on mr cement --- Assets/Scripts/StateMachines/CementFactory/MrCementBehavior.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Assets/Scripts/StateMachines/CementFactory/MrCementBehavior.cs b/Assets/Scripts/StateMachines/CementFactory/MrCementBehavior.cs index d439fb4a..50b1e679 100644 --- a/Assets/Scripts/StateMachines/CementFactory/MrCementBehavior.cs +++ b/Assets/Scripts/StateMachines/CementFactory/MrCementBehavior.cs @@ -1,9 +1,6 @@ using AudioSourceEvents; -using Levels; using MoreMountains.Feedbacks; using System; -using System.Diagnostics.Tracing; -using UnityEditor.Animations; using UnityEngine; using UnityEngine.Audio; From f19f87ce95c5ff83c534df5b30746417f45ad8e4 Mon Sep 17 00:00:00 2001 From: Michal Pikulski Date: Fri, 19 Dec 2025 16:41:05 +0100 Subject: [PATCH 4/5] ADd booster pack reward sequence to bird pooper --- Assets/Scenes/MiniGames/BirdPoop.unity | 2 +- .../BirdPooper/BirdPooperGameManager.cs | 79 ++++++++++++++++++- .../Minigames/BirdPooper/GameOverScreen.cs | 12 +-- .../Minigames/BirdPooper/ScrollingEntity.cs | 24 +++++- 4 files changed, 103 insertions(+), 14 deletions(-) diff --git a/Assets/Scenes/MiniGames/BirdPoop.unity b/Assets/Scenes/MiniGames/BirdPoop.unity index ff542208..07979176 100644 --- a/Assets/Scenes/MiniGames/BirdPoop.unity +++ b/Assets/Scenes/MiniGames/BirdPoop.unity @@ -1691,7 +1691,7 @@ GameObject: - component: {fileID: 1536057437} m_Layer: 5 m_Name: MainCanvas - m_TagString: Untagged + m_TagString: MainCanvas m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 diff --git a/Assets/Scripts/Minigames/BirdPooper/BirdPooperGameManager.cs b/Assets/Scripts/Minigames/BirdPooper/BirdPooperGameManager.cs index 83a4f52e..bd4ba824 100644 --- a/Assets/Scripts/Minigames/BirdPooper/BirdPooperGameManager.cs +++ b/Assets/Scripts/Minigames/BirdPooper/BirdPooperGameManager.cs @@ -186,7 +186,7 @@ namespace Minigames.BirdPooper /// /// Called when player takes damage/dies. - /// Shows game over screen. + /// Pauses all game entities and starts end game sequence. /// private void HandlePlayerDamaged() { @@ -210,7 +210,65 @@ namespace Minigames.BirdPooper targetSpawner.StopSpawning(); } - // Show game over screen + // Pause all existing scrolling entities (obstacles and targets) + PauseAllScrollingEntities(); + + // Start the end game sequence (show boosters, then game over screen) + StartCoroutine(EndGameSequence()); + } + + /// + /// Pause all existing scrolling entities in the scene. + /// + private void PauseAllScrollingEntities() + { + ScrollingEntity[] entities = FindObjectsByType(FindObjectsSortMode.None); + foreach (ScrollingEntity entity in entities) + { + entity.Pause(); + } + Debug.Log($"[BirdPooperGameManager] Paused {entities.Length} scrolling entities"); + } + + /// + /// End game sequence: award boosters, wait for completion, then show game over screen. + /// + private System.Collections.IEnumerator EndGameSequence() + { + // Calculate booster reward + int boosterReward = CalculateBoosterReward(_targetsHit); + + Debug.Log($"[BirdPooperGameManager] Targets hit: {_targetsHit}, awarding {boosterReward} booster pack(s)"); + + // Show booster pack reward UI and wait for completion + if (boosterReward > 0) + { + Debug.Log("[BirdPooperGameManager] Starting booster giver sequence via GameManager"); + + var task = Core.GameManager.Instance.GiveBoosterPacksAsync(boosterReward); + + // Wait for the task to complete + while (!task.IsCompleted) + { + yield return null; + } + + // Check for exceptions + if (task.IsFaulted) + { + Debug.LogWarning($"[BirdPooperGameManager] Booster pack reward failed: {task.Exception?.GetBaseException().Message}"); + } + else + { + Debug.Log("[BirdPooperGameManager] Booster giver sequence finished, proceeding to game over screen"); + } + } + else + { + Debug.Log("[BirdPooperGameManager] No boosters to award, proceeding directly to game over screen"); + } + + // Now show game over screen if (gameOverScreen != null) { gameOverScreen.Show(); @@ -221,6 +279,23 @@ namespace Minigames.BirdPooper } } + /// + /// Calculate booster pack reward based on targets hit. + /// Rules: + /// - First booster pack is given for simply playing the game (participation reward) + /// - Every 3 hit targets gives 1 additional booster pack + /// + private int CalculateBoosterReward(int targetsHit) + { + // Base reward: 1 booster for participation + int reward = 1; + + // Additional reward: 1 booster per 3 targets hit + reward += targetsHit / 3; + + return reward; + } + /// /// Spawns a poop projectile at the player's current position. /// Called by UI button OnClick event. diff --git a/Assets/Scripts/Minigames/BirdPooper/GameOverScreen.cs b/Assets/Scripts/Minigames/BirdPooper/GameOverScreen.cs index a536dd22..75cfb26f 100644 --- a/Assets/Scripts/Minigames/BirdPooper/GameOverScreen.cs +++ b/Assets/Scripts/Minigames/BirdPooper/GameOverScreen.cs @@ -2,14 +2,12 @@ using UnityEngine; using UnityEngine.UI; using Core; -using UI; namespace Minigames.BirdPooper { /// /// Game over screen for Bird Pooper minigame. /// Displays when the player dies and allows restarting the level. - /// Uses unscaled time for UI updates (works when Time.timeScale = 0). /// public class GameOverScreen : MonoBehaviour { @@ -53,7 +51,7 @@ namespace Minigames.BirdPooper } /// - /// Show the game over screen and pause the game. + /// Show the game over screen. /// public void Show() { @@ -67,11 +65,7 @@ namespace Minigames.BirdPooper canvasGroup.blocksRaycasts = true; } - // Pause the game (set timescale to 0) - // PauseMenu uses unscaled time for tweens, so it will still work - Time.timeScale = 0f; - - Debug.Log("[GameOverScreen] Game Over - Time.timeScale set to 0"); + Debug.Log("[GameOverScreen] Game Over screen shown"); } /// @@ -89,8 +83,6 @@ namespace Minigames.BirdPooper } gameObject.SetActive(false); - // Reset time scale BEFORE reloading - Time.timeScale = 1f; var progress = new Progress(p => Logging.Debug($"Loading progress: {p * 100:F0}%")); await SceneManagerService.Instance.ReloadCurrentScene(progress); } diff --git a/Assets/Scripts/Minigames/BirdPooper/ScrollingEntity.cs b/Assets/Scripts/Minigames/BirdPooper/ScrollingEntity.cs index 1bd72e49..88854c46 100644 --- a/Assets/Scripts/Minigames/BirdPooper/ScrollingEntity.cs +++ b/Assets/Scripts/Minigames/BirdPooper/ScrollingEntity.cs @@ -21,6 +21,7 @@ namespace Minigames.BirdPooper protected IBirdPooperSettings settings; protected float despawnXPosition; protected bool isInitialized; + protected bool isPaused; protected EdgeAnchor edgeAnchor; /// @@ -191,12 +192,33 @@ namespace Minigames.BirdPooper protected virtual void Update() { - if (!isInitialized || settings == null) return; + if (!isInitialized || settings == null || isPaused) return; MoveLeft(); CheckBounds(); } + /// + /// Pause the scrolling movement of this entity. + /// + public void Pause() + { + isPaused = true; + } + + /// + /// Resume the scrolling movement of this entity. + /// + public void Resume() + { + isPaused = false; + } + + /// + /// Check if this entity is currently paused. + /// + public bool IsPaused => isPaused; + /// /// Move entity left at constant speed (manual movement, no physics). /// Override GetMoveSpeed() to customize speed per entity type. From d1c7cc96451feb133eead9d4b7f55c5be0ce27db Mon Sep 17 00:00:00 2001 From: Michal Pikulski Date: Fri, 19 Dec 2025 16:46:30 +0100 Subject: [PATCH 5/5] Boosters giving now auto-proceeds --- .../Boosters/MiniGameBoosterGiver.prefab | 131 +----------------- .../CardSystem/UI/MinigameBoosterGiver.cs | 55 ++------ 2 files changed, 16 insertions(+), 170 deletions(-) diff --git a/Assets/Prefabs/UI/CardsSystem/Boosters/MiniGameBoosterGiver.prefab b/Assets/Prefabs/UI/CardsSystem/Boosters/MiniGameBoosterGiver.prefab index ab934f6c..7203b098 100644 --- a/Assets/Prefabs/UI/CardsSystem/Boosters/MiniGameBoosterGiver.prefab +++ b/Assets/Prefabs/UI/CardsSystem/Boosters/MiniGameBoosterGiver.prefab @@ -55,7 +55,7 @@ MonoBehaviour: - {fileID: 5158233508174186704} - {fileID: 7317268573047108242} glowImage: {fileID: 4006246129058447062} - continueButton: {fileID: 2988510625873934392} + continueButton: {fileID: 0} hoverAmount: 20 hoverDuration: 1.5 glowPulseMax: 1.1 @@ -173,131 +173,11 @@ RectTransform: - {fileID: 3680365639323743419} m_Father: {fileID: 2499229096808986326} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 1} - m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: 0, y: -300} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 750, y: 760} - m_Pivot: {x: 0.5, y: 1} ---- !u!1 &4323719263405703996 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 6841858894429745291} - - component: {fileID: 1590188508543769496} - - component: {fileID: 4489841151491567959} - - component: {fileID: 2988510625873934392} - m_Layer: 0 - m_Name: Button - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &6841858894429745291 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4323719263405703996} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 2499229096808986326} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0} - m_AnchorMax: {x: 0.5, y: 0} - m_AnchoredPosition: {x: 0, y: 160} - m_SizeDelta: {x: 250, y: 250} - m_Pivot: {x: 0.5, y: 0} ---- !u!222 &1590188508543769496 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4323719263405703996} - m_CullTransparentMesh: 1 ---- !u!114 &4489841151491567959 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4323719263405703996} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 2636902231072113825, guid: ee014bd71cac2bc4ab845f435726f383, type: 3} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!114 &2988510625873934392 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4323719263405703996} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} - m_Name: - m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Button - m_Navigation: - m_Mode: 3 - m_WrapAround: 0 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 0} - m_SelectOnRight: {fileID: 0} - m_Transition: 1 - m_Colors: - m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_SelectedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_SelectedTrigger: Selected - m_DisabledTrigger: Disabled - m_Interactable: 1 - m_TargetGraphic: {fileID: 4489841151491567959} - m_OnClick: - m_PersistentCalls: - m_Calls: [] + m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &5931931042366245593 GameObject: m_ObjectHideFlags: 0 @@ -402,7 +282,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1338508664922812659} - - {fileID: 6841858894429745291} - {fileID: 5109945643968698326} m_Father: {fileID: 1966378914653314124} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/CardSystem/UI/MinigameBoosterGiver.cs b/Assets/Scripts/CardSystem/UI/MinigameBoosterGiver.cs index 943d5d2e..2a1d5e49 100644 --- a/Assets/Scripts/CardSystem/UI/MinigameBoosterGiver.cs +++ b/Assets/Scripts/CardSystem/UI/MinigameBoosterGiver.cs @@ -4,7 +4,6 @@ using Core; using Data.CardSystem; using Pixelplacement; using UnityEngine; -using UnityEngine.UI; namespace UI.CardSystem { @@ -21,7 +20,6 @@ namespace UI.CardSystem [SerializeField] private GameObject visualContainer; [SerializeField] private RectTransform[] boosterImages; // Up to 3 booster pack visuals [SerializeField] private RectTransform glowImage; // Single glow effect for all boosters - [SerializeField] private Button continueButton; [Header("Animation Settings")] [SerializeField] private float hoverAmount = 20f; @@ -34,6 +32,10 @@ namespace UI.CardSystem [SerializeField] private float tweenDuration = 0.8f; [SerializeField] private float delayBetweenTweens = 0.2f; [SerializeField] private float disappearScale = 0.2f; + + [Header("Auto-Proceed Settings")] + [Tooltip("Time in seconds to display boosters before automatically proceeding with animation")] + [SerializeField] private float autoProceedDelay = 1f; private Vector3[] _boosterInitialPositions; private Vector3[] _boosterInitialScales; @@ -75,12 +77,6 @@ namespace UI.CardSystem _glowInitialScale = glowImage.localScale; } - // Setup button listener - if (continueButton != null) - { - continueButton.onClick.AddListener(OnContinueClicked); - } - // Start hidden if (visualContainer != null) { @@ -118,11 +114,6 @@ namespace UI.CardSystem { Instance = null; } - - if (continueButton != null) - { - continueButton.onClick.RemoveListener(OnContinueClicked); - } } /// @@ -167,12 +158,6 @@ namespace UI.CardSystem glowImage.localScale = _glowInitialScale; } - // Enable the continue button - if (continueButton != null) - { - continueButton.interactable = true; - } - // Start idle hovering animation on all visible boosters (ping-pong) for (int i = 0; i < visualCount; i++) { @@ -190,26 +175,13 @@ namespace UI.CardSystem Tween.LocalScale(glowImage, glowPulseScale, glowPulseDuration, 0f, Tween.EaseOut, Tween.LoopType.PingPong); } - // Wait for button click (handled by OnContinueClicked) - yield return null; - } + // Wait for configured delay before auto-proceeding + Logging.Debug($"[MinigameBoosterGiver] Displaying boosters for {autoProceedDelay} seconds"); + yield return new WaitForSeconds(autoProceedDelay); - private void OnContinueClicked() - { - if (_currentSequence == null) - { - return; // Not in a sequence - } - - // Disable and hide button to prevent double-clicks - if (continueButton != null) - { - continueButton.interactable = false; - continueButton.gameObject.SetActive(false); - } - - // Start moving all boosters to backpack - StartCoroutine(MoveAllBoostersToBackpack()); + // Auto-proceed with animation + Logging.Debug("[MinigameBoosterGiver] Auto-proceeding with booster animation"); + yield return StartCoroutine(MoveAllBoostersToBackpack()); } private IEnumerator MoveAllBoostersToBackpack() @@ -301,12 +273,7 @@ namespace UI.CardSystem { visualContainer.SetActive(false); } - - // Show button again for next use - if (continueButton != null) - { - continueButton.gameObject.SetActive(true); - } + // Invoke completion callback _onCompleteCallback?.Invoke();