Merge remote-tracking branch 'origin/feat/inport-props' into feat/craft-discovery
# Conflicts: # Assets/External/Animated PBR Chest Demo/Materials/WoodChest.mat # Packages/com.distantlands.cozy.core/Content/Integration/Import for BiRP.unitypackage.meta # Packages/com.distantlands.cozy.core/Content/Integration/Import for HDRP.unitypackage.meta # Packages/com.distantlands.cozy.core/Content/Integration/Import for URP.unitypackage.meta
This commit is contained in:
@@ -20,6 +20,7 @@ namespace Ashwild.UI
|
||||
private float hideTimer;
|
||||
private bool isHiding;
|
||||
private bool isDiscovery;
|
||||
private string message;
|
||||
|
||||
private Tweener fadeTween;
|
||||
private Tweener slideTween;
|
||||
@@ -34,6 +35,10 @@ namespace Ashwild.UI
|
||||
// A discovery notification (icon + name + "NEW" badge) never merges with a gain/loss one.
|
||||
public bool IsDiscovery => isDiscovery;
|
||||
|
||||
// The refusal text this notification shows, or null when it is not a message — used to collapse
|
||||
// repeats of the same reason onto the line already on screen.
|
||||
public string Message => message;
|
||||
|
||||
public void Initialize(ItemData item, int signedQuantity, Color numberColor, float displayDuration, float slideInDuration, Ease slideInEase)
|
||||
{
|
||||
itemData = item;
|
||||
@@ -81,6 +86,52 @@ namespace Ashwild.UI
|
||||
fadeTween = canvasGroup.DOFade(1f, slideInDuration).SetEase(Ease.OutQuad);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets up a plain message notification: a reason (e.g. "Inventory full") with no icon and no
|
||||
/// number, tinted by the caller. It carries no item, so it never merges with a gain/loss — a
|
||||
/// refusal is a one-off statement, not a running total.
|
||||
/// </summary>
|
||||
public void InitializeMessage(string text, Color messageColor, float displayDuration, float slideInDuration)
|
||||
{
|
||||
itemData = null;
|
||||
isDiscovery = true;
|
||||
message = text;
|
||||
hideTimer = displayDuration;
|
||||
isHiding = false;
|
||||
|
||||
if (iconImage != null)
|
||||
iconImage.gameObject.SetActive(false);
|
||||
|
||||
if (labelText != null)
|
||||
{
|
||||
labelText.text = text;
|
||||
labelText.color = messageColor;
|
||||
}
|
||||
|
||||
if (numberText != null)
|
||||
numberText.text = string.Empty;
|
||||
|
||||
canvasGroup.alpha = 0f;
|
||||
fadeTween = canvasGroup.DOFade(1f, slideInDuration).SetEase(Ease.OutQuad);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restarts the display timer of a message already on screen, so repeating the same refused
|
||||
/// action keeps one line alive instead of queueing a duplicate behind it.
|
||||
/// </summary>
|
||||
public void RefreshMessage(float displayDuration)
|
||||
{
|
||||
hideTimer = displayDuration;
|
||||
|
||||
if (isHiding)
|
||||
{
|
||||
isHiding = false;
|
||||
fadeTween?.Kill();
|
||||
slideTween?.Kill();
|
||||
canvasGroup.alpha = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddQuantity(int signedAmount, float displayDuration)
|
||||
{
|
||||
totalQuantity += signedAmount;
|
||||
|
||||
Reference in New Issue
Block a user