Fixed an issue where items held in hand would not refresh when placing them in a selected slot.

修复将物品放到已选中的槽位时,手中持有的物品没刷新的问题。
This commit is contained in:
Cold-Mint 2024-10-10 10:13:54 +08:00
parent 9416993849
commit 88813fe837
Signed by: Cold-Mint
GPG Key ID: C5A9BF8A98E0CE99
2 changed files with 13 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;