mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 20:44:05 +09:00
jukebox ui wip
This commit is contained in:
BIN
assets/mods/basegame/gui/jukebox_caticons.tga
LFS
Normal file
BIN
assets/mods/basegame/gui/jukebox_caticons.tga
LFS
Normal file
Binary file not shown.
@@ -72,4 +72,6 @@ id;classname
|
|||||||
|
|
||||||
320;net.torvald.terrarum.modulebasegame.gameitems.ItemWorldPortal
|
320;net.torvald.terrarum.modulebasegame.gameitems.ItemWorldPortal
|
||||||
|
|
||||||
|
65536;net.torvald.terrarum.modulebasegame.gameitems.MusicDisc01
|
||||||
|
|
||||||
999999;net.torvald.terrarum.modulebasegame.gameitems.ItemTapestry
|
999999;net.torvald.terrarum.modulebasegame.gameitems.ItemTapestry
|
||||||
|
|||||||
|
@@ -22,6 +22,7 @@ import net.torvald.terrarum.langpack.Lang
|
|||||||
import net.torvald.terrarum.modulebasegame.MusicContainer
|
import net.torvald.terrarum.modulebasegame.MusicContainer
|
||||||
import net.torvald.terrarum.modulebasegame.TerrarumMusicGovernor
|
import net.torvald.terrarum.modulebasegame.TerrarumMusicGovernor
|
||||||
import net.torvald.terrarum.modulebasegame.gameitems.FixtureItemBase
|
import net.torvald.terrarum.modulebasegame.gameitems.FixtureItemBase
|
||||||
|
import net.torvald.terrarum.modulebasegame.ui.UIJukebox
|
||||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||||
import org.dyn4j.geometry.Vector2
|
import org.dyn4j.geometry.Vector2
|
||||||
|
|
||||||
@@ -32,7 +33,8 @@ class FixtureJukebox : Electric {
|
|||||||
|
|
||||||
constructor() : super(
|
constructor() : super(
|
||||||
BlockBox(BlockBox.NO_COLLISION, 2, 3),
|
BlockBox(BlockBox.NO_COLLISION, 2, 3),
|
||||||
nameFun = { Lang["ITEM_JUKEBOX"] }
|
nameFun = { Lang["ITEM_JUKEBOX"] },
|
||||||
|
mainUI = UIJukebox()
|
||||||
)
|
)
|
||||||
|
|
||||||
@Transient private var discCurrentlyPlaying: Int? = null
|
@Transient private var discCurrentlyPlaying: Int? = null
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package net.torvald.terrarum.modulebasegame.gameitems
|
||||||
|
|
||||||
|
import net.torvald.terrarum.gameitems.GameItem
|
||||||
|
import net.torvald.terrarum.gameitems.ItemID
|
||||||
|
import java.io.File
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base class for anything that holds a file like disc/disks
|
||||||
|
*
|
||||||
|
* Created by minjaesong on 2024-01-13.
|
||||||
|
*/
|
||||||
|
open class ItemFileRef(originalID: ItemID) : GameItem(originalID) {
|
||||||
|
|
||||||
|
open var uuid: UUID = UUID(0, 0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String of path within the module (if not refIsShared), or path under savedir/Shared/
|
||||||
|
*/
|
||||||
|
open var refPath: String = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module name (if not refIsShared), or empty string
|
||||||
|
*/
|
||||||
|
open var refModuleName: String = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the file must be found under `savedir/Shared`
|
||||||
|
*/
|
||||||
|
open var refIsShared: Boolean = false
|
||||||
|
|
||||||
|
@Transient open lateinit var ref: File
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Application-defined.
|
||||||
|
*
|
||||||
|
* For Terrarum:
|
||||||
|
* - "music_disc" for music discs used by Jukebox
|
||||||
|
*
|
||||||
|
* For dwarventech:
|
||||||
|
* - "floppy_oem" (oem: for "commercial" software)
|
||||||
|
* - "floppy_small"
|
||||||
|
* - "floppy_mid"
|
||||||
|
* - "floppy_large"
|
||||||
|
* - "floppy_debug"
|
||||||
|
* - "floppy_homebrew"
|
||||||
|
* - "harddisk_small"
|
||||||
|
* - "harddisk_mid"
|
||||||
|
* - "harddisk_large"
|
||||||
|
* - "harddisk_debug"
|
||||||
|
* - "eeprom_bios" (bios chips only)
|
||||||
|
* - "eeprom_64k" (extra rom for custom motherboards)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
open var mediumIdentifier = ""
|
||||||
|
|
||||||
|
|
||||||
|
override var baseMass = 1.0
|
||||||
|
override var baseToolSize: Double? = null
|
||||||
|
override var inventoryCategory = Category.GENERIC
|
||||||
|
override val isDynamic = true
|
||||||
|
override val materialId = ""
|
||||||
|
override var equipPosition = EquipPosition.HAND_GRIP
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package net.torvald.terrarum.modulebasegame.gameitems
|
||||||
|
|
||||||
|
import net.torvald.terrarum.ModMgr
|
||||||
|
import net.torvald.terrarum.gameitems.ItemID
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2024-01-13.
|
||||||
|
*/
|
||||||
|
class MusicDisc01(originalID: ItemID) : ItemFileRef(originalID) {
|
||||||
|
override var refPath = "audio/music/discs/01 Thousands of Shards.ogg"
|
||||||
|
override var refModuleName = "basegame"
|
||||||
|
override val isDynamic = false
|
||||||
|
@Transient override var ref = ModMgr.getFile(refModuleName, refPath)
|
||||||
|
override var mediumIdentifier = "music_disc"
|
||||||
|
}
|
||||||
@@ -10,8 +10,8 @@ import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory
|
|||||||
abstract class InventoryTransactionNegotiator {
|
abstract class InventoryTransactionNegotiator {
|
||||||
/** Retrieve item filter to be used to show only the acceptable items when player's own inventory is being displayed */
|
/** Retrieve item filter to be used to show only the acceptable items when player's own inventory is being displayed */
|
||||||
open fun getItemFilter(): List<String> = listOf(CAT_ALL) // GameItem.Category
|
open fun getItemFilter(): List<String> = listOf(CAT_ALL) // GameItem.Category
|
||||||
/** Accepts item from the player and pass it to right inventory (object), slot (UI), etc... */
|
/** Called when the item is being accepted from the player and moved to the right inventory (object), slot (UI), etc... */
|
||||||
abstract fun accept(player: FixtureInventory, fixture: FixtureInventory, item: GameItem, amount: Long = 1L)
|
abstract fun accept(player: FixtureInventory, fixture: FixtureInventory, item: GameItem, amount: Long = 1L)
|
||||||
/** Rejects item and perhaps returns it back to the player, or make explosion, etc... */
|
/** Called when the item is being removed from the fixture to returns it back to the player, or make explosion, etc... */
|
||||||
abstract fun reject(fixture: FixtureInventory, player: FixtureInventory, item: GameItem, amount: Long = 1L)
|
abstract fun refund(fixture: FixtureInventory, player: FixtureInventory, item: GameItem, amount: Long = 1L)
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
|
|||||||
override var width = App.scr.width
|
override var width = App.scr.width
|
||||||
override var height = App.scr.height
|
override var height = App.scr.height
|
||||||
|
|
||||||
private val playerThings = CraftingPlayerInventory(full, this).also {
|
private val playerThings = UITemplateHalfInventory(this, false).also {
|
||||||
it.itemListTouchDownFun = { gameItem, _, _, _, _ -> recipeClicked?.let { recipe -> gameItem?.let { gameItem ->
|
it.itemListTouchDownFun = { gameItem, _, _, _, _ -> recipeClicked?.let { recipe -> gameItem?.let { gameItem ->
|
||||||
val itemID = gameItem.dynamicID
|
val itemID = gameItem.dynamicID
|
||||||
// don't rely on highlightedness of the button to determine the item on the button is the selected
|
// don't rely on highlightedness of the button to determine the item on the button is the selected
|
||||||
@@ -77,7 +77,7 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
|
|||||||
// TODO()
|
// TODO()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun reject(fixture: FixtureInventory, player: FixtureInventory, item: GameItem, amount: Long) {
|
override fun refund(fixture: FixtureInventory, player: FixtureInventory, item: GameItem, amount: Long) {
|
||||||
// TODO()
|
// TODO()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,6 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
|
|||||||
// ingredient list
|
// ingredient list
|
||||||
itemListIngredients = UIItemInventoryItemGrid(
|
itemListIngredients = UIItemInventoryItemGrid(
|
||||||
this,
|
this,
|
||||||
catBar,
|
|
||||||
{ ingredients },
|
{ ingredients },
|
||||||
thisOffsetX,
|
thisOffsetX,
|
||||||
thisOffsetY + LAST_LINE_IN_GRID,
|
thisOffsetY + LAST_LINE_IN_GRID,
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ internal class UIInventoryCells(
|
|||||||
internal val itemList: UIItemInventoryItemGrid =
|
internal val itemList: UIItemInventoryItemGrid =
|
||||||
UIItemInventoryItemGrid(
|
UIItemInventoryItemGrid(
|
||||||
full,
|
full,
|
||||||
full.catBar,
|
|
||||||
{ full.actor.inventory },
|
{ full.actor.inventory },
|
||||||
INVENTORY_CELLS_OFFSET_X(),
|
INVENTORY_CELLS_OFFSET_X(),
|
||||||
INVENTORY_CELLS_OFFSET_Y(),
|
INVENTORY_CELLS_OFFSET_Y(),
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class UIItemCraftingCandidateGrid(
|
|||||||
keyDownFun: (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit, // Item, Amount, Keycode, extra info, keyed button
|
keyDownFun: (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit, // Item, Amount, Keycode, extra info, keyed button
|
||||||
touchDownFun: (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit // Item, Amount, Button, extra info, clicked button
|
touchDownFun: (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit // Item, Amount, Button, extra info, clicked button
|
||||||
) : UIItemInventoryItemGrid(
|
) : UIItemInventoryItemGrid(
|
||||||
parentUI, catBar,
|
parentUI,
|
||||||
{ TODO() /* UNUSED and MUST NOT BE USED! */ },
|
{ TODO() /* UNUSED and MUST NOT BE USED! */ },
|
||||||
initialX, initialY,
|
initialX, initialY,
|
||||||
horizontalCells, verticalCells,
|
horizontalCells, verticalCells,
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import kotlin.math.floor
|
|||||||
*/
|
*/
|
||||||
open class UIItemInventoryItemGrid(
|
open class UIItemInventoryItemGrid(
|
||||||
parentUI: UICanvas,
|
parentUI: UICanvas,
|
||||||
val catBar: UIItemCatBar,
|
|
||||||
var getInventory: () -> FixtureInventory, // when you're going to display List of Craftables, you could implement a Delegator...? Or just build a virtual inventory
|
var getInventory: () -> FixtureInventory, // when you're going to display List of Craftables, you could implement a Delegator...? Or just build a virtual inventory
|
||||||
initialX: Int,
|
initialX: Int,
|
||||||
initialY: Int,
|
initialY: Int,
|
||||||
@@ -189,10 +188,6 @@ open class UIItemInventoryItemGrid(
|
|||||||
parentUI = inventoryUI,
|
parentUI = inventoryUI,
|
||||||
initialX = this.posX + (UIItemInventoryElemSimple.height + listGap) * (it % horizontalCells),
|
initialX = this.posX + (UIItemInventoryElemSimple.height + listGap) * (it % horizontalCells),
|
||||||
initialY = this.posY + (UIItemInventoryElemSimple.height + listGap) * (it / horizontalCells),
|
initialY = this.posY + (UIItemInventoryElemSimple.height + listGap) * (it / horizontalCells),
|
||||||
item = null,
|
|
||||||
amount = UIItemInventoryElemWide.UNIQUE_ITEM_HAS_NO_AMOUNT,
|
|
||||||
itemImage = null,
|
|
||||||
drawBackOnNull = true,
|
|
||||||
keyDownFun = keyDownFun,
|
keyDownFun = keyDownFun,
|
||||||
touchDownFun = touchDownFun,
|
touchDownFun = touchDownFun,
|
||||||
highlightEquippedItem = highlightEquippedItem,
|
highlightEquippedItem = highlightEquippedItem,
|
||||||
@@ -209,10 +204,6 @@ open class UIItemInventoryItemGrid(
|
|||||||
initialX = this.posX + (largeListWidth + listGap) * (it % itemListColumnCount),
|
initialX = this.posX + (largeListWidth + listGap) * (it % itemListColumnCount),
|
||||||
initialY = this.posY + (UIItemInventoryElemWide.height + listGap) * (it / itemListColumnCount),
|
initialY = this.posY + (UIItemInventoryElemWide.height + listGap) * (it / itemListColumnCount),
|
||||||
width = largeListWidth,
|
width = largeListWidth,
|
||||||
item = null,
|
|
||||||
amount = UIItemInventoryElemWide.UNIQUE_ITEM_HAS_NO_AMOUNT,
|
|
||||||
itemImage = null,
|
|
||||||
drawBackOnNull = true,
|
|
||||||
keyDownFun = keyDownFun,
|
keyDownFun = keyDownFun,
|
||||||
touchDownFun = touchDownFun,
|
touchDownFun = touchDownFun,
|
||||||
highlightEquippedItem = highlightEquippedItem,
|
highlightEquippedItem = highlightEquippedItem,
|
||||||
|
|||||||
84
src/net/torvald/terrarum/modulebasegame/ui/UIJukebox.kt
Normal file
84
src/net/torvald/terrarum/modulebasegame/ui/UIJukebox.kt
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import net.torvald.terrarum.*
|
||||||
|
import net.torvald.terrarum.ui.*
|
||||||
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2024-01-13.
|
||||||
|
*/
|
||||||
|
class UIJukebox : UICanvas(
|
||||||
|
toggleKeyLiteral = "control_key_inventory",
|
||||||
|
toggleButtonLiteral = "control_gamepad_start",
|
||||||
|
) {
|
||||||
|
|
||||||
|
init {
|
||||||
|
CommonResourcePool.addToLoadingList("basegame-gui-jukebox_caticons") {
|
||||||
|
TextureRegionPack(ModMgr.getGdxFile("basegame", "gui/jukebox_caticons.tga"), 20, 20)
|
||||||
|
}
|
||||||
|
CommonResourcePool.loadAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
override var width = Toolkit.drawWidth
|
||||||
|
override var height = App.scr.height
|
||||||
|
|
||||||
|
private val catbar = UITemplateCatBar(
|
||||||
|
this, false,
|
||||||
|
CommonResourcePool.getAsTextureRegionPack("basegame-gui-jukebox_caticons"),
|
||||||
|
intArrayOf(0, 1),
|
||||||
|
emptyList(),
|
||||||
|
listOf({ "" }, { "" })
|
||||||
|
)
|
||||||
|
|
||||||
|
private val transitionalSonglistPanel = UIJukeboxSonglistPanel(this)
|
||||||
|
private val transitionalDiscInventory = UIJukeboxInventory(this)
|
||||||
|
|
||||||
|
private val transitionPanel = UIItemHorizontalFadeSlide(
|
||||||
|
this,
|
||||||
|
0, 0, width, height, 0f,
|
||||||
|
listOf(transitionalSonglistPanel),
|
||||||
|
listOf(transitionalDiscInventory)
|
||||||
|
)
|
||||||
|
|
||||||
|
init {
|
||||||
|
addUIitem(catbar)
|
||||||
|
addUIitem(transitionPanel)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var openingClickLatched = false
|
||||||
|
|
||||||
|
override fun show() {
|
||||||
|
openingClickLatched = Terrarum.mouseDown
|
||||||
|
transitionPanel.show()
|
||||||
|
UIItemInventoryItemGrid.tooltipShowing.clear()
|
||||||
|
INGAME.setTooltipMessage(null)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hide() {
|
||||||
|
transitionPanel.hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun updateUI(delta: Float) {
|
||||||
|
uiItems.forEach { it.update(delta) }
|
||||||
|
|
||||||
|
if (openingClickLatched && !Terrarum.mouseDown) openingClickLatched = false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
UIInventoryFull.drawBackground(batch, 1f)
|
||||||
|
uiItems.forEach { it.render(frameDelta, batch, camera) }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||||
|
if (!openingClickLatched) {
|
||||||
|
return super.touchDown(screenX, screenY, pointer, button)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispose() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
112
src/net/torvald/terrarum/modulebasegame/ui/UIJukeboxInventory.kt
Normal file
112
src/net/torvald/terrarum/modulebasegame/ui/UIJukeboxInventory.kt
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import net.torvald.terrarum.App
|
||||||
|
import net.torvald.terrarum.gameitems.GameItem
|
||||||
|
import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory
|
||||||
|
import net.torvald.terrarum.modulebasegame.gameitems.ItemFileRef
|
||||||
|
import net.torvald.terrarum.ui.Toolkit
|
||||||
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
|
import net.torvald.terrarum.ui.UIItemInventoryElemSimple
|
||||||
|
import net.torvald.terrarum.ui.UIItemInventoryElemWide
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2024-01-13.
|
||||||
|
*/
|
||||||
|
class UIJukeboxInventory(val parent: UICanvas) : UICanvas(), HasInventory {
|
||||||
|
|
||||||
|
override var width = Toolkit.drawWidth
|
||||||
|
override var height = App.scr.height
|
||||||
|
|
||||||
|
private val negotiator = object : InventoryTransactionNegotiator() {
|
||||||
|
override fun accept(player: FixtureInventory, fixture: FixtureInventory, item: GameItem, amount: Long) {
|
||||||
|
if (item is ItemFileRef && item.mediumIdentifier == "music_disc") {
|
||||||
|
player.remove(item, amount)
|
||||||
|
fixture.add(item, amount)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun refund(fixture: FixtureInventory, player: FixtureInventory, item: GameItem, amount: Long) {
|
||||||
|
fixture.remove(item, amount)
|
||||||
|
player.add(item, amount)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private val thisInventory = FixtureInventory()
|
||||||
|
|
||||||
|
private var halfSlotOffset = (UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap) / 2
|
||||||
|
private val thisOffsetX = UIInventoryFull.INVENTORY_CELLS_OFFSET_X() + UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap - halfSlotOffset
|
||||||
|
private val thisOffsetY = UIInventoryFull.INVENTORY_CELLS_OFFSET_Y()
|
||||||
|
|
||||||
|
private val fixtureInventoryCells = (0..7).map {
|
||||||
|
UIItemInventoryElemWide(this,
|
||||||
|
thisOffsetX, thisOffsetY + (UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap) * it,
|
||||||
|
6 * UIItemInventoryElemSimple.height + 5 * UIItemInventoryItemGrid.listGap,
|
||||||
|
keyDownFun = { _, _, _, _, _ -> Unit },
|
||||||
|
touchDownFun = { gameItem, amount, button, _, _ ->
|
||||||
|
if (button == App.getConfigInt("config_mouseprimary")) {
|
||||||
|
if (gameItem != null) {
|
||||||
|
negotiator.refund(getFixtureInventory(), getPlayerInventory(), gameItem, amount)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
private val playerInventoryUI = UITemplateHalfInventory(this, false)
|
||||||
|
|
||||||
|
init {
|
||||||
|
fixtureInventoryCells.forEach {
|
||||||
|
addUIitem(it)
|
||||||
|
}
|
||||||
|
addUIitem(playerInventoryUI)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun updateUI(delta: Float) {
|
||||||
|
uiItems.forEach { it.update(delta) }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
uiItems.forEach { it.render(frameDelta, batch, camera) }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispose() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getNegotiator() = negotiator
|
||||||
|
|
||||||
|
override fun getFixtureInventory(): FixtureInventory {
|
||||||
|
TODO()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getPlayerInventory(): FixtureInventory {
|
||||||
|
TODO()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class UIJukeboxSonglistPanel(val parent: UICanvas) : UICanvas() {
|
||||||
|
|
||||||
|
override var width = Toolkit.drawWidth
|
||||||
|
override var height = App.scr.height
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
override fun updateUI(delta: Float) {
|
||||||
|
uiItems.forEach { it.update(delta) }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
uiItems.forEach { it.render(frameDelta, batch, camera) }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun dispose() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ internal class UIStorageChest : UICanvas(
|
|||||||
fixture.add(item, amount)
|
fixture.add(item, amount)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun reject(fixture: FixtureInventory, player: FixtureInventory, item: GameItem, amount: Long) {
|
override fun refund(fixture: FixtureInventory, player: FixtureInventory, item: GameItem, amount: Long) {
|
||||||
fixture.remove(item, amount)
|
fixture.remove(item, amount)
|
||||||
player.add(item, amount)
|
player.add(item, amount)
|
||||||
}
|
}
|
||||||
@@ -45,8 +45,8 @@ internal class UIStorageChest : UICanvas(
|
|||||||
override fun getPlayerInventory(): FixtureInventory = INGAME.actorNowPlaying!!.inventory
|
override fun getPlayerInventory(): FixtureInventory = INGAME.actorNowPlaying!!.inventory
|
||||||
|
|
||||||
private val catBar: UIItemCatBar
|
private val catBar: UIItemCatBar
|
||||||
private val itemListChest: UIItemInventoryItemGrid
|
private val itemListChest: UITemplateHalfInventory
|
||||||
private val itemListPlayer: UIItemInventoryItemGrid
|
private val itemListPlayer: UITemplateHalfInventory
|
||||||
|
|
||||||
private var encumbrancePerc = 0f
|
private var encumbrancePerc = 0f
|
||||||
private var isEncumbered = false
|
private var isEncumbered = false
|
||||||
@@ -93,40 +93,27 @@ internal class UIStorageChest : UICanvas(
|
|||||||
|
|
||||||
)
|
)
|
||||||
catBar.selectionChangeListener = { old, new -> itemListUpdate() }
|
catBar.selectionChangeListener = { old, new -> itemListUpdate() }
|
||||||
itemListChest = UIItemInventoryItemGrid(
|
|
||||||
this,
|
|
||||||
catBar,
|
itemListChest = UITemplateHalfInventory(this, true) { getFixtureInventory() }.also {
|
||||||
{ getFixtureInventory() },
|
it.itemListKeyDownFun = { _, _, _, _, _ -> Unit }
|
||||||
Toolkit.hdrawWidth - getWidthOfCells(6) - halfSlotOffset,
|
it.itemListTouchDownFun = { gameItem, amount, button, _, _ ->
|
||||||
UIInventoryFull.INVENTORY_CELLS_OFFSET_Y(),
|
|
||||||
6, UIInventoryFull.CELLS_VRT,
|
|
||||||
drawScrollOnRightside = false,
|
|
||||||
drawWallet = false,
|
|
||||||
keyDownFun = { _, _, _, _, _ -> Unit },
|
|
||||||
touchDownFun = { gameItem, amount, button, _, _ ->
|
|
||||||
if (button == App.getConfigInt("config_mouseprimary")) {
|
if (button == App.getConfigInt("config_mouseprimary")) {
|
||||||
if (gameItem != null) {
|
if (gameItem != null) {
|
||||||
negotiator.reject(getFixtureInventory(), getPlayerInventory(), gameItem, amount)
|
negotiator.refund(getFixtureInventory(), getPlayerInventory(), gameItem, amount)
|
||||||
}
|
}
|
||||||
itemListUpdate()
|
itemListUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
// make grid mode buttons work together
|
// make grid mode buttons work together
|
||||||
itemListChest.navRemoCon.listButtonListener = { _,_ -> setCompact(false) }
|
itemListChest.itemList.navRemoCon.listButtonListener = { _,_ -> setCompact(false) }
|
||||||
itemListChest.navRemoCon.gridButtonListener = { _,_ -> setCompact(true) }
|
itemListChest.itemList.navRemoCon.gridButtonListener = { _,_ -> setCompact(true) }
|
||||||
|
|
||||||
itemListPlayer = UIItemInventoryItemGrid(
|
|
||||||
this,
|
itemListPlayer = UITemplateHalfInventory(this, false).also {
|
||||||
catBar,
|
it.itemListKeyDownFun = { _, _, _, _, _ -> Unit }
|
||||||
{ INGAME.actorNowPlaying!!.inventory }, // literally a player's inventory
|
it.itemListTouchDownFun = { gameItem, amount, button, _, _ ->
|
||||||
Toolkit.hdrawWidth + halfSlotOffset,
|
|
||||||
UIInventoryFull.INVENTORY_CELLS_OFFSET_Y(),
|
|
||||||
6, UIInventoryFull.CELLS_VRT,
|
|
||||||
drawScrollOnRightside = true,
|
|
||||||
drawWallet = false,
|
|
||||||
keyDownFun = { _, _, _, _, _ -> Unit },
|
|
||||||
touchDownFun = { gameItem, amount, button, _, _ ->
|
|
||||||
if (button == App.getConfigInt("config_mouseprimary")) {
|
if (button == App.getConfigInt("config_mouseprimary")) {
|
||||||
if (gameItem != null) {
|
if (gameItem != null) {
|
||||||
negotiator.accept(getPlayerInventory(), getFixtureInventory(), gameItem, amount)
|
negotiator.accept(getPlayerInventory(), getFixtureInventory(), gameItem, amount)
|
||||||
@@ -134,9 +121,9 @@ internal class UIStorageChest : UICanvas(
|
|||||||
itemListUpdate()
|
itemListUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
itemListPlayer.navRemoCon.listButtonListener = { _,_ -> setCompact(false) }
|
itemListPlayer.itemList.navRemoCon.listButtonListener = { _,_ -> setCompact(false) }
|
||||||
itemListPlayer.navRemoCon.gridButtonListener = { _,_ -> setCompact(true) }
|
itemListPlayer.itemList.navRemoCon.gridButtonListener = { _,_ -> setCompact(true) }
|
||||||
|
|
||||||
handler.allowESCtoClose = true
|
handler.allowESCtoClose = true
|
||||||
|
|
||||||
@@ -148,7 +135,7 @@ internal class UIStorageChest : UICanvas(
|
|||||||
private var openingClickLatched = false
|
private var openingClickLatched = false
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
itemListPlayer.getInventory = { INGAME.actorNowPlaying!!.inventory }
|
itemListPlayer.itemList.getInventory = { INGAME.actorNowPlaying!!.inventory }
|
||||||
|
|
||||||
itemListUpdate()
|
itemListUpdate()
|
||||||
|
|
||||||
@@ -167,16 +154,16 @@ internal class UIStorageChest : UICanvas(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setCompact(yes: Boolean) {
|
private fun setCompact(yes: Boolean) {
|
||||||
itemListChest.isCompactMode = yes
|
itemListChest.itemList.isCompactMode = yes
|
||||||
itemListChest.navRemoCon.gridModeButtons[0].highlighted = !yes
|
itemListChest.itemList.navRemoCon.gridModeButtons[0].highlighted = !yes
|
||||||
itemListChest.navRemoCon.gridModeButtons[1].highlighted = yes
|
itemListChest.itemList.navRemoCon.gridModeButtons[1].highlighted = yes
|
||||||
itemListChest.itemPage = 0
|
itemListChest.itemList.itemPage = 0
|
||||||
itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIndex])
|
itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIndex])
|
||||||
|
|
||||||
itemListPlayer.isCompactMode = yes
|
itemListPlayer.itemList.isCompactMode = yes
|
||||||
itemListPlayer.navRemoCon.gridModeButtons[0].highlighted = !yes
|
itemListPlayer.itemList.navRemoCon.gridModeButtons[0].highlighted = !yes
|
||||||
itemListPlayer.navRemoCon.gridModeButtons[1].highlighted = yes
|
itemListPlayer.itemList.navRemoCon.gridModeButtons[1].highlighted = yes
|
||||||
itemListPlayer.itemPage = 0
|
itemListPlayer.itemList.itemPage = 0
|
||||||
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIndex])
|
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIndex])
|
||||||
|
|
||||||
itemListUpdate()
|
itemListUpdate()
|
||||||
|
|||||||
@@ -1,18 +1,29 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.gameitems.GameItem
|
import net.torvald.terrarum.gameitems.GameItem
|
||||||
import net.torvald.terrarum.gameitems.ItemID
|
import net.torvald.terrarum.gameitems.ItemID
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
|
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
|
||||||
|
import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.InventoryPair
|
import net.torvald.terrarum.modulebasegame.gameactors.InventoryPair
|
||||||
import net.torvald.terrarum.ui.*
|
import net.torvald.terrarum.ui.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suite of objects for showing player inventory for various crafting UIs.
|
* Suite of objects for showing player inventory for various UIs involving inventory management.
|
||||||
|
*
|
||||||
|
* @param parent the parent UI
|
||||||
|
* @param drawOnLeft if the inventory should be drawn on the left panel
|
||||||
|
* @param getInventoryFun function that returns an inventory. Default value is for player's
|
||||||
*
|
*
|
||||||
* Created by minjaesong on 2023-10-04.
|
* Created by minjaesong on 2023-10-04.
|
||||||
*/
|
*/
|
||||||
class CraftingPlayerInventory(val full: UIInventoryFull, val crafting: UICanvas) : UITemplate(crafting) {
|
class UITemplateHalfInventory(
|
||||||
|
parent: UICanvas,
|
||||||
|
drawOnLeft: Boolean,
|
||||||
|
getInventoryFun: () -> FixtureInventory = { INGAME.actorNowPlaying!!.inventory }
|
||||||
|
) : UITemplate(parent) {
|
||||||
|
|
||||||
val itemList: UIItemInventoryItemGrid
|
val itemList: UIItemInventoryItemGrid
|
||||||
|
|
||||||
@@ -30,13 +41,12 @@ class CraftingPlayerInventory(val full: UIInventoryFull, val crafting: UICanvas)
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
itemList = UIItemInventoryItemGrid(
|
itemList = UIItemInventoryItemGrid(
|
||||||
crafting,
|
parent,
|
||||||
full.catBar,
|
getInventoryFun,
|
||||||
{ INGAME.actorNowPlaying!!.inventory }, // literally a player's inventory
|
if (drawOnLeft) thisOffsetX else thisOffsetX2,
|
||||||
thisOffsetX2,
|
|
||||||
thisOffsetY,
|
thisOffsetY,
|
||||||
6, UIInventoryFull.CELLS_VRT,
|
6, UIInventoryFull.CELLS_VRT,
|
||||||
drawScrollOnRightside = true,
|
drawScrollOnRightside = !drawOnLeft,
|
||||||
drawWallet = false,
|
drawWallet = false,
|
||||||
highlightEquippedItem = false,
|
highlightEquippedItem = false,
|
||||||
keyDownFun = { a, b, c, d, e -> itemListKeyDownFun(a, b, c, d, e) },
|
keyDownFun = { a, b, c, d, e -> itemListKeyDownFun(a, b, c, d, e) },
|
||||||
@@ -68,6 +78,20 @@ class CraftingPlayerInventory(val full: UIInventoryFull, val crafting: UICanvas)
|
|||||||
itemList.getInventory = getter
|
itemList.getInventory = getter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline fun update(delta: Float) = itemList.update(delta)
|
||||||
|
inline fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) = itemList.render(frameDelta, batch, camera)
|
||||||
|
|
||||||
|
var posX: Int
|
||||||
|
get() = itemList.posX
|
||||||
|
set(value) { itemList.posX = value }
|
||||||
|
var posY: Int
|
||||||
|
get() = itemList.posY
|
||||||
|
set(value) { itemList.posY = value }
|
||||||
|
val width: Int
|
||||||
|
get() = itemList.width
|
||||||
|
val height: Int
|
||||||
|
get() = itemList.height
|
||||||
|
|
||||||
override fun getUIitems(): List<UIItem> {
|
override fun getUIitems(): List<UIItem> {
|
||||||
return listOf(itemList)
|
return listOf(itemList)
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ class UIWorldPortalCargo(val full: UIWorldPortal) : UICanvas(), HasInventory {
|
|||||||
fixture.add(item, amount)
|
fixture.add(item, amount)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun reject(fixture: FixtureInventory, player: FixtureInventory, item: GameItem, amount: Long) {
|
override fun refund(fixture: FixtureInventory, player: FixtureInventory, item: GameItem, amount: Long) {
|
||||||
fixture.remove(item, amount)
|
fixture.remove(item, amount)
|
||||||
player.add(item, amount)
|
player.add(item, amount)
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,6 @@ class UIWorldPortalCargo(val full: UIWorldPortal) : UICanvas(), HasInventory {
|
|||||||
catBar.selectionChangeListener = { old, new -> itemListUpdate() }
|
catBar.selectionChangeListener = { old, new -> itemListUpdate() }
|
||||||
itemListChest = UIItemInventoryItemGrid(
|
itemListChest = UIItemInventoryItemGrid(
|
||||||
this,
|
this,
|
||||||
catBar,
|
|
||||||
{ getFixtureInventory() },
|
{ getFixtureInventory() },
|
||||||
Toolkit.hdrawWidth - UIInventoryFull.getWidthOfCells(6) - halfSlotOffset,
|
Toolkit.hdrawWidth - UIInventoryFull.getWidthOfCells(6) - halfSlotOffset,
|
||||||
UIInventoryFull.INVENTORY_CELLS_OFFSET_Y(),
|
UIInventoryFull.INVENTORY_CELLS_OFFSET_Y(),
|
||||||
@@ -99,7 +98,7 @@ class UIWorldPortalCargo(val full: UIWorldPortal) : UICanvas(), HasInventory {
|
|||||||
touchDownFun = { gameItem, amount, button, _, _ ->
|
touchDownFun = { gameItem, amount, button, _, _ ->
|
||||||
if (button == App.getConfigInt("config_mouseprimary")) {
|
if (button == App.getConfigInt("config_mouseprimary")) {
|
||||||
if (gameItem != null) {
|
if (gameItem != null) {
|
||||||
negotiator.reject(getFixtureInventory(), getPlayerInventory(), gameItem, amount)
|
negotiator.refund(getFixtureInventory(), getPlayerInventory(), gameItem, amount)
|
||||||
}
|
}
|
||||||
itemListUpdate()
|
itemListUpdate()
|
||||||
}
|
}
|
||||||
@@ -111,7 +110,6 @@ class UIWorldPortalCargo(val full: UIWorldPortal) : UICanvas(), HasInventory {
|
|||||||
|
|
||||||
itemListPlayer = UIItemInventoryItemGrid(
|
itemListPlayer = UIItemInventoryItemGrid(
|
||||||
this,
|
this,
|
||||||
catBar,
|
|
||||||
{ INGAME.actorNowPlaying!!.inventory }, // literally a player's inventory
|
{ INGAME.actorNowPlaying!!.inventory }, // literally a player's inventory
|
||||||
Toolkit.hdrawWidth + halfSlotOffset,
|
Toolkit.hdrawWidth + halfSlotOffset,
|
||||||
UIInventoryFull.INVENTORY_CELLS_OFFSET_Y(),
|
UIInventoryFull.INVENTORY_CELLS_OFFSET_Y(),
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class UIItemCatBar(
|
|||||||
// val selectedIcon: Int
|
// val selectedIcon: Int
|
||||||
// get() = catArrangement[selectedIndex]
|
// get() = catArrangement[selectedIndex]
|
||||||
|
|
||||||
private val sideButtons: Array<UIItemImageButton>
|
private lateinit var sideButtons: Array<UIItemImageButton>
|
||||||
|
|
||||||
// set up all the buttons
|
// set up all the buttons
|
||||||
init {
|
init {
|
||||||
@@ -71,30 +71,32 @@ class UIItemCatBar(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// side buttons
|
if (showSideButtons) {
|
||||||
// NOTE: < > arrows must "highlightable = false"; "true" otherwise
|
|
||||||
// determine gaps: hacky way exploiting that we already know the catbar is always at the c of the ui
|
// side buttons
|
||||||
val relativeStartX = posX - (uiInternalWidth - width) / 2
|
// NOTE: < > arrows must "highlightable = false"; "true" otherwise
|
||||||
val sideButtonsGap = (((uiInternalWidth - width) / 2) - 2f * catIcons.tileW) / 3f
|
// determine gaps: hacky way exploiting that we already know the catbar is always at the c of the ui
|
||||||
val iconIndex = arrayOf(
|
val relativeStartX = posX - (uiInternalWidth - width) / 2
|
||||||
catIcons.get(9,1),
|
val sideButtonsGap = (((uiInternalWidth - width) / 2) - 2f * catIcons.tileW) / 3f
|
||||||
catIcons.get(16,0),
|
val iconIndex = arrayOf(
|
||||||
catIcons.get(17,0),
|
catIcons.get(9, 1),
|
||||||
catIcons.get(13,0)
|
catIcons.get(16, 0),
|
||||||
)
|
catIcons.get(17, 0),
|
||||||
|
catIcons.get(13, 0)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
//println("[UIItemInventoryCatBar] relativeStartX: $relativeStartX")
|
//println("[UIItemInventoryCatBar] relativeStartX: $relativeStartX")
|
||||||
//println("[UIItemInventoryCatBar] posX: $posX")
|
//println("[UIItemInventoryCatBar] posX: $posX")
|
||||||
|
|
||||||
sideButtons = Array(iconIndex.size) { index ->
|
sideButtons = Array(iconIndex.size) { index ->
|
||||||
val iconPosX = if (index < 2)
|
val iconPosX = if (index < 2)
|
||||||
(relativeStartX + sideButtonsGap + (sideButtonsGap + catIcons.tileW) * index).roundToInt()
|
(relativeStartX + sideButtonsGap + (sideButtonsGap + catIcons.tileW) * index).roundToInt()
|
||||||
else
|
else
|
||||||
(relativeStartX + width + 2 * sideButtonsGap + (sideButtonsGap + catIcons.tileW) * index).roundToInt()
|
(relativeStartX + width + 2 * sideButtonsGap + (sideButtonsGap + catIcons.tileW) * index).roundToInt()
|
||||||
val iconPosY = 0
|
val iconPosY = 0
|
||||||
|
|
||||||
UIItemImageButton(
|
UIItemImageButton(
|
||||||
inventoryUI,
|
inventoryUI,
|
||||||
iconIndex[index],
|
iconIndex[index],
|
||||||
activeBackCol = Color(0),
|
activeBackCol = Color(0),
|
||||||
@@ -106,7 +108,8 @@ class UIItemCatBar(
|
|||||||
inactiveCol = if (index == 0 || index == 3) Color.WHITE else Color(0xffffff7f.toInt()),
|
inactiveCol = if (index == 0 || index == 3) Color.WHITE else Color(0xffffff7f.toInt()),
|
||||||
activeCol = if (index == 0 || index == 3) Toolkit.Theme.COL_MOUSE_UP else Color(0xffffff7f.toInt()),
|
activeCol = if (index == 0 || index == 3) Toolkit.Theme.COL_MOUSE_UP else Color(0xffffff7f.toInt()),
|
||||||
highlightable = (index == 0 || index == 3)
|
highlightable = (index == 0 || index == 3)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,9 +139,9 @@ class UIItemCatBar(
|
|||||||
if (n !in 0..2) throw IllegalArgumentException("$n")
|
if (n !in 0..2) throw IllegalArgumentException("$n")
|
||||||
selectedPanel = n
|
selectedPanel = n
|
||||||
|
|
||||||
sideButtons[0].highlighted = (n == 0)
|
if (showSideButtons) sideButtons[0].highlighted = (n == 0)
|
||||||
mainButtons[selectedIndex].highlighted = (n == 1)
|
mainButtons[selectedIndex].highlighted = (n == 1)
|
||||||
sideButtons[3].highlighted = (n == 2)
|
if (showSideButtons) sideButtons[3].highlighted = (n == 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -214,8 +217,10 @@ class UIItemCatBar(
|
|||||||
if (selectedPanel == 1) {
|
if (selectedPanel == 1) {
|
||||||
btn.highlighted = (index == selectedIndex) // forcibly highlight if this.highlighted != null
|
btn.highlighted = (index == selectedIndex) // forcibly highlight if this.highlighted != null
|
||||||
|
|
||||||
sideButtons[0].highlighted = false
|
if (showSideButtons) {
|
||||||
sideButtons[3].highlighted = false
|
sideButtons[0].highlighted = false
|
||||||
|
sideButtons[3].highlighted = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ class UIItemInventoryElemSimple(
|
|||||||
parentUI: UICanvas,
|
parentUI: UICanvas,
|
||||||
initialX: Int,
|
initialX: Int,
|
||||||
initialY: Int,
|
initialY: Int,
|
||||||
override var item: GameItem?,
|
override var item: GameItem? = null,
|
||||||
override var amount: Long,
|
override var amount: Long = UIItemInventoryElemWide.UNIQUE_ITEM_HAS_NO_AMOUNT,
|
||||||
override var itemImage: TextureRegion?,
|
override var itemImage: TextureRegion? = null,
|
||||||
override var quickslot: Int? = null,
|
override var quickslot: Int? = null,
|
||||||
override var equippedSlot: Int? = null, // remnants of wide cell displaying slot number and highlighting; in this style of cell this field only determines highlightedness at render
|
override var equippedSlot: Int? = null, // remnants of wide cell displaying slot number and highlighting; in this style of cell this field only determines highlightedness at render
|
||||||
val drawBackOnNull: Boolean = true,
|
val drawBackOnNull: Boolean = true,
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ class UIItemInventoryElemWide(
|
|||||||
initialX: Int,
|
initialX: Int,
|
||||||
initialY: Int,
|
initialY: Int,
|
||||||
override val width: Int,
|
override val width: Int,
|
||||||
override var item: GameItem?,
|
override var item: GameItem? = null,
|
||||||
override var amount: Long,
|
override var amount: Long = UIItemInventoryElemWide.UNIQUE_ITEM_HAS_NO_AMOUNT,
|
||||||
override var itemImage: TextureRegion?,
|
override var itemImage: TextureRegion? = null,
|
||||||
override var quickslot: Int? = null,
|
override var quickslot: Int? = null,
|
||||||
override var equippedSlot: Int? = null,
|
override var equippedSlot: Int? = null,
|
||||||
val drawBackOnNull: Boolean = true,
|
val drawBackOnNull: Boolean = true,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
|||||||
*/
|
*/
|
||||||
class UITemplateCatBar(
|
class UITemplateCatBar(
|
||||||
parent: UICanvas,
|
parent: UICanvas,
|
||||||
|
showSidebuttons: Boolean,
|
||||||
|
|
||||||
catIcons: TextureRegionPack = CommonResourcePool.getAsTextureRegionPack("inventory_category"),
|
catIcons: TextureRegionPack = CommonResourcePool.getAsTextureRegionPack("inventory_category"),
|
||||||
catArrangement: IntArray, // icon order
|
catArrangement: IntArray, // icon order
|
||||||
@@ -26,7 +27,7 @@ class UITemplateCatBar(
|
|||||||
42 - UIInventoryFull.YPOS_CORRECTION + (App.scr.height - UIInventoryFull.internalHeight) / 2,
|
42 - UIInventoryFull.YPOS_CORRECTION + (App.scr.height - UIInventoryFull.internalHeight) / 2,
|
||||||
UIInventoryFull.internalWidth,
|
UIInventoryFull.internalWidth,
|
||||||
UIInventoryFull.catBarWidth,
|
UIInventoryFull.catBarWidth,
|
||||||
true,
|
showSidebuttons,
|
||||||
catIcons, catArrangement, catIconsMeaning, catIconsLabels
|
catIcons, catArrangement, catIconsMeaning, catIconsLabels
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user