From 88813fe8372bed0413100e730720469b62a898b3 Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Thu, 10 Oct 2024 10:13:54 +0800 Subject: [PATCH] =?UTF-8?q?Fixed=20an=20issue=20where=20items=20held=20in?= =?UTF-8?q?=20hand=20would=20not=20refresh=20when=20placing=20them=20in=20?= =?UTF-8?q?a=20selected=20slot.=20=E4=BF=AE=E5=A4=8D=E5=B0=86=E7=89=A9?= =?UTF-8?q?=E5=93=81=E6=94=BE=E5=88=B0=E5=B7=B2=E9=80=89=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E6=A7=BD=E4=BD=8D=E6=97=B6=EF=BC=8C=E6=89=8B=E4=B8=AD=E6=8C=81?= =?UTF-8?q?=E6=9C=89=E7=9A=84=E7=89=A9=E5=93=81=E6=B2=A1=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/inventory/UniversalItemContainer.cs | 14 +++++++++++++- scripts/map/miniMap/MiniMap.cs | 1 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/inventory/UniversalItemContainer.cs b/scripts/inventory/UniversalItemContainer.cs index 4bf48d2..5310c2f 100644 --- a/scripts/inventory/UniversalItemContainer.cs +++ b/scripts/inventory/UniversalItemContainer.cs @@ -169,7 +169,7 @@ public class UniversalItemContainer(int totalCapacity) : IItemContainer { NewItem = item, NewIndex = nextAvailableIndex, - Type = Config.ItemDataChangeEventType.QuantityAdded + Type = Config.ItemDataChangeEventType.Add }); return item.Quantity; } @@ -279,6 +279,18 @@ public class UniversalItemContainer(int totalCapacity) : IItemContainer OldItem = oldItem, Type = Config.ItemDataChangeEventType.Replace }); + if (SupportSelect && index == _selectIndex) + { + oldItem?.HideSelf(); + item.ShowSelf(); + SelectedItemChangeEvent?.Invoke(new SelectedItemChangeEvent + { + NewIndex = index, + OldIndex = index, + NewItem = item, + OldItem = oldItem + }); + } return true; } diff --git a/scripts/map/miniMap/MiniMap.cs b/scripts/map/miniMap/MiniMap.cs index fcf60b7..3d37191 100644 --- a/scripts/map/miniMap/MiniMap.cs +++ b/scripts/map/miniMap/MiniMap.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using ColdMint.scripts.debug; -using ColdMint.scripts.map.dateBean; using ColdMint.scripts.map.events; using ColdMint.scripts.map.preview; using ColdMint.scripts.map.room;