mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-17 00:56:07 +09:00
at least some of the new UIs are working
This commit is contained in:
2
.idea/codeStyleSettings.xml
generated
2
.idea/codeStyleSettings.xml
generated
@@ -33,6 +33,8 @@
|
|||||||
<option name="WRAP_ON_TYPING" value="0" />
|
<option name="WRAP_ON_TYPING" value="0" />
|
||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
<codeStyleSettings language="kotlin">
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="5" />
|
||||||
|
<option name="KEEP_BLANK_LINES_IN_CODE" value="5" />
|
||||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||||
|
|||||||
Binary file not shown.
@@ -312,16 +312,20 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
|||||||
|
|
||||||
// >- queue up game UIs that should pause the world -<
|
// >- queue up game UIs that should pause the world -<
|
||||||
// inventory
|
// inventory
|
||||||
uiInventoryPlayer = UIInventory(player,
|
/*uiInventoryPlayer = UIInventory(player,
|
||||||
width = 900,
|
width = 900,
|
||||||
height = Terrarum.HEIGHT - 160,
|
height = Terrarum.HEIGHT - 160,
|
||||||
categoryWidth = 210,
|
categoryWidth = 210,
|
||||||
toggleKeyLiteral = Terrarum.getConfigInt("keyinventory")
|
toggleKeyLiteral = Terrarum.getConfigInt("keyinventory")
|
||||||
)
|
)*/
|
||||||
uiInventoryPlayer.setPosition(
|
/*uiInventoryPlayer.setPosition(
|
||||||
-uiInventoryPlayer.width,
|
-uiInventoryPlayer.width,
|
||||||
70
|
70
|
||||||
|
)*/
|
||||||
|
uiInventoryPlayer = UIInventoryFull(player,
|
||||||
|
toggleKeyLiteral = Terrarum.getConfigInt("keyinventory")
|
||||||
)
|
)
|
||||||
|
uiInventoryPlayer.setPosition(0, 0)
|
||||||
|
|
||||||
// >- lesser UIs -<
|
// >- lesser UIs -<
|
||||||
// quick bar
|
// quick bar
|
||||||
@@ -904,7 +908,12 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
|||||||
// draw some overlays (UI) //
|
// draw some overlays (UI) //
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
|
|
||||||
uiContainer.forEach { if (it != consoleHandler) it.render(batch, camera) }
|
uiContainer.forEach {
|
||||||
|
if (it != consoleHandler) {
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
it.render(batch, camera)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
debugWindow.render(batch, camera)
|
debugWindow.render(batch, camera)
|
||||||
// make sure console draws on top of other UIs
|
// make sure console draws on top of other UIs
|
||||||
@@ -1447,12 +1456,12 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
|||||||
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
|
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
|
||||||
|
|
||||||
// inventory
|
// inventory
|
||||||
uiInventoryPlayer =
|
/*uiInventoryPlayer =
|
||||||
UIInventory(player,
|
UIInventory(player,
|
||||||
width = 840,
|
width = 840,
|
||||||
height = Terrarum.HEIGHT - 160,
|
height = Terrarum.HEIGHT - 160,
|
||||||
categoryWidth = 210
|
categoryWidth = 210
|
||||||
)
|
)*/
|
||||||
|
|
||||||
|
|
||||||
// basic watch-style notification bar (temperature, new mail)
|
// basic watch-style notification bar (temperature, new mail)
|
||||||
|
|||||||
157
src/net/torvald/terrarum/UIItemInventoryCatBar.kt
Normal file
157
src/net/torvald/terrarum/UIItemInventoryCatBar.kt
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
package net.torvald.terrarum
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.Pixmap
|
||||||
|
import com.badlogic.gdx.graphics.Texture
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import net.torvald.terrarum.gameactors.Second
|
||||||
|
import net.torvald.terrarum.gameactors.floorInt
|
||||||
|
import net.torvald.terrarum.gameactors.roundInt
|
||||||
|
import net.torvald.terrarum.ui.*
|
||||||
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2017-10-20.
|
||||||
|
*/
|
||||||
|
class UIItemInventoryCatBar(
|
||||||
|
parentUI: UICanvas,
|
||||||
|
override var posX: Int,
|
||||||
|
override var posY: Int,
|
||||||
|
override val width: Int,
|
||||||
|
val catIcons: TextureRegionPack = TextureRegionPack("./assets/graphics/gui/inventory/category.tga", 20, 20),
|
||||||
|
val catArrangement: IntArray = intArrayOf(9,6,7,1,0,2,3,4,5,8)
|
||||||
|
) : UIItem(parentUI) {
|
||||||
|
|
||||||
|
private val inventoryUI = parentUI
|
||||||
|
override val height = catIcons.tileH + 5
|
||||||
|
|
||||||
|
|
||||||
|
private val buttons: Array<UIItemImageButton>
|
||||||
|
private val buttonGapSize = (width.toFloat() - (catArrangement.size * catIcons.tileW)) / (catArrangement.size + 1f)
|
||||||
|
var selectedIndex = 0 // default to ALL
|
||||||
|
private set
|
||||||
|
val selectedIcon: Int
|
||||||
|
get() = catArrangement[selectedIndex]
|
||||||
|
private val catSelectionOld = 0 // default to ALL
|
||||||
|
|
||||||
|
// set up buttons
|
||||||
|
init {
|
||||||
|
// place sub UIs: Image Buttons
|
||||||
|
buttons = Array(catArrangement.size, { index ->
|
||||||
|
val iconPosX = (buttonGapSize + catIcons.tileW).roundInt()
|
||||||
|
val iconPosY = 0
|
||||||
|
|
||||||
|
UIItemImageButton(
|
||||||
|
inventoryUI,
|
||||||
|
catIcons.get(catArrangement[index], 0),
|
||||||
|
activeBackCol = Color(0),
|
||||||
|
activeBackBlendMode = BlendMode.NORMAL,
|
||||||
|
posX = posX + iconPosX,
|
||||||
|
posY = posY + iconPosY,
|
||||||
|
highlightable = true
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private val underlineIndTex: Texture
|
||||||
|
private val underlineColour = Color(0xeaeaea_40.toInt())
|
||||||
|
private val underlineHighlightColour = buttons[0].highlightCol
|
||||||
|
private var highlighterXStart = 0.0 // left-end position
|
||||||
|
private var highlighterXEnd = 0.0 // left-end position
|
||||||
|
private var highlighterXPos = 0.0 // left-end position
|
||||||
|
private val highlighterYPos = catIcons.tileH + 5f
|
||||||
|
private var highlighterMoving = false
|
||||||
|
private val highlighterMoveDuration: Second = 0.1f
|
||||||
|
private var highlighterMoveTimer: Second = 0f
|
||||||
|
|
||||||
|
// set up underlined indicator
|
||||||
|
init {
|
||||||
|
// procedurally generate texture
|
||||||
|
val pixmap = Pixmap(catIcons.tileW + buttonGapSize.floorInt(), 1, Pixmap.Format.RGBA8888)
|
||||||
|
for (x in 0 until pixmap.width.plus(1).ushr(1)) { // eqv. of ceiling the half-int
|
||||||
|
val col = if (x == 0) 0xffffff_80.toInt()
|
||||||
|
else if (x == 1) 0xffffff_c0.toInt()
|
||||||
|
else 0xffffff_ff.toInt()
|
||||||
|
|
||||||
|
pixmap.drawPixel(x, 0, col)
|
||||||
|
pixmap.drawPixel(pixmap.width - (x + 1), 0, col)
|
||||||
|
}
|
||||||
|
underlineIndTex = Texture(pixmap)
|
||||||
|
underlineIndTex.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
||||||
|
pixmap.dispose() // FIXME is this how it's supposed to work? (still a noob)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** (oldIndex: Int?, newIndex: Int) -> Unit */
|
||||||
|
var selectionChangeListener: ((Int?, Int) -> Unit)? = null
|
||||||
|
|
||||||
|
override fun update(delta: Float) {
|
||||||
|
super.update(delta)
|
||||||
|
|
||||||
|
|
||||||
|
if (highlighterMoving) {
|
||||||
|
highlighterMoveTimer += delta
|
||||||
|
|
||||||
|
if (selectedIndex != null) {
|
||||||
|
highlighterXPos = UIUtils.moveQuick(
|
||||||
|
highlighterXStart,
|
||||||
|
highlighterXEnd,
|
||||||
|
highlighterMoveTimer.toDouble(),
|
||||||
|
highlighterMoveDuration.toDouble()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (highlighterMoveTimer > highlighterMoveDuration) {
|
||||||
|
highlighterMoveTimer = 0f
|
||||||
|
highlighterXStart = highlighterXEnd
|
||||||
|
highlighterXPos = highlighterXEnd
|
||||||
|
highlighterMoving = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
buttons.forEachIndexed { index, btn ->
|
||||||
|
btn.update(delta)
|
||||||
|
|
||||||
|
|
||||||
|
if (btn.mousePushed && index != selectedIndex) {
|
||||||
|
val oldIndex = selectedIndex
|
||||||
|
|
||||||
|
highlighterXStart = buttons[selectedIndex].posY.toDouble()
|
||||||
|
selectedIndex = index
|
||||||
|
highlighterMoving = true
|
||||||
|
highlighterXEnd = buttons[selectedIndex].posY.toDouble()
|
||||||
|
|
||||||
|
selectionChangeListener?.invoke(oldIndex, index)
|
||||||
|
}
|
||||||
|
btn.highlighted = (index == selectedIndex) // forcibly highlight if this.highlighted != null
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
|
super.render(batch, camera)
|
||||||
|
|
||||||
|
// button
|
||||||
|
// colour determined by UI items themselves
|
||||||
|
buttons.forEach { it.render(batch, camera) }
|
||||||
|
|
||||||
|
// underline
|
||||||
|
batch.color = underlineColour
|
||||||
|
batch.drawStraightLine(posX.toFloat(), posY + height - 1f, width.toFloat(), 1f, false)
|
||||||
|
|
||||||
|
// indicator
|
||||||
|
batch.color = underlineHighlightColour
|
||||||
|
batch.draw(underlineIndTex, (posX + highlighterXPos).toFloat().round(), posY + highlighterYPos)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
override fun dispose() {
|
||||||
|
underlineIndTex.dispose()
|
||||||
|
catIcons.dispose()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
package net.torvald.terrarum
|
package net.torvald.terrarum
|
||||||
|
|
||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
import net.torvald.colourutil.CIELabUtil.darkerLab
|
import net.torvald.colourutil.CIELabUtil.darkerLab
|
||||||
import net.torvald.terrarum.itemproperties.GameItem
|
import net.torvald.terrarum.itemproperties.GameItem
|
||||||
import net.torvald.terrarum.ui.UIInventory
|
import net.torvald.terrarum.ui.*
|
||||||
import net.torvald.terrarum.ui.UIItem
|
|
||||||
import net.torvald.terrarum.ui.UIItemTextButton
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Note that the UI will not render if either item or itemImage is null.
|
* Note that the UI will not render if either item or itemImage is null.
|
||||||
@@ -16,27 +15,31 @@ import net.torvald.terrarum.ui.UIItemTextButton
|
|||||||
* Created by minjaesong on 2017-03-16.
|
* Created by minjaesong on 2017-03-16.
|
||||||
*/
|
*/
|
||||||
class UIItemInventoryElem(
|
class UIItemInventoryElem(
|
||||||
parentUI: UIInventory,
|
parentUI: UIInventoryFull,
|
||||||
override var posX: Int,
|
override var posX: Int,
|
||||||
override var posY: Int,
|
override var posY: Int,
|
||||||
override val width: Int,
|
override val width: Int,
|
||||||
var item: GameItem?,
|
override var item: GameItem?,
|
||||||
var amount: Int,
|
override var amount: Int,
|
||||||
var itemImage: TextureRegion?,
|
override var itemImage: TextureRegion?,
|
||||||
val mouseOverTextCol: Color = Color(0xfff066_ff.toInt()),
|
val mouseOverTextCol: Color = Color(0xfff066_ff.toInt()),
|
||||||
val mouseoverBackCol: Color = Color(0),
|
val mouseoverBackCol: Color = Color(0),
|
||||||
val mouseoverBackBlendMode: String = BlendMode.NORMAL,
|
val mouseoverBackBlendMode: String = BlendMode.NORMAL,
|
||||||
val inactiveTextCol: Color = UIItemTextButton.defaultInactiveCol,
|
val inactiveTextCol: Color = UIItemTextButton.defaultInactiveCol,
|
||||||
val backCol: Color = Color(0),
|
val backCol: Color = Color(0),
|
||||||
val backBlendMode: String = BlendMode.NORMAL,
|
val backBlendMode: String = BlendMode.NORMAL,
|
||||||
var quickslot: Int? = null,
|
override var quickslot: Int? = null,
|
||||||
var equippedSlot: Int? = null,
|
override var equippedSlot: Int? = null,
|
||||||
val drawBackOnNull: Boolean = true
|
val drawBackOnNull: Boolean = true
|
||||||
) : UIItem(parentUI) {
|
) : UIItemInventoryCellBase(parentUI, posX, posY, item, amount, itemImage, quickslot, equippedSlot) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val height = 48
|
val height = 48
|
||||||
val UNIQUE_ITEM_HAS_NO_AMOUNT = -1
|
val UNIQUE_ITEM_HAS_NO_AMOUNT = -1
|
||||||
|
|
||||||
|
internal val durabilityCol = Color(0x22ff11_ff)
|
||||||
|
internal val durabilityBack: Color; get() = durabilityCol.darkerLab(0.4f)
|
||||||
|
internal val durabilityBarThickness = 3f
|
||||||
}
|
}
|
||||||
|
|
||||||
private val inventoryUI = parentUI
|
private val inventoryUI = parentUI
|
||||||
@@ -49,8 +52,7 @@ class UIItemInventoryElem(
|
|||||||
private val textOffsetY = 8f
|
private val textOffsetY = 8f
|
||||||
|
|
||||||
|
|
||||||
private val durabilityCol = Color(0x22ff11_ff)
|
|
||||||
private val durabilityBack: Color; get() = durabilityCol.darkerLab(0.4f)
|
|
||||||
private val durabilityBarOffY = 35f
|
private val durabilityBarOffY = 35f
|
||||||
|
|
||||||
|
|
||||||
@@ -63,7 +65,7 @@ class UIItemInventoryElem(
|
|||||||
|
|
||||||
private val fwsp = 0x3000.toChar()
|
private val fwsp = 0x3000.toChar()
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch) {
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
|
|
||||||
// mouseover background
|
// mouseover background
|
||||||
if (item != null || drawBackOnNull) {
|
if (item != null || drawBackOnNull) {
|
||||||
@@ -91,6 +93,7 @@ class UIItemInventoryElem(
|
|||||||
// if mouse is over, text lights up
|
// if mouse is over, text lights up
|
||||||
// this one-liner sets color
|
// this one-liner sets color
|
||||||
batch.color = item!!.nameColour mul if (mouseUp) mouseOverTextCol else inactiveTextCol
|
batch.color = item!!.nameColour mul if (mouseUp) mouseOverTextCol else inactiveTextCol
|
||||||
|
// draw name of the item
|
||||||
Terrarum.fontGame.draw(batch,
|
Terrarum.fontGame.draw(batch,
|
||||||
//"$item" + (if (amount > 0 && item!!.stackable) "$fwsp($amount)" else if (amount != 1) "$fwsp!!$amount!!" else "") +
|
//"$item" + (if (amount > 0 && item!!.stackable) "$fwsp($amount)" else if (amount != 1) "$fwsp!!$amount!!" else "") +
|
||||||
item!!.name + (if (amount > 0 && item!!.stackable) "$fwsp($amount)" else if (amount != 1) "$fwsp!!$amount!!" else "") +
|
item!!.name + (if (amount > 0 && item!!.stackable) "$fwsp($amount)" else if (amount != 1) "$fwsp!!$amount!!" else "") +
|
||||||
@@ -105,9 +108,9 @@ class UIItemInventoryElem(
|
|||||||
val barOffset = posX + textOffsetX
|
val barOffset = posX + textOffsetX
|
||||||
if (item!!.maxDurability > 0.0) {
|
if (item!!.maxDurability > 0.0) {
|
||||||
batch.color = durabilityBack
|
batch.color = durabilityBack
|
||||||
batch.drawStraightLine(barOffset, posY + durabilityBarOffY, barOffset + barFullLen, 3f, false)
|
batch.drawStraightLine(barOffset, posY + durabilityBarOffY, barOffset + barFullLen, durabilityBarThickness, false)
|
||||||
batch.color = durabilityCol
|
batch.color = durabilityCol
|
||||||
batch.drawStraightLine(barOffset, posY + durabilityBarOffY, barOffset + barFullLen * (item!!.durability / item!!.maxDurability), 3f, false)
|
batch.drawStraightLine(barOffset, posY + durabilityBarOffY, barOffset + barFullLen * (item!!.durability / item!!.maxDurability), durabilityBarThickness, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -134,7 +137,7 @@ class UIItemInventoryElem(
|
|||||||
val currentSlotItem = inventory?.getQuickBar(slot)
|
val currentSlotItem = inventory?.getQuickBar(slot)
|
||||||
|
|
||||||
|
|
||||||
inventory?.setQuickBar(
|
inventory.setQuickBar(
|
||||||
slot,
|
slot,
|
||||||
if (currentSlotItem?.item != item)
|
if (currentSlotItem?.item != item)
|
||||||
item?.dynamicID // register
|
item?.dynamicID // register
|
||||||
@@ -145,8 +148,8 @@ class UIItemInventoryElem(
|
|||||||
// search for duplicates in the quickbar, except mine
|
// search for duplicates in the quickbar, except mine
|
||||||
// if there is, unregister the other
|
// if there is, unregister the other
|
||||||
(0..9).minus(slot).forEach {
|
(0..9).minus(slot).forEach {
|
||||||
if (inventory?.getQuickBar(it)?.item == item) {
|
if (inventory.getQuickBar(it)?.item == item) {
|
||||||
inventory?.setQuickBar(it, null)
|
inventory.setQuickBar(it, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,7 +164,7 @@ class UIItemInventoryElem(
|
|||||||
val itemEquipSlot = item!!.equipPosition
|
val itemEquipSlot = item!!.equipPosition
|
||||||
val player = Terrarum.ingame!!.player
|
val player = Terrarum.ingame!!.player
|
||||||
|
|
||||||
if (item != player.inventory?.itemEquipped?.get(itemEquipSlot)) { // if this item is unequipped, equip it
|
if (item != player.inventory.itemEquipped.get(itemEquipSlot)) { // if this item is unequipped, equip it
|
||||||
player.equipItem(item!!)
|
player.equipItem(item!!)
|
||||||
}
|
}
|
||||||
else { // if not, unequip it
|
else { // if not, unequip it
|
||||||
|
|||||||
184
src/net/torvald/terrarum/UIItemInventoryElemSimple.kt
Normal file
184
src/net/torvald/terrarum/UIItemInventoryElemSimple.kt
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
package net.torvald.terrarum
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Input
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
|
import net.torvald.terrarum.itemproperties.GameItem
|
||||||
|
import net.torvald.terrarum.ui.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2017-10-20.
|
||||||
|
*/
|
||||||
|
class UIItemInventoryElemSimple(
|
||||||
|
parentUI: UIInventoryFull,
|
||||||
|
override var posX: Int,
|
||||||
|
override var posY: Int,
|
||||||
|
override var item: GameItem?,
|
||||||
|
override var amount: Int,
|
||||||
|
override var itemImage: TextureRegion?,
|
||||||
|
val mouseOverTextCol: Color = Color(0xfff066_ff.toInt()),
|
||||||
|
val mouseoverBackCol: Color = Color(0),
|
||||||
|
val mouseoverBackBlendMode: String = BlendMode.NORMAL,
|
||||||
|
val inactiveTextCol: Color = UIItemTextButton.defaultInactiveCol,
|
||||||
|
val backCol: Color = Color(0),
|
||||||
|
val backBlendMode: String = BlendMode.NORMAL,
|
||||||
|
override var quickslot: Int? = null,
|
||||||
|
override var equippedSlot: Int? = null,
|
||||||
|
val drawBackOnNull: Boolean = true
|
||||||
|
) : UIItemInventoryCellBase(parentUI, posX, posY, item, amount, itemImage, quickslot, equippedSlot) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val height = UIItemInventoryElem.height
|
||||||
|
}
|
||||||
|
|
||||||
|
private val inventoryUI = parentUI
|
||||||
|
|
||||||
|
override val width = UIItemInventoryElemSimple.height
|
||||||
|
override val height = UIItemInventoryElemSimple.height
|
||||||
|
|
||||||
|
private val imgOffset: Float
|
||||||
|
get() = (this.height - itemImage!!.regionHeight).div(2).toFloat() // to snap to the pixel grid
|
||||||
|
|
||||||
|
override fun update(delta: Float) {
|
||||||
|
if (item != null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
|
// mouseover background
|
||||||
|
if (item != null || drawBackOnNull) {
|
||||||
|
// do not highlight even if drawBackOnNull is true
|
||||||
|
if (mouseUp && item != null) {
|
||||||
|
BlendMode.resolve(mouseoverBackBlendMode)
|
||||||
|
batch.color = mouseoverBackCol
|
||||||
|
}
|
||||||
|
// if drawBackOnNull, just draw background
|
||||||
|
else {
|
||||||
|
BlendMode.resolve(backBlendMode)
|
||||||
|
batch.color = backCol
|
||||||
|
}
|
||||||
|
batch.fillRect(posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// quickslot and equipped slot indicator is not needed as it's intended for blocks and walls
|
||||||
|
// and you can clearly see the quickslot UI anyway
|
||||||
|
|
||||||
|
if (item != null && itemImage != null) {
|
||||||
|
blendNormal()
|
||||||
|
|
||||||
|
// item image
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
batch.draw(itemImage, posX + imgOffset, posY + imgOffset)
|
||||||
|
|
||||||
|
// if mouse is over, text lights up
|
||||||
|
// this one-liner sets color
|
||||||
|
batch.color = item!!.nameColour mul if (mouseUp) mouseOverTextCol else inactiveTextCol
|
||||||
|
|
||||||
|
|
||||||
|
// if item has durability, draw that and don't draw count; durability and itemCount cannot coexist
|
||||||
|
if (item!!.maxDurability > 0.0) {
|
||||||
|
// draw durability metre
|
||||||
|
val barFullLen = width
|
||||||
|
val barOffset = posX.toFloat()
|
||||||
|
val thickness = UIItemInventoryElem.durabilityBarThickness
|
||||||
|
if (item!!.maxDurability > 0.0) {
|
||||||
|
batch.color = UIItemInventoryElem.durabilityBack
|
||||||
|
batch.drawStraightLine(barOffset, posY + height - thickness, barOffset + barFullLen, thickness, false)
|
||||||
|
batch.color = UIItemInventoryElem.durabilityCol
|
||||||
|
batch.drawStraightLine(barOffset, posY + height - thickness, barOffset + barFullLen * (item!!.durability / item!!.maxDurability), thickness, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// draw item count
|
||||||
|
val amountString = amount.toString()
|
||||||
|
Terrarum.fontSmallNumbers.draw(batch,
|
||||||
|
amountString,
|
||||||
|
posX + (width - Terrarum.fontSmallNumbers.getWidth(amountString)).toFloat(),
|
||||||
|
posY + (height - Terrarum.fontSmallNumbers.H).toFloat()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// see IFs above?
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun keyDown(keycode: Int): Boolean {
|
||||||
|
if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_1..Input.Keys.NUM_0) {
|
||||||
|
val inventory = Terrarum.ingame!!.player.inventory
|
||||||
|
val slot = if (keycode == Input.Keys.NUM_0) 9 else keycode - Input.Keys.NUM_1
|
||||||
|
val currentSlotItem = inventory?.getQuickBar(slot)
|
||||||
|
|
||||||
|
|
||||||
|
inventory.setQuickBar(
|
||||||
|
slot,
|
||||||
|
if (currentSlotItem?.item != item)
|
||||||
|
item?.dynamicID // register
|
||||||
|
else
|
||||||
|
null // drop registration
|
||||||
|
)
|
||||||
|
|
||||||
|
// search for duplicates in the quickbar, except mine
|
||||||
|
// if there is, unregister the other
|
||||||
|
(0..9).minus(slot).forEach {
|
||||||
|
if (inventory.getQuickBar(it)?.item == item) {
|
||||||
|
inventory.setQuickBar(it, null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||||
|
if (item != null && Terrarum.ingame != null) {
|
||||||
|
|
||||||
|
// equip da shit
|
||||||
|
val itemEquipSlot = item!!.equipPosition
|
||||||
|
val player = Terrarum.ingame!!.player
|
||||||
|
|
||||||
|
if (item != player.inventory.itemEquipped.get(itemEquipSlot)) { // if this item is unequipped, equip it
|
||||||
|
player.equipItem(item!!)
|
||||||
|
}
|
||||||
|
else { // if not, unequip it
|
||||||
|
player.unequipItem(item!!)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inventoryUI.rebuildList()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun dispose() {
|
||||||
|
itemImage?.texture?.dispose()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun keyUp(keycode: Int): Boolean {
|
||||||
|
return super.keyUp(keycode)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
|
||||||
|
return super.mouseMoved(screenX, screenY)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
|
||||||
|
return super.touchDragged(screenX, screenY, pointer)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||||
|
return super.touchUp(screenX, screenY, pointer, button)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun scrolled(amount: Int): Boolean {
|
||||||
|
return super.scrolled(amount)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ import net.torvald.terrarum.gameworld.GameWorld
|
|||||||
import net.torvald.terrarum.itemproperties.GameItem
|
import net.torvald.terrarum.itemproperties.GameItem
|
||||||
import net.torvald.terrarum.itemproperties.Material
|
import net.torvald.terrarum.itemproperties.Material
|
||||||
import net.torvald.terrarum.realestate.LandUtil
|
import net.torvald.terrarum.realestate.LandUtil
|
||||||
import net.torvald.terrarum.ui.UIInventory
|
import net.torvald.terrarum.ui.UIInventoryFull
|
||||||
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@@ -530,7 +530,7 @@ open class ActorHumanoid(
|
|||||||
|
|
||||||
// force update inventory UI
|
// force update inventory UI
|
||||||
try {
|
try {
|
||||||
(Terrarum.ingame!!.uiInventoryPlayer as UIInventory).shutUpAndRebuild()
|
(Terrarum.ingame!!.uiInventoryPlayer as UIInventoryFull).rebuildList()
|
||||||
}
|
}
|
||||||
catch (LateInitMyArse: kotlin.UninitializedPropertyAccessException) { }
|
catch (LateInitMyArse: kotlin.UninitializedPropertyAccessException) { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ class ActorInventory(val actor: Pocketed, var maxCapacity: Int, var capacityMode
|
|||||||
val itemList = ArrayList<InventoryPair>()
|
val itemList = ArrayList<InventoryPair>()
|
||||||
val quickBar = Array<ItemID?>(10, { null }) // 0: Slot 1, 9: Slot 10
|
val quickBar = Array<ItemID?>(10, { null }) // 0: Slot 1, 9: Slot 10
|
||||||
|
|
||||||
|
var currency = 0 // unified currency for whole civs; Dwarf Fortress approach seems too complicated
|
||||||
|
|
||||||
init {
|
init {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -296,4 +296,5 @@ abstract class UICanvas(
|
|||||||
LEFT, RIGHT, TOP, BOTTOM
|
LEFT, RIGHT, TOP, BOTTOM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import java.util.*
|
|||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2017-03-13.
|
* Created by minjaesong on 2017-03-13.
|
||||||
*/
|
*/
|
||||||
class UIInventory(
|
/*class UIInventory(
|
||||||
var actor: Pocketed?,
|
var actor: Pocketed?,
|
||||||
override var width: Int,
|
override var width: Int,
|
||||||
override var height: Int,
|
override var height: Int,
|
||||||
@@ -133,14 +133,16 @@ class UIInventory(
|
|||||||
posX = categoryWidth,
|
posX = categoryWidth,
|
||||||
posY = 0,//(height - controlHelpHeight - scrollImageButtonAtlas.tileH) / 2,
|
posY = 0,//(height - controlHelpHeight - scrollImageButtonAtlas.tileH) / 2,
|
||||||
width = scrollImageButtonAtlas.tileW,
|
width = scrollImageButtonAtlas.tileW,
|
||||||
height = height - controlHelpHeight
|
height = height - controlHelpHeight,
|
||||||
|
highlightable = false
|
||||||
)
|
)
|
||||||
private val scrollRightButton = UIItemImageButton(this,
|
private val scrollRightButton = UIItemImageButton(this,
|
||||||
scrollImageButtonAtlas.get(1, 0),
|
scrollImageButtonAtlas.get(1, 0),
|
||||||
posX = width - scrollImageButtonAtlas.tileW,
|
posX = width - scrollImageButtonAtlas.tileW,
|
||||||
posY = 0,//(height - controlHelpHeight - scrollImageButtonAtlas.tileH) / 2,
|
posY = 0,//(height - controlHelpHeight - scrollImageButtonAtlas.tileH) / 2,
|
||||||
width = scrollImageButtonAtlas.tileW,
|
width = scrollImageButtonAtlas.tileW,
|
||||||
height = height - controlHelpHeight
|
height = height - controlHelpHeight,
|
||||||
|
highlightable = false
|
||||||
)
|
)
|
||||||
var itemPage = 0
|
var itemPage = 0
|
||||||
var itemPageCount = 1 // TODO total size of current category / items.size
|
var itemPageCount = 1 // TODO total size of current category / items.size
|
||||||
@@ -240,14 +242,14 @@ class UIInventory(
|
|||||||
batch.color = Color(0xcccccc_ff.toInt())
|
batch.color = Color(0xcccccc_ff.toInt())
|
||||||
batch.fillRect(0f, 0f, catButtons.width.toFloat(), height.toFloat())
|
batch.fillRect(0f, 0f, catButtons.width.toFloat(), height.toFloat())
|
||||||
|
|
||||||
catButtons.render(batch)
|
catButtons.render(batch, camera)
|
||||||
|
|
||||||
// left/right page mover
|
// left/right page mover
|
||||||
scrollLeftButton.render(batch)
|
scrollLeftButton.render(batch, camera)
|
||||||
scrollRightButton.render(batch)
|
scrollRightButton.render(batch, camera)
|
||||||
|
|
||||||
items.forEach {
|
items.forEach {
|
||||||
it.render(batch)
|
it.render(batch, camera)
|
||||||
}
|
}
|
||||||
|
|
||||||
// texts
|
// texts
|
||||||
@@ -322,7 +324,7 @@ class UIInventory(
|
|||||||
inventorySortList.sortBy { it.item.name }
|
inventorySortList.sortBy { it.item.name }
|
||||||
|
|
||||||
// map sortList to item list
|
// map sortList to item list
|
||||||
for (k in 0..items.size - 1) {
|
for (k in 0 until items.size) {
|
||||||
// we have an item
|
// we have an item
|
||||||
try {
|
try {
|
||||||
val sortListItem = inventorySortList[k + itemPage * items.size]
|
val sortListItem = inventorySortList[k + itemPage * items.size]
|
||||||
@@ -427,3 +429,4 @@ class UIInventory(
|
|||||||
scrollImageButtonAtlas.dispose()
|
scrollImageButtonAtlas.dispose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|||||||
164
src/net/torvald/terrarum/ui/UIInventoryFull.kt
Normal file
164
src/net/torvald/terrarum/ui/UIInventoryFull.kt
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import net.torvald.terrarum.RunningEnvironment
|
||||||
|
import net.torvald.terrarum.Terrarum
|
||||||
|
import net.torvald.terrarum.UIItemInventoryCatBar
|
||||||
|
import net.torvald.terrarum.gameactors.InventoryPair
|
||||||
|
import net.torvald.terrarum.gameactors.Pocketed
|
||||||
|
import net.torvald.terrarum.gameactors.Second
|
||||||
|
import net.torvald.terrarum.itemproperties.GameItem
|
||||||
|
import net.torvald.terrarum.langpack.Lang
|
||||||
|
import java.util.ArrayList
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2017-10-21.
|
||||||
|
*/
|
||||||
|
class UIInventoryFull(
|
||||||
|
var actor: Pocketed?,
|
||||||
|
|
||||||
|
toggleKeyLiteral: Int? = null, toggleButtonLiteral: Int? = null,
|
||||||
|
// UI positions itself? (you must g.flush() yourself after the g.translate(Int, Int))
|
||||||
|
customPositioning: Boolean = false, // mainly used by vital meter
|
||||||
|
doNotWarnConstant: Boolean = false
|
||||||
|
) : UICanvas(toggleKeyLiteral, toggleButtonLiteral, customPositioning, doNotWarnConstant) {
|
||||||
|
|
||||||
|
override var width: Int = Terrarum.WIDTH
|
||||||
|
override var height: Int = Terrarum.HEIGHT
|
||||||
|
|
||||||
|
val internalWidth: Int = 630
|
||||||
|
val internalHeight: Int = 558 // grad_begin..grad_end..contents..grad_begin..grad_end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private val SP = "${0x3000.toChar()}${0x3000.toChar()}"
|
||||||
|
val listControlHelp: String
|
||||||
|
get() = if (Terrarum.environment == RunningEnvironment.PC)
|
||||||
|
"${0xe037.toChar()} ${Lang["GAME_ACTION_CLOSE"]}$SP" +
|
||||||
|
"${0xe006.toChar()} ${Lang["GAME_INVENTORY_USE"]}$SP" +
|
||||||
|
"${0xe011.toChar()}..${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
|
||||||
|
"${0xe034.toChar()} ${Lang["GAME_INVENTORY_DROP"]}"
|
||||||
|
else
|
||||||
|
"${0xe069.toChar()} ${Lang["GAME_ACTION_CLOSE"]}$SP" +
|
||||||
|
"${Terrarum.joypadLabelNinY} ${Lang["GAME_INVENTORY_USE"]}$SP" +
|
||||||
|
"${0xe011.toChar()}${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
|
||||||
|
"${Terrarum.joypadLabelNinA} ${Lang["GAME_INVENTORY_DROP"]}"
|
||||||
|
val controlHelpHeight = Terrarum.fontGame.lineHeight.toInt()
|
||||||
|
|
||||||
|
private var encumbrancePerc = 0f
|
||||||
|
private var isEncumbered = false
|
||||||
|
|
||||||
|
|
||||||
|
val catBarWidth = 328
|
||||||
|
val catBar = UIItemInventoryCatBar(
|
||||||
|
this,
|
||||||
|
(Terrarum.WIDTH - catBarWidth) / 2,
|
||||||
|
66 + (Terrarum.HEIGHT - internalHeight) / 2,
|
||||||
|
catBarWidth
|
||||||
|
)
|
||||||
|
val catSelection: Int
|
||||||
|
get() = catBar.selectedIndex
|
||||||
|
val catSelectedIcon: Int
|
||||||
|
get() = catBar.selectedIcon
|
||||||
|
|
||||||
|
override var openCloseTime: Second = 1f
|
||||||
|
|
||||||
|
|
||||||
|
private val itemList: UIItemInventoryDynamicList? =
|
||||||
|
if (actor != null) {
|
||||||
|
UIItemInventoryDynamicList(
|
||||||
|
this,
|
||||||
|
actor!!.inventory,
|
||||||
|
0 + (Terrarum.WIDTH - internalWidth) / 2,
|
||||||
|
109 + (Terrarum.HEIGHT - internalHeight) / 2
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else null
|
||||||
|
|
||||||
|
|
||||||
|
init {
|
||||||
|
addItem(catBar)
|
||||||
|
itemList?.let {
|
||||||
|
addItem(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun updateUI(delta: Float) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||||
|
catBar.render(batch, camera)
|
||||||
|
itemList?.render(batch, camera)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fun rebuildList() {
|
||||||
|
itemList?.rebuild()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispose() {
|
||||||
|
catBar.dispose()
|
||||||
|
itemList?.dispose()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
override fun doOpening(delta: Float) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun doClosing(delta: Float) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun endOpening(delta: Float) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun endClosing(delta: Float) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
override fun resize(width: Int, height: Int) {
|
||||||
|
super.resize(width, height)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
override fun keyDown(keycode: Int): Boolean {
|
||||||
|
return super.keyDown(keycode)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun keyTyped(character: Char): Boolean {
|
||||||
|
return super.keyTyped(character)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||||
|
return super.touchDown(screenX, screenY, pointer, button)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun keyUp(keycode: Int): Boolean {
|
||||||
|
return super.keyUp(keycode)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
|
||||||
|
return super.mouseMoved(screenX, screenY)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
|
||||||
|
return super.touchDragged(screenX, screenY, pointer)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||||
|
return super.touchUp(screenX, screenY, pointer, button)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun scrolled(amount: Int): Boolean {
|
||||||
|
return super.scrolled(amount)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
|
|
||||||
@@ -55,6 +56,9 @@ abstract class UIItem(var parentUI: UICanvas) { // do not replace parentUI to UI
|
|||||||
get() = mouseUp && Gdx.input.isButtonPressed(Terrarum.getConfigInt("mouseprimary")!!)
|
get() = mouseUp && Gdx.input.isButtonPressed(Terrarum.getConfigInt("mouseprimary")!!)
|
||||||
|
|
||||||
|
|
||||||
|
/** UI to call (show up) while mouse is up */
|
||||||
|
open val mouseOverCall: UICanvas? = null
|
||||||
|
|
||||||
|
|
||||||
// kind of listener implementation
|
// kind of listener implementation
|
||||||
var updateListener: ((Float) -> Unit)? = null
|
var updateListener: ((Float) -> Unit)? = null
|
||||||
@@ -76,9 +80,33 @@ abstract class UIItem(var parentUI: UICanvas) { // do not replace parentUI to UI
|
|||||||
if (updateListener != null) {
|
if (updateListener != null) {
|
||||||
updateListener!!.invoke(delta)
|
updateListener!!.invoke(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mouseOverCall?.update(delta)
|
||||||
|
|
||||||
|
if (mouseUp) {
|
||||||
|
if (mouseOverCall?.isVisible ?: false) {
|
||||||
|
mouseOverCall?.setAsOpen()
|
||||||
|
}
|
||||||
|
|
||||||
|
mouseOverCall?.updateUI(delta)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (mouseOverCall?.isVisible ?: false) {
|
||||||
|
mouseOverCall?.setAsClose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
open fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
|
if (parentUI.isVisible) {
|
||||||
|
mouseOverCall?.render(batch, camera)
|
||||||
|
|
||||||
|
if (mouseUp) {
|
||||||
|
mouseOverCall?.renderUI(batch, camera)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
abstract fun render(batch: SpriteBatch)
|
|
||||||
|
|
||||||
// keyboard controlled
|
// keyboard controlled
|
||||||
open fun keyDown(keycode: Int): Boolean {
|
open fun keyDown(keycode: Int): Boolean {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
@@ -22,14 +23,21 @@ open class UIItemImageButton(
|
|||||||
val activeBackCol: Color = Color(0xb0b0b0_ff.toInt()),
|
val activeBackCol: Color = Color(0xb0b0b0_ff.toInt()),
|
||||||
val activeBackBlendMode: String = BlendMode.MULTIPLY,
|
val activeBackBlendMode: String = BlendMode.MULTIPLY,
|
||||||
|
|
||||||
|
val highlightCol: Color = Color(0x00f8ff_ff),
|
||||||
|
val highlightBackCol: Color = Color(0xb0b0b0_ff.toInt()),
|
||||||
|
val highlightBackBlendMode: String = BlendMode.MULTIPLY,
|
||||||
|
|
||||||
override var posX: Int,
|
override var posX: Int,
|
||||||
override var posY: Int,
|
override var posY: Int,
|
||||||
override val width: Int = image.regionWidth,
|
override val width: Int = image.regionWidth,
|
||||||
override val height: Int = image.regionHeight
|
override val height: Int = image.regionHeight,
|
||||||
|
|
||||||
|
var highlightable: Boolean
|
||||||
) : UIItem(parent) {
|
) : UIItem(parent) {
|
||||||
|
|
||||||
|
var highlighted = false
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch) {
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
// draw background
|
// draw background
|
||||||
if (mouseUp) {
|
if (mouseUp) {
|
||||||
BlendMode.resolve(activeBackBlendMode)
|
BlendMode.resolve(activeBackBlendMode)
|
||||||
@@ -46,7 +54,10 @@ open class UIItemImageButton(
|
|||||||
// draw image
|
// draw image
|
||||||
blendNormal()
|
blendNormal()
|
||||||
|
|
||||||
batch.color = if (mouseUp) activeCol else buttonCol
|
batch.color = if (highlighted) highlightCol
|
||||||
|
else if (mouseUp) activeCol
|
||||||
|
else buttonCol
|
||||||
|
|
||||||
batch.draw(image, (posX + (width - image.regionWidth) / 2).toFloat(), (posY + (height - image.regionHeight) / 2).toFloat())
|
batch.draw(image, (posX + (width - image.regionWidth) / 2).toFloat(), (posY + (height - image.regionHeight) / 2).toFloat())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +82,10 @@ open class UIItemImageButton(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||||
|
if (mouseUp) {
|
||||||
|
highlighted = !highlighted
|
||||||
|
}
|
||||||
|
|
||||||
return super.touchDown(screenX, screenY, pointer, button)
|
return super.touchDown(screenX, screenY, pointer, button)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Texture
|
import com.badlogic.gdx.graphics.Texture
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.gameactors.roundInt
|
import net.torvald.terrarum.gameactors.roundInt
|
||||||
@@ -22,7 +23,7 @@ class UIItemImageGallery(
|
|||||||
override fun update(delta: Float) {
|
override fun update(delta: Float) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch) {
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
fun column(i: Int) = i % column
|
fun column(i: Int) = i % column
|
||||||
fun row(i: Int) = i / column
|
fun row(i: Int) = i / column
|
||||||
|
|
||||||
|
|||||||
25
src/net/torvald/terrarum/ui/UIItemInventoryCellBase.kt
Normal file
25
src/net/torvald/terrarum/ui/UIItemInventoryCellBase.kt
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
|
import net.torvald.terrarum.itemproperties.GameItem
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cross section of two inventory cell types
|
||||||
|
*
|
||||||
|
* Created by minjaesong on 2017-10-22.
|
||||||
|
*/
|
||||||
|
abstract class UIItemInventoryCellBase(
|
||||||
|
parentUI: UIInventoryFull,
|
||||||
|
override var posX: Int,
|
||||||
|
override var posY: Int,
|
||||||
|
open var item: GameItem?,
|
||||||
|
open var amount: Int,
|
||||||
|
open var itemImage: TextureRegion?,
|
||||||
|
open var quickslot: Int? = null,
|
||||||
|
open var equippedSlot: Int? = null
|
||||||
|
) : UIItem(parentUI) {
|
||||||
|
abstract override fun update(delta: Float)
|
||||||
|
abstract override fun render(batch: SpriteBatch, camera: Camera)
|
||||||
|
}
|
||||||
192
src/net/torvald/terrarum/ui/UIItemInventoryDynamicList.kt
Normal file
192
src/net/torvald/terrarum/ui/UIItemInventoryDynamicList.kt
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import net.torvald.terrarum.BlendMode
|
||||||
|
import net.torvald.terrarum.Terrarum
|
||||||
|
import net.torvald.terrarum.UIItemInventoryElem
|
||||||
|
import net.torvald.terrarum.UIItemInventoryElemSimple
|
||||||
|
import net.torvald.terrarum.console.Inventory
|
||||||
|
import net.torvald.terrarum.gameactors.ActorInventory
|
||||||
|
import net.torvald.terrarum.gameactors.InventoryPair
|
||||||
|
import net.torvald.terrarum.itemproperties.GameItem
|
||||||
|
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||||
|
import java.util.ArrayList
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display either extended or compact list
|
||||||
|
*
|
||||||
|
* Note: everything is pretty much fixed size.
|
||||||
|
*
|
||||||
|
* Dimension of the whole area: 496x384
|
||||||
|
* Number of grids: 9x7
|
||||||
|
* Number of lists: 2x7
|
||||||
|
*
|
||||||
|
* Created by minjaesong on 2017-10-21.
|
||||||
|
*/
|
||||||
|
class UIItemInventoryDynamicList(
|
||||||
|
parentUI: UIInventoryFull,
|
||||||
|
val inventory: ActorInventory,
|
||||||
|
override var posX: Int,
|
||||||
|
override var posY: Int
|
||||||
|
) : UIItem(parentUI) {
|
||||||
|
|
||||||
|
override val width = 496
|
||||||
|
override val height = 384
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val catIconsMeaning = listOf( // sortedBy: catArrangement
|
||||||
|
GameItem.Category.WEAPON,
|
||||||
|
GameItem.Category.TOOL,
|
||||||
|
GameItem.Category.ARMOUR,
|
||||||
|
GameItem.Category.GENERIC,
|
||||||
|
GameItem.Category.POTION,
|
||||||
|
GameItem.Category.MAGIC,
|
||||||
|
GameItem.Category.BLOCK,
|
||||||
|
GameItem.Category.WALL,
|
||||||
|
GameItem.Category.MISC,
|
||||||
|
"__all__"
|
||||||
|
)
|
||||||
|
|
||||||
|
private val inventoryUI = parentUI
|
||||||
|
|
||||||
|
private val selection: Int
|
||||||
|
get() = inventoryUI.catSelection
|
||||||
|
private val selectedIcon: Int
|
||||||
|
get() = inventoryUI.catSelectedIcon
|
||||||
|
|
||||||
|
private val compactViewCat = setOf(6, 7, 9) // blocks, walls, all (spritesheet order)
|
||||||
|
|
||||||
|
var itemPage = 0
|
||||||
|
var itemPageCount = 1 // TODO total size of current category / items.size
|
||||||
|
|
||||||
|
var inventorySortList = ArrayList<InventoryPair>()
|
||||||
|
private var rebuildList = true
|
||||||
|
|
||||||
|
val defaultTextColour = Color(0xeaeaea_ff.toInt())
|
||||||
|
|
||||||
|
private val listGap = 8
|
||||||
|
private val itemList = Array<UIItemInventoryCellBase>(
|
||||||
|
7 * 2, {
|
||||||
|
UIItemInventoryElem(
|
||||||
|
parentUI = inventoryUI,
|
||||||
|
posX = this.posX + (244 + listGap) * (it % 2),
|
||||||
|
posY = this.posY + (UIItemInventoryElem.height + listGap) * (it / 2),
|
||||||
|
width = 244,
|
||||||
|
item = null,
|
||||||
|
amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT,
|
||||||
|
itemImage = null,
|
||||||
|
mouseoverBackCol = Color(0x282828_ff),
|
||||||
|
mouseoverBackBlendMode = BlendMode.SCREEN,
|
||||||
|
backCol = Color(0xd4d4d4_ff.toInt()),
|
||||||
|
backBlendMode = BlendMode.MULTIPLY,
|
||||||
|
drawBackOnNull = true,
|
||||||
|
inactiveTextCol = defaultTextColour
|
||||||
|
) })
|
||||||
|
private val itemGrid = Array<UIItemInventoryCellBase>(
|
||||||
|
7 * 9, {
|
||||||
|
UIItemInventoryElemSimple(
|
||||||
|
parentUI = inventoryUI,
|
||||||
|
posX = this.posX + (UIItemInventoryElemSimple.height + listGap) * (it % 9),
|
||||||
|
posY = this.posY + (UIItemInventoryElemSimple.height + listGap) * (it / 9),
|
||||||
|
item = null,
|
||||||
|
amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT,
|
||||||
|
itemImage = null,
|
||||||
|
mouseoverBackCol = Color(0x282828_ff),
|
||||||
|
mouseoverBackBlendMode = BlendMode.SCREEN,
|
||||||
|
backCol = Color(0xd4d4d4_ff.toInt()),
|
||||||
|
backBlendMode = BlendMode.MULTIPLY,
|
||||||
|
drawBackOnNull = true,
|
||||||
|
inactiveTextCol = defaultTextColour
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
private val items: Array<UIItemInventoryCellBase>
|
||||||
|
get() = if (selection in compactViewCat) itemGrid else itemList
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
|
|
||||||
|
items.forEach { it.render(batch, camera) }
|
||||||
|
|
||||||
|
|
||||||
|
super.render(batch, camera)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun update(delta: Float) {
|
||||||
|
super.update(delta)
|
||||||
|
|
||||||
|
items.forEach { it.update(delta) }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
internal fun rebuild() {
|
||||||
|
val filter = catIconsMeaning[selectedIcon]
|
||||||
|
|
||||||
|
inventorySortList = ArrayList<InventoryPair>()
|
||||||
|
|
||||||
|
// filter items
|
||||||
|
inventory.forEach {
|
||||||
|
if (it.item.inventoryCategory == filter || filter == "__all__")
|
||||||
|
inventorySortList.add(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
rebuildList = false
|
||||||
|
|
||||||
|
// sort if needed
|
||||||
|
// test sort by name
|
||||||
|
inventorySortList.sortBy { it.item.name }
|
||||||
|
|
||||||
|
// map sortList to item list
|
||||||
|
for (k in 0 until items.size) {
|
||||||
|
// we have an item
|
||||||
|
try {
|
||||||
|
val sortListItem = inventorySortList[k + itemPage * items.size]
|
||||||
|
items[k].item = sortListItem.item
|
||||||
|
items[k].amount = sortListItem.amount
|
||||||
|
items[k].itemImage = ItemCodex.getItemImage(sortListItem.item)
|
||||||
|
|
||||||
|
// set quickslot number
|
||||||
|
for (qs in 1..UIQuickBar.SLOT_COUNT) {
|
||||||
|
if (sortListItem.item == inventory.getQuickBar(qs - 1)?.item) {
|
||||||
|
items[k].quickslot = qs % 10 // 10 -> 0, 1..9 -> 1..9
|
||||||
|
break
|
||||||
|
}
|
||||||
|
else
|
||||||
|
items[k].quickslot = null
|
||||||
|
}
|
||||||
|
|
||||||
|
// set equippedslot number
|
||||||
|
for (eq in 0 until inventory.itemEquipped.size) {
|
||||||
|
if (eq < inventory.itemEquipped.size) {
|
||||||
|
if (inventory.itemEquipped[eq] == items[k].item) {
|
||||||
|
items[k].equippedSlot = eq
|
||||||
|
break
|
||||||
|
}
|
||||||
|
else
|
||||||
|
items[k].equippedSlot = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// we do not have an item, empty the slot
|
||||||
|
catch (e: IndexOutOfBoundsException) {
|
||||||
|
items[k].item = null
|
||||||
|
items[k].amount = 0
|
||||||
|
items[k].itemImage = null
|
||||||
|
items[k].quickslot = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispose() {
|
||||||
|
itemList.forEach { it.dispose() }
|
||||||
|
itemGrid.forEach { it.dispose() }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.BlendMode
|
import net.torvald.terrarum.BlendMode
|
||||||
@@ -103,7 +104,7 @@ class UIItemList<Item: UIItem>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch) {
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
batch.color = backgroundCol
|
batch.color = backgroundCol
|
||||||
BlendMode.resolve(backgroundBlendMode)
|
BlendMode.resolve(backgroundBlendMode)
|
||||||
batch.fillRect(posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
|
batch.fillRect(posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
|
||||||
@@ -114,7 +115,7 @@ class UIItemList<Item: UIItem>(
|
|||||||
batch.fillRect(posX.toFloat(), highlightY!!.toFloat(), width.toFloat(), UIItemTextButton.height.toFloat())
|
batch.fillRect(posX.toFloat(), highlightY!!.toFloat(), width.toFloat(), UIItemTextButton.height.toFloat())
|
||||||
}
|
}
|
||||||
|
|
||||||
itemList.forEach { it.render(batch) }
|
itemList.forEach { it.render(batch, camera) }
|
||||||
|
|
||||||
batch.color = backgroundCol
|
batch.color = backgroundCol
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.ModMgr
|
import net.torvald.terrarum.ModMgr
|
||||||
@@ -19,7 +20,7 @@ class UIItemModuleInfoCell(
|
|||||||
|
|
||||||
private val numberAreaWidth = Terrarum.fontSmallNumbers.W * 3 + 4
|
private val numberAreaWidth = Terrarum.fontSmallNumbers.W * 3 + 4
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch) {
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
blendNormal()
|
blendNormal()
|
||||||
|
|
||||||
if (ModMgr.moduleInfo.containsKey(moduleName)) {
|
if (ModMgr.moduleInfo.containsKey(moduleName)) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
@@ -38,7 +39,7 @@ class UIItemTextArea(
|
|||||||
if (scrollPos < 0) scrollPos = 0
|
if (scrollPos < 0) scrollPos = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch) {
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
for (i in scrollPos until minOf(lineCount + scrollPos, entireText.size)) {
|
for (i in scrollPos until minOf(lineCount + scrollPos, entireText.size)) {
|
||||||
val yPtr = i - scrollPos
|
val yPtr = i - scrollPos
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
@@ -46,7 +47,7 @@ open class UIItemTextButton(
|
|||||||
|
|
||||||
private val glyphLayout = GlyphLayout()
|
private val glyphLayout = GlyphLayout()
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch) {
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
val textW = font.getWidth(label)
|
val textW = font.getWidth(label)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
||||||
@@ -175,7 +176,7 @@ class UIItemTextButtonList(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch) {
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
|
|
||||||
batch.color = backgroundCol
|
batch.color = backgroundCol
|
||||||
BlendMode.resolve(backgroundBlendMode)
|
BlendMode.resolve(backgroundBlendMode)
|
||||||
@@ -187,7 +188,7 @@ class UIItemTextButtonList(
|
|||||||
batch.fillRect(posX.toFloat(), highlightY!!.toFloat(), width.toFloat(), UIItemTextButton.height.toFloat())
|
batch.fillRect(posX.toFloat(), highlightY!!.toFloat(), width.toFloat(), UIItemTextButton.height.toFloat())
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons.forEach { it.render(batch) }
|
buttons.forEach { it.render(batch, camera) }
|
||||||
|
|
||||||
|
|
||||||
if (iconSpriteSheet != null) {
|
if (iconSpriteSheet != null) {
|
||||||
|
|||||||
@@ -89,10 +89,10 @@ class UITitleRemoConCredits(val superMenu: UICanvas) : UICanvas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||||
menubar.render(batch)
|
menubar.render(batch, camera)
|
||||||
if (drawTextArea) {
|
if (drawTextArea) {
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
textArea.render(batch)
|
textArea.render(batch, camera)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,10 +87,10 @@ class UITitleRemoConLanguage(val superMenu: UICanvas) : UICanvas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||||
menubar.render(batch)
|
menubar.render(batch, camera)
|
||||||
|
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
textArea.render(batch)
|
textArea.render(batch, camera)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doOpening(delta: Float) {
|
override fun doOpening(delta: Float) {
|
||||||
|
|||||||
@@ -96,11 +96,11 @@ class UITitleRemoConModules(val superMenu: UICanvas) : UICanvas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||||
menubar.render(batch)
|
menubar.render(batch, camera)
|
||||||
|
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
blendNormal()
|
blendNormal()
|
||||||
mouduleArea.render(batch)
|
mouduleArea.render(batch, camera)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doOpening(delta: Float) {
|
override fun doOpening(delta: Float) {
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class UITitleRemoConRoot : UICanvas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||||
menubar.render(batch)
|
menubar.render(batch, camera)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doOpening(delta: Float) {
|
override fun doOpening(delta: Float) {
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user