Boosters giving now auto-proceeds

This commit is contained in:
Michal Pikulski
2025-12-19 16:46:30 +01:00
parent f19f87ce95
commit d1c7cc9645
2 changed files with 16 additions and 170 deletions

View File

@@ -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}

View File

@@ -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);
}
}
/// <summary>
@@ -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();