quickslot selections are controlled by the ingame rather than the 'bar UI'

This commit is contained in:
minjaesong
2019-01-13 02:17:49 +09:00
parent 822b9bf4fd
commit d9c7d3c681
10 changed files with 45 additions and 77 deletions

View File

@@ -116,11 +116,11 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
// UI aliases
lateinit var uiAliases: ArrayList<UICanvas>
private set
lateinit var uiAlasesPausing: ArrayList<UICanvas>
lateinit var uiAliasesPausing: ArrayList<UICanvas>
private set
inline val paused: Boolean
get() = uiAlasesPausing.map { if (it.isOpened) return true else 0 }.isEmpty() // isEmply is always false, which we want
get() = uiAliasesPausing.map { if (it.isOpened) return true else 0 }.isEmpty() // isEmpty is always false, which we want
/**
* Set to false if UI is opened; set to true if UI is closed.
*/
@@ -355,13 +355,13 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
uiTooltip
// drawn last
)
uiAlasesPausing = arrayListOf(
uiAliasesPausing = arrayListOf(
uiInventoryPlayer,
//uiInventoryContainer,
consoleHandler,
uiCheatMotherfuckerNootNoot
)
uiAlasesPausing.forEach { addUI(it) } // put them all to the UIContainer
uiAliasesPausing.forEach { addUI(it) } // put them all to the UIContainer
uiAliases.forEach { addUI(it) } // put them all to the UIContainer
@@ -958,7 +958,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
actorsRenderOverlay.forEach { it.dispose() }
uiAliases.forEach { it.dispose() }
uiAlasesPausing.forEach { it.dispose() }
uiAliasesPausing.forEach { it.dispose() }
WatchDotAlph.dispose()

View File

@@ -358,14 +358,7 @@ open class ActorHumanoid(
}
override fun keyDown(keycode: Int): Boolean {
// quickslot (quickbar)
val quickbarKeys = AppLoader.getConfigIntArray("keyquickbars")
if (keycode in quickbarKeys) {
actorValue[AVKey.__PLAYER_QUICKSLOTSEL] = quickbarKeys.indexOf(keycode)
}
return true
return false
}

View File

@@ -11,8 +11,8 @@ import net.torvald.terrarum.itemproperties.ItemCodex.ITEM_WALLS
import net.torvald.terrarum.itemproperties.ItemID
import net.torvald.terrarum.lock
import net.torvald.terrarum.modulebasegame.Ingame
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar
import java.util.*
import java.util.concurrent.locks.Lock
import java.util.concurrent.locks.ReentrantLock
/**
@@ -30,13 +30,13 @@ class ActorInventory(val actor: Pocketed, var maxCapacity: Int, var capacityMode
/**
* List of all equipped items (tools, armours, rings, necklaces, etc.)
*/
val itemEquipped = Array<GameItem?>(GameItem.EquipPosition.INDEX_MAX, { null })
val itemEquipped = Array<GameItem?>(GameItem.EquipPosition.INDEX_MAX) { null }
/**
* Sorted by referenceID.
*/
val itemList = ArrayList<InventoryPair>()
val quickBar = Array<ItemID?>(10, { null }) // 0: Slot 1, 9: Slot 10
val quickSlot = Array<ItemID?>(UIQuickslotBar.SLOT_COUNT) { null } // 0: Slot 1, 9: Slot 10
var currency = 0 // unified currency for whole civs; Dwarf Fortress approach seems too complicated
@@ -127,10 +127,10 @@ class ActorInventory(val actor: Pocketed, var maxCapacity: Int, var capacityMode
}
fun setQuickBar(slot: Int, dynamicID: ItemID?) {
quickBar[slot] = dynamicID
quickSlot[slot] = dynamicID
}
fun getQuickslot(slot: Int): InventoryPair? = getByDynamicID(quickBar[slot])
fun getQuickslot(slot: Int): InventoryPair? = getByDynamicID(quickSlot[slot])
/**
* HashMap<GameItem, Amounts>

View File

@@ -1,6 +1,5 @@
package net.torvald.terrarum.modulebasegame.ui
import com.badlogic.gdx.Input
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
@@ -87,24 +86,6 @@ class UIQuickslotBar : UICanvas() {
return true
}
override fun keyDown(keycode: Int): Boolean {
selection = when (keycode) {
Input.Keys.NUM_1 -> 0
Input.Keys.NUM_2 -> 1
Input.Keys.NUM_3 -> 2
Input.Keys.NUM_4 -> 3
Input.Keys.NUM_5 -> 4
Input.Keys.NUM_6 -> 5
Input.Keys.NUM_7 -> 6
Input.Keys.NUM_8 -> 7
Input.Keys.NUM_9 -> 8
Input.Keys.NUM_0 -> 9
else -> return false
}
return true
}
override fun dispose() {
}