Updates to card testing scene
This commit is contained in:
committed by
Michal Pikulski
parent
4e7f774386
commit
755082c67d
@@ -19,10 +19,6 @@ namespace UI.CardSystem.Testing
|
||||
[SerializeField] private Card testCard;
|
||||
[SerializeField] private CardData testCardData;
|
||||
|
||||
[Header("Album Slots for Drag Testing")]
|
||||
[SerializeField] private AlbumCardSlot slot1;
|
||||
[SerializeField] private AlbumCardSlot slot2;
|
||||
|
||||
[Header("UI References")]
|
||||
[SerializeField] private TextMeshProUGUI eventLogText;
|
||||
[SerializeField] private Toggle isNewToggle;
|
||||
@@ -51,6 +47,10 @@ namespace UI.CardSystem.Testing
|
||||
_cardContext.OnCardInteractionComplete += OnCardInteractionComplete;
|
||||
_cardContext.OnUpgradeTriggered += OnCardUpgradeTriggered;
|
||||
}
|
||||
|
||||
// Subscribe to drag events to ensure card snaps back when released
|
||||
testCard.OnDragStarted += OnCardDragStarted;
|
||||
testCard.OnDragEnded += OnCardDragEnded;
|
||||
}
|
||||
|
||||
// Setup UI listeners
|
||||
@@ -118,12 +118,6 @@ namespace UI.CardSystem.Testing
|
||||
LogEvent("Transitioned to DraggingState");
|
||||
}
|
||||
|
||||
public void TransitionToPlacedInSlotState()
|
||||
{
|
||||
_cardContext?.StateMachine.ChangeState("PlacedInSlotState");
|
||||
LogEvent("Transitioned to PlacedInSlotState");
|
||||
}
|
||||
|
||||
public void TransitionToAlbumEnlargedState()
|
||||
{
|
||||
_cardContext?.StateMachine.ChangeState("AlbumEnlargedState");
|
||||
@@ -171,15 +165,15 @@ namespace UI.CardSystem.Testing
|
||||
LogEvent("Simulating UPGRADE flow (5/5) - click card to flip and auto-upgrade");
|
||||
}
|
||||
|
||||
public void SimulateAlbumPlacementFlow()
|
||||
public void TestDragAndSnap()
|
||||
{
|
||||
if (_cardContext == null) return;
|
||||
|
||||
_cardContext.IsNewCard = false;
|
||||
_cardContext.RepeatCardCount = 0;
|
||||
if (testCard == null) return;
|
||||
|
||||
// Enable dragging for the test
|
||||
testCard.SetDraggingEnabled(true);
|
||||
TransitionToRevealedState();
|
||||
LogEvent("Simulating ALBUM PLACEMENT - drag card to slot");
|
||||
|
||||
LogEvent("DRAG TEST enabled - drag the card and release to see it snap back");
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -318,6 +312,25 @@ namespace UI.CardSystem.Testing
|
||||
LogEvent($"Event: OnUpgradeTriggered - New Rarity={context.CardData?.Rarity}");
|
||||
}
|
||||
|
||||
private void OnCardDragStarted(UI.DragAndDrop.Core.DraggableObject draggable)
|
||||
{
|
||||
LogEvent("Event: OnDragStarted - Card is being dragged");
|
||||
}
|
||||
|
||||
private void OnCardDragEnded(UI.DragAndDrop.Core.DraggableObject draggable)
|
||||
{
|
||||
LogEvent("Event: OnDragEnded - Snapping card back to spawn point");
|
||||
|
||||
// Snap card back to original position (no slotting in test scene)
|
||||
if (testCard != null)
|
||||
{
|
||||
testCard.transform.position = _originalCardPosition;
|
||||
|
||||
// Return to idle state after drag
|
||||
TransitionToIdleState();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event Log
|
||||
@@ -379,6 +392,12 @@ namespace UI.CardSystem.Testing
|
||||
_cardContext.OnCardInteractionComplete -= OnCardInteractionComplete;
|
||||
_cardContext.OnUpgradeTriggered -= OnCardUpgradeTriggered;
|
||||
}
|
||||
|
||||
if (testCard != null)
|
||||
{
|
||||
testCard.OnDragStarted -= OnCardDragStarted;
|
||||
testCard.OnDragEnded -= OnCardDragEnded;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user