Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ public void Activate()

public void Deactivate()
{
foreach (var presenter in slotPresenters)
presenter.ResetHoverState();

EndSlotBusy();
characterPreviewController.StopEmotes();
previewOutfitCommand.Restore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,13 @@ public class OutfitSlotPresenter : IDisposable
public event Action<OutfitItem>? OnEquipRequested;
public event Action<OutfitItem>? OnPreviewRequested;

public bool HasThumbnail()
{
return currentThumbnail != null;
}

public readonly int slotIndex;

private readonly OutfitSlotView view;
private readonly HoverHandler hoverHandler;
private readonly IAvatarScreenshotService screenshotService;
private CancellationTokenSource cts = new ();

private bool isHovered;
private bool isForcedHover;
private OutfitSlotState currentState;
Expand All @@ -67,16 +62,17 @@ public OutfitSlotPresenter( OutfitSlotView view,
view.OnDeleteClicked += HandleDeleteClicked;
view.OnEquipClicked += HandleEquipClicked;
view.OnPreviewClicked += HandlePreviewClicked;

hoverHandler = view.hoverHandler;
hoverHandler.OnHoverEntered += OnHoverEntered;
hoverHandler.OnHoverExited += OnHoverExited;
}

public OutfitItem? GetOutfitData()
{
return currentOutfitData;
}
public bool HasThumbnail() =>
currentThumbnail != null;

public OutfitItem? GetOutfitData() =>
currentOutfitData;

private void HandleSaveClicked()
{
Expand Down Expand Up @@ -176,6 +172,13 @@ public void SetEquipLoading(bool loading) =>
public void SetHoverEnabled(bool isEnabled) =>
view.SetHoverEnabled(isEnabled);

public void ResetHoverState()
{
isHovered = false;
view.ResetHoverState();
UpdateView();
}

private void SetState(OutfitSlotState newState, OutfitItem? item = null)
{
currentState = newState;
Expand All @@ -185,8 +188,8 @@ private void SetState(OutfitSlotState newState, OutfitItem? item = null)

private void UpdateView()
{
bool effectiveHover = isHovered || isForcedHover;
bool effectiveHover = isHovered || isForcedHover;

switch (currentState)
{
case OutfitSlotState.Empty: view.ShowEmptyState(isHovered); break;
Expand Down Expand Up @@ -275,4 +278,4 @@ public void PlaySaveOutfitSound()
view.PlaySaveOutfitSound();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,20 @@ public void SetHoverEnabled(bool isEnabled)
hoverHandler.enabled = isEnabled;
}

public void ResetHoverState()
{
cts?.SafeCancelAndDispose();
cts = null;

transform.localScale = Vector3.one;

if (outfitHoverOutline != null)
{
outfitHoverOutline.transform.localScale = Vector3.zero;
outfitHoverOutline.gameObject.SetActive(false);
}
}

private void ResetEquipButtonContent()
{
isEquipLoading = false;
Expand Down
Loading