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:
2026-07-25 19:42:26 +02:00
954 changed files with 999772 additions and 26193 deletions
+34 -1
View File
@@ -59,6 +59,7 @@ namespace Ashwild.UI
private class PendingNotification
{
public bool isDiscovery;
public bool isMessage;
public ItemData item;
public int signedQuantity;
public Sprite icon;
@@ -71,6 +72,7 @@ namespace Ashwild.UI
PlayerEvents.ItemDropped += OnItemDropped;
PlayerEvents.ItemConsumed += OnItemConsumed;
PlayerEvents.RecipeDiscovered += OnRecipeDiscovered;
PlayerEvents.InteractionRefused += OnInteractionRefused;
PlayerEvents.FoodPlacedToCook += OnItemSpent;
PlayerEvents.FuelAdded += OnItemSpent;
}
@@ -81,6 +83,7 @@ namespace Ashwild.UI
PlayerEvents.ItemDropped -= OnItemDropped;
PlayerEvents.ItemConsumed -= OnItemConsumed;
PlayerEvents.RecipeDiscovered -= OnRecipeDiscovered;
PlayerEvents.InteractionRefused -= OnInteractionRefused;
PlayerEvents.FoodPlacedToCook -= OnItemSpent;
PlayerEvents.FuelAdded -= OnItemSpent;
}
@@ -98,6 +101,7 @@ namespace Ashwild.UI
private void OnItemDropped(ItemData item, int quantity) => Push(item, -quantity);
private void OnItemConsumed(ItemData item) => Push(item, -1);
private void OnRecipeDiscovered(Sprite icon, string recipeName) => PushDiscovery(icon, recipeName);
private void OnInteractionRefused(string reason) => PushMessage(reason);
// Food placed on a cooking station or fuel fed to it both leave the inventory by one.
private void OnItemSpent(ItemData item) => Push(item, -1);
@@ -146,6 +150,33 @@ namespace Ashwild.UI
Enqueue(new PendingNotification { isDiscovery = true, icon = icon, label = recipeName });
}
/// <summary>
/// Enqueues a plain message telling the player why an interaction gave them nothing ("Inventory
/// full"). Collapses onto an identical message that is still on screen — spamming the interact key
/// against a full inventory must refresh one line, not stack ten of them — and is tinted with the
/// loss colour, since it always reports something the player did not get.
/// </summary>
private void PushMessage(string message)
{
if (string.IsNullOrEmpty(message)) return;
activeNotifications.RemoveAll(n => n == null);
for (int i = 0; i < activeNotifications.Count; i++)
{
if (activeNotifications[i] != null && activeNotifications[i].Message == message)
{
activeNotifications[i].RefreshMessage(displayDuration);
return;
}
}
foreach (PendingNotification pending in pendingQueue)
if (pending.isMessage && pending.label == message) return;
Enqueue(new PendingNotification { isMessage = true, label = message });
}
/// <summary>
/// Adds a pending notification to the queue, dropping the oldest waiting one when the queue is
/// full so the most recent notifications are never lost.
@@ -189,7 +220,9 @@ namespace Ashwild.UI
RectTransform rt = notification.RectTransform;
rt.anchoredPosition = new Vector2(0f, targetY - 30f);
if (pending.isDiscovery)
if (pending.isMessage)
notification.InitializeMessage(pending.label, lossColor, displayDuration, slideInDuration);
else if (pending.isDiscovery)
notification.InitializeDiscovery(pending.icon, pending.label, discoveryLabel, discoveryColor, displayDuration, slideInDuration);
else
notification.Initialize(pending.item, pending.signedQuantity, pending.signedQuantity > 0 ? gainColor : lossColor, displayDuration, slideInDuration, slideInEase);