jukebox: ui item number fix, not accepting disc already there

This commit is contained in:
minjaesong
2024-01-14 11:33:56 +09:00
parent 5d03575ea1
commit 871396cd92
5 changed files with 41 additions and 53 deletions

View File

@@ -33,6 +33,7 @@ class UIJukeboxInventory(val parent: UIJukebox) : UICanvas() {
UIItemInventoryElemWide(this,
thisOffsetX, thisOffsetY + (UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap) * index,
6 * UIItemInventoryElemSimple.height + 5 * UIItemInventoryItemGrid.listGap,
showItemCount = false,
keyDownFun = { _, _, _, _, _ -> Unit },
touchDownFun = { _, _, _, _, _ -> Unit },
)
@@ -72,7 +73,8 @@ class UIJukeboxInventory(val parent: UIJukebox) : UICanvas() {
private val playerInventoryUI = UITemplateHalfInventory(this, false).also {
it.itemListTouchDownFun = { gameItem, _, _, _, _ ->
if (operatedByTheInstaller && parent.discInventory.size < SLOT_SIZE && gameItem != null) {
// accept disc but not duplicates
if (operatedByTheInstaller && parent.discInventory.size < SLOT_SIZE && gameItem != null && !parent.discInventory.contains(gameItem.dynamicID)) {
parent.discInventory.add(gameItem.dynamicID)
playerInventory.remove(gameItem)