mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 19:44:05 +09:00
storage chest compact mode buttons now work together
This commit is contained in:
@@ -93,6 +93,20 @@ internal class UIStorageChest : UICanvas(), HasInventory {
|
||||
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
||||
}
|
||||
|
||||
private fun setCompact(yes: Boolean) {
|
||||
itemListChest.isCompactMode = yes
|
||||
itemListChest.gridModeButtons[0].highlighted = !yes
|
||||
itemListChest.gridModeButtons[1].highlighted = yes
|
||||
itemListChest.itemPage = 0
|
||||
itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
||||
|
||||
itemListPlayer.isCompactMode = yes
|
||||
itemListPlayer.gridModeButtons[0].highlighted = !yes
|
||||
itemListPlayer.gridModeButtons[1].highlighted = yes
|
||||
itemListPlayer.itemPage = 0
|
||||
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
||||
}
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
if (!initialised) {
|
||||
initialised = true
|
||||
@@ -143,6 +157,12 @@ internal class UIStorageChest : UICanvas(), HasInventory {
|
||||
|
||||
handler.allowESCtoClose = true
|
||||
|
||||
// make grid mode buttons work together
|
||||
itemListChest.gridModeButtons[0].touchDownListener = { _,_,_,_ -> setCompact(false) }
|
||||
itemListChest.gridModeButtons[1].touchDownListener = { _,_,_,_ -> setCompact(true) }
|
||||
itemListPlayer.gridModeButtons[0].touchDownListener = { _,_,_,_ -> setCompact(false) }
|
||||
itemListPlayer.gridModeButtons[1].touchDownListener = { _,_,_,_ -> setCompact(true) }
|
||||
|
||||
addUIitem(catBar)
|
||||
addUIitem(itemListChest)
|
||||
addUIitem(itemListPlayer)
|
||||
|
||||
Reference in New Issue
Block a user