mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
smelter: clicking on the navbar no longer resets the cell selection
This commit is contained in:
@@ -29,6 +29,8 @@ import kotlin.math.floor
|
||||
* Number of grids: 10x7
|
||||
* Number of lists: 2x7
|
||||
*
|
||||
* `mouseUp()` will be false if the mouse is on the mode/scroll/etc bar, use `navRemoCon.mouseUp()` for that.
|
||||
*
|
||||
* Created by minjaesong on 2017-10-21.
|
||||
*/
|
||||
open class UIItemInventoryItemGrid(
|
||||
@@ -209,11 +211,17 @@ open class UIItemInventoryItemGrid(
|
||||
|
||||
var items: Array<UIItemInventoryCellBase> = itemList
|
||||
|
||||
/**
|
||||
* @param mode 0 if mode has changed to non-compact mode, 1 if compact
|
||||
*/
|
||||
var setListModeCallback = { mode: Int ->}
|
||||
|
||||
open var isCompactMode = false // this is INIT code
|
||||
set(value) {
|
||||
field = value
|
||||
items = if (value) itemGrid else itemList
|
||||
rebuild(currentFilter, currentAppendix)
|
||||
setListModeCallback(value.toInt())
|
||||
}
|
||||
|
||||
private val iconPosX = if (drawScrollOnRightside)
|
||||
|
||||
@@ -25,6 +25,10 @@ class UIItemListNavBarVertical(
|
||||
|
||||
override val width = UIItemListNavBarVertical.WIDTH
|
||||
|
||||
override val mouseUp: Boolean
|
||||
get() = itemRelativeMouseX - 8 in 0 until width &&
|
||||
itemRelativeMouseY + 8 in 0 until height
|
||||
|
||||
companion object {
|
||||
const val WIDTH = 28
|
||||
const val LIST_TO_CONTROL_GAP = 12
|
||||
@@ -128,6 +132,7 @@ class UIItemListNavBarVertical(
|
||||
batch.color = Toolkit.Theme.COL_CELL_FILL
|
||||
Toolkit.fillArea(batch, iconPosX - 4, getIconPosY(0) - 8, width, height)
|
||||
// cell border
|
||||
// batch.color = if (mouseUp) colourTheme.cellHighlightMouseUpCol else colourTheme.cellHighlightNormalCol // just to test the mouseUp
|
||||
batch.color = colourTheme.cellHighlightNormalCol
|
||||
Toolkit.drawBoxBorder(batch, iconPosX - 4, getIconPosY(0) - 8, width, height)
|
||||
|
||||
|
||||
@@ -72,6 +72,8 @@ class UISmelterBasic(val smelter: FixtureSmelterBasic) : UICanvas(
|
||||
|
||||
fun getPlayerInventory(): FixtureInventory = INGAME.actorNowPlaying!!.inventory
|
||||
|
||||
private var listModeButtonPushed = false
|
||||
|
||||
init {
|
||||
CommonResourcePool.addToLoadingList("basegame_gui_smelter_icons") {
|
||||
TextureRegionPack(ModMgr.getGdxFile("basegame", "gui/smelter_icons.tga"), 20, 20)
|
||||
@@ -289,8 +291,15 @@ class UISmelterBasic(val smelter: FixtureSmelterBasic) : UICanvas(
|
||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
super.touchDown(screenX, screenY, pointer, button)
|
||||
|
||||
if (!oreItemSlot.mouseUp && !fireboxItemSlot.mouseUp && !productItemslot.mouseUp && !playerThings.itemList.mouseUp) {
|
||||
if (!oreItemSlot.mouseUp &&
|
||||
!fireboxItemSlot.mouseUp &&
|
||||
!productItemslot.mouseUp &&
|
||||
!playerThings.itemList.mouseUp &&
|
||||
!playerThings.itemList.navRemoCon.mouseUp
|
||||
) {
|
||||
|
||||
clickedOn = 0
|
||||
|
||||
oreItemSlot.forceHighlighted = false
|
||||
fireboxItemSlot.forceHighlighted = false
|
||||
itemListUpdate()
|
||||
|
||||
Reference in New Issue
Block a user