mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
3 screens impl of inventory UI wip
This commit is contained in:
@@ -299,6 +299,7 @@ public class AppLoader implements ApplicationListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render() {
|
public void render() {
|
||||||
|
Gdx.gl.glDisable(GL20.GL_DITHER);
|
||||||
|
|
||||||
if (splashDisplayed && !postInitFired) {
|
if (splashDisplayed && !postInitFired) {
|
||||||
postInitFired = true;
|
postInitFired = true;
|
||||||
@@ -541,11 +542,11 @@ public class AppLoader implements ApplicationListener {
|
|||||||
operationSystem = "SOLARIS";
|
operationSystem = "SOLARIS";
|
||||||
defaultDir = System.getProperty("user.home") + "/.Terrarum";
|
defaultDir = System.getProperty("user.home") + "/.Terrarum";
|
||||||
}
|
}
|
||||||
else if (System.getProperty("java.runtime.name").toUpperCase().contains("ANDROID")) {
|
/*else if (System.getProperty("java.runtime.name").toUpperCase().contains("ANDROID")) {
|
||||||
operationSystem = "ANDROID";
|
operationSystem = "ANDROID";
|
||||||
defaultDir = System.getProperty("user.home") + "/.Terrarum";
|
defaultDir = System.getProperty("user.home") + "/.Terrarum";
|
||||||
environment = RunningEnvironment.MOBILE;
|
environment = RunningEnvironment.MOBILE;
|
||||||
}
|
}*/
|
||||||
else {
|
else {
|
||||||
operationSystem = "UNKNOWN";
|
operationSystem = "UNKNOWN";
|
||||||
defaultDir = System.getProperty("user.home") + "/.Terrarum";
|
defaultDir = System.getProperty("user.home") + "/.Terrarum";
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ class GdxColorMap {
|
|||||||
height = pixmap.height
|
height = pixmap.height
|
||||||
is2D = pixmap.height > 1
|
is2D = pixmap.height > 1
|
||||||
|
|
||||||
data = kotlin.IntArray(pixmap.width * pixmap.height, {
|
data = kotlin.IntArray(pixmap.width * pixmap.height) {
|
||||||
pixmap.getPixel(it % pixmap.width, it / pixmap.width)
|
pixmap.getPixel(it % pixmap.width, it / pixmap.width)
|
||||||
})
|
}
|
||||||
|
|
||||||
|
|
||||||
AppLoader.printdbg(this, "Loading colormap from ${imageFile.name()}; PixmapFormat: ${pixmap.format}; Dimension: $width x $height")
|
AppLoader.printdbg(this, "Loading colormap from ${imageFile.name()}; PixmapFormat: ${pixmap.format}; Dimension: $width x $height")
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ object Terrarum : Screen {
|
|||||||
|
|
||||||
|
|
||||||
// setting environment as MOBILE precedes this code
|
// setting environment as MOBILE precedes this code
|
||||||
if (environment != RunningEnvironment.MOBILE) {
|
//if (environment != RunningEnvironment.MOBILE) {
|
||||||
environment = try {
|
environment = try {
|
||||||
Controllers.getController(0) // test if controller exists
|
Controllers.getController(0) // test if controller exists
|
||||||
if (getConfigString("pcgamepadenv") == "console")
|
if (getConfigString("pcgamepadenv") == "console")
|
||||||
@@ -245,7 +245,7 @@ object Terrarum : Screen {
|
|||||||
catch (e: IndexOutOfBoundsException) {
|
catch (e: IndexOutOfBoundsException) {
|
||||||
RunningEnvironment.PC
|
RunningEnvironment.PC
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -270,11 +270,6 @@ object Terrarum : Screen {
|
|||||||
val MINIMAL_GL_MAX_TEXTURE_SIZE = 4096
|
val MINIMAL_GL_MAX_TEXTURE_SIZE = 4096
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
if (environment != RunningEnvironment.MOBILE) {
|
|
||||||
Gdx.gl.glDisable(GL20.GL_DITHER)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
assetManager = AssetManager()
|
assetManager = AssetManager()
|
||||||
|
|
||||||
|
|
||||||
@@ -634,7 +629,7 @@ object BlendMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum class RunningEnvironment {
|
enum class RunningEnvironment {
|
||||||
PC, CONSOLE, MOBILE
|
PC, CONSOLE//, MOBILE
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun Color.screen(other: Color) = Color(
|
infix fun Color.screen(other: Color) = Color(
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
-uiInventoryPlayer.width,
|
-uiInventoryPlayer.width,
|
||||||
70
|
70
|
||||||
)*/
|
)*/
|
||||||
uiInventoryPlayer = UIInventoryFull(actorNowPlaying,
|
uiInventoryPlayer = UIInventoryFull(actorNowPlaying!!,
|
||||||
toggleKeyLiteral = AppLoader.getConfigInt("keyinventory")
|
toggleKeyLiteral = AppLoader.getConfigInt("keyinventory")
|
||||||
)
|
)
|
||||||
uiInventoryPlayer.setPosition(0, 0)
|
uiInventoryPlayer.setPosition(0, 0)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.Color
|
|||||||
import com.badlogic.gdx.graphics.GL20
|
import com.badlogic.gdx.graphics.GL20
|
||||||
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
|
||||||
|
import com.jme3.math.FastMath
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.gameactors.ActorWBMovable
|
import net.torvald.terrarum.gameactors.ActorWBMovable
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
@@ -13,13 +14,14 @@ import net.torvald.terrarum.modulebasegame.Ingame
|
|||||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory.Companion.CAPACITY_MODE_NO_ENCUMBER
|
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory.Companion.CAPACITY_MODE_NO_ENCUMBER
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
|
import net.torvald.terrarum.ui.UIItem
|
||||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2017-10-21.
|
* Created by minjaesong on 2017-10-21.
|
||||||
*/
|
*/
|
||||||
class UIInventoryFull(
|
class UIInventoryFull(
|
||||||
var actor: Pocketed?,
|
var actor: Pocketed,
|
||||||
|
|
||||||
toggleKeyLiteral: Int? = null, toggleButtonLiteral: Int? = null,
|
toggleKeyLiteral: Int? = null, toggleButtonLiteral: Int? = null,
|
||||||
// UI positions itself? (you must g.flush() yourself after the g.translate(Int, Int))
|
// UI positions itself? (you must g.flush() yourself after the g.translate(Int, Int))
|
||||||
@@ -54,6 +56,16 @@ class UIInventoryFull(
|
|||||||
"${Terrarum.gamepadLabelNinY} ${Lang["GAME_INVENTORY_USE"]}$SP" +
|
"${Terrarum.gamepadLabelNinY} ${Lang["GAME_INVENTORY_USE"]}$SP" +
|
||||||
"${0xe011.toChar()}${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
|
"${0xe011.toChar()}${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
|
||||||
"${Terrarum.gamepadLabelNinA} ${Lang["GAME_INVENTORY_DROP"]}"
|
"${Terrarum.gamepadLabelNinA} ${Lang["GAME_INVENTORY_DROP"]}"
|
||||||
|
val minimapControlHelp: String
|
||||||
|
get() = if (AppLoader.environment == RunningEnvironment.PC)
|
||||||
|
"${0xe031.toChar()} ${Lang["GAME_ACTION_CLOSE"]}"
|
||||||
|
else
|
||||||
|
"${0xe031.toChar()} ${Lang["GAME_ACTION_CLOSE"]}$SP${0xe06b.toChar()} ${Lang["GAME_INVENTORY"]}"
|
||||||
|
val gameMenuControlHelp: String
|
||||||
|
get() = if (AppLoader.environment == RunningEnvironment.PC)
|
||||||
|
"${0xe031.toChar()} ${Lang["GAME_ACTION_CLOSE"]}"
|
||||||
|
else
|
||||||
|
"${0xe031.toChar()} ${Lang["GAME_ACTION_CLOSE"]}$SP${0xe068.toChar()} ${Lang["GAME_INVENTORY"]}"
|
||||||
val controlHelpHeight = Terrarum.fontGame.lineHeight
|
val controlHelpHeight = Terrarum.fontGame.lineHeight
|
||||||
|
|
||||||
private var encumbrancePerc = 0f
|
private var encumbrancePerc = 0f
|
||||||
@@ -75,48 +87,70 @@ class UIInventoryFull(
|
|||||||
override var openCloseTime: Second = 0.0f
|
override var openCloseTime: Second = 0.0f
|
||||||
|
|
||||||
|
|
||||||
private val itemList: UIItemInventoryDynamicList? =
|
private val itemList: UIItemInventoryDynamicList =
|
||||||
if (actor != null) {
|
UIItemInventoryDynamicList(
|
||||||
UIItemInventoryDynamicList(
|
this,
|
||||||
this,
|
actor.inventory,
|
||||||
actor!!.inventory,
|
0 + (Terrarum.WIDTH - internalWidth) / 2,
|
||||||
0 + (Terrarum.WIDTH - internalWidth) / 2,
|
109 + (Terrarum.HEIGHT - internalHeight) / 2
|
||||||
109 + (Terrarum.HEIGHT - internalHeight) / 2
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
else null
|
|
||||||
|
|
||||||
|
|
||||||
private val equipped: UIItemInventoryEquippedView? =
|
private val equipped: UIItemInventoryEquippedView =
|
||||||
if (actor != null) {
|
UIItemInventoryEquippedView(
|
||||||
UIItemInventoryEquippedView(
|
this,
|
||||||
this,
|
actor.inventory,
|
||||||
actor!!.inventory,
|
actor as ActorWBMovable,
|
||||||
actor as ActorWBMovable,
|
internalWidth - UIItemInventoryEquippedView.WIDTH + (Terrarum.WIDTH - internalWidth) / 2,
|
||||||
internalWidth - UIItemInventoryEquippedView.WIDTH + (Terrarum.WIDTH - internalWidth) / 2,
|
109 + (Terrarum.HEIGHT - internalHeight) / 2
|
||||||
109 + (Terrarum.HEIGHT - internalHeight) / 2
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
else null
|
|
||||||
|
|
||||||
|
|
||||||
|
private var currentScreen = 1f //
|
||||||
|
private var transitionRequested = false
|
||||||
|
private var transitionTimer = 0f
|
||||||
|
private val transitionLength = 0.5f
|
||||||
|
|
||||||
|
private val SCREEN_MINIMAP = 0
|
||||||
|
private val SCREEN_INVENTORY = 1
|
||||||
|
private val SCREEN_MENU = 2
|
||||||
|
|
||||||
|
|
||||||
|
private val transitionalUpdateUIs = ArrayList<UIItem>()
|
||||||
|
private val transitionalUpdateUIoriginalPosX = ArrayList<Int>()
|
||||||
|
|
||||||
|
|
||||||
|
private fun addToTransitionalGroup(item: UIItem) {
|
||||||
|
transitionalUpdateUIs.add(item)
|
||||||
|
transitionalUpdateUIoriginalPosX.add(item.posX)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateTransitionalItems() {
|
||||||
|
for (k in 0..transitionalUpdateUIs.lastIndex) {
|
||||||
|
val intOff = inventoryScrOffX.roundInt()
|
||||||
|
transitionalUpdateUIs[k].posX = transitionalUpdateUIoriginalPosX[k] + intOff
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
addItem(categoryBar)
|
addItem(categoryBar)
|
||||||
itemList?.let { addItem(it) }
|
itemList.let { addItem(it) }
|
||||||
equipped?.let { addItem(it) }
|
equipped.let { addItem(it) }
|
||||||
|
|
||||||
|
|
||||||
categoryBar.selectionChangeListener = { old, new ->
|
categoryBar.selectionChangeListener = { old, new ->
|
||||||
rebuildList()
|
rebuildList()
|
||||||
itemList?.itemPage = 0 // set scroll to zero
|
itemList.itemPage = 0 // set scroll to zero
|
||||||
itemList?.rebuild() // have to manually rebuild, too!
|
itemList.rebuild() // have to manually rebuild, too!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rebuildList()
|
rebuildList()
|
||||||
|
|
||||||
|
|
||||||
|
addToTransitionalGroup(itemList)
|
||||||
|
addToTransitionalGroup(equipped)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var offsetX = ((Terrarum.WIDTH - internalWidth) / 2).toFloat()
|
private var offsetX = ((Terrarum.WIDTH - internalWidth) / 2).toFloat()
|
||||||
@@ -131,8 +165,8 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
|
|
||||||
categoryBar.update(delta)
|
categoryBar.update(delta)
|
||||||
itemList?.update(delta)
|
itemList.update(delta)
|
||||||
equipped?.update(delta)
|
equipped.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val gradStartCol = Color(0x404040_60)
|
private val gradStartCol = Color(0x404040_60)
|
||||||
@@ -142,9 +176,17 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
private val weightBarWidth = 60f
|
private val weightBarWidth = 60f
|
||||||
|
|
||||||
|
private var xEnd = (Terrarum.WIDTH + internalWidth).div(2).toFloat()
|
||||||
|
private var yEnd = (Terrarum.HEIGHT + internalHeight).div(2).toFloat()
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||||
val xEnd = (Terrarum.WIDTH + internalWidth).div(2).toFloat()
|
|
||||||
val yEnd = (Terrarum.HEIGHT + internalHeight).div(2).toFloat()
|
currentScreen = 1f + 0.1f * FastMath.sin(transitionTimer)
|
||||||
|
transitionTimer += Gdx.graphics.deltaTime
|
||||||
|
|
||||||
|
// update at render time
|
||||||
|
updateTransitionalItems()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// background fill
|
// background fill
|
||||||
@@ -169,66 +211,74 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
// UI items
|
// UI items
|
||||||
categoryBar.render(batch, camera)
|
categoryBar.render(batch, camera)
|
||||||
itemList?.render(batch, camera)
|
|
||||||
equipped?.render(batch, camera)
|
|
||||||
|
renderScreenInventory(batch, camera)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val minimapScrOffX: Float
|
||||||
|
get() = (currentScreen + 1f) * Terrarum.WIDTH
|
||||||
|
private val inventoryScrOffX: Float
|
||||||
|
get() = (currentScreen - 1f) * Terrarum.WIDTH
|
||||||
|
private val menuScrOffX: Float
|
||||||
|
get() = (currentScreen) * Terrarum.WIDTH
|
||||||
|
|
||||||
|
private fun renderScreenInventory(batch: SpriteBatch, camera: Camera) {
|
||||||
|
itemList.render(batch, camera)
|
||||||
|
equipped.render(batch, camera)
|
||||||
|
|
||||||
|
|
||||||
// control hints
|
// control hints
|
||||||
blendNormal(batch)
|
blendNormal(batch)
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
Terrarum.fontGame.draw(batch, listControlHelp, offsetX, yEnd-20)
|
Terrarum.fontGame.draw(batch, listControlHelp, offsetX + inventoryScrOffX, yEnd - 20)
|
||||||
|
|
||||||
|
|
||||||
// encumbrance meter
|
// encumbrance meter
|
||||||
if (actor != null) {
|
val encumbranceText = Lang["GAME_INVENTORY_ENCUMBRANCE"]
|
||||||
val encumbranceText = Lang["GAME_INVENTORY_ENCUMBRANCE"]
|
|
||||||
|
|
||||||
Terrarum.fontGame.draw(batch,
|
Terrarum.fontGame.draw(batch,
|
||||||
encumbranceText,
|
encumbranceText,
|
||||||
xEnd - 9 - Terrarum.fontGame.getWidth(encumbranceText) - weightBarWidth,
|
xEnd - 9 - Terrarum.fontGame.getWidth(encumbranceText) - weightBarWidth + inventoryScrOffX,
|
||||||
yEnd-20
|
yEnd-20
|
||||||
)
|
)
|
||||||
|
|
||||||
// encumbrance bar background
|
// encumbrance bar background
|
||||||
blendMul(batch)
|
blendMul(batch)
|
||||||
batch.color = Color(0xa0a0a0_ff.toInt())
|
batch.color = Color(0xa0a0a0_ff.toInt())
|
||||||
batch.fillRect(
|
batch.fillRect(
|
||||||
xEnd - 3 - weightBarWidth,
|
xEnd - 3 - weightBarWidth + inventoryScrOffX,
|
||||||
yEnd-20 + 3f,
|
yEnd-20 + 3f,
|
||||||
weightBarWidth,
|
weightBarWidth,
|
||||||
controlHelpHeight - 6f
|
controlHelpHeight - 6f
|
||||||
)
|
)
|
||||||
// encumbrance bar
|
// encumbrance bar
|
||||||
blendNormal(batch)
|
blendNormal(batch)
|
||||||
batch.color = if (isEncumbered) Color(0xff0000_cc.toInt()) else Color(0x00ff00_cc.toInt())
|
batch.color = if (isEncumbered) Color(0xff0000_cc.toInt()) else Color(0x00ff00_cc.toInt())
|
||||||
batch.fillRect(
|
batch.fillRect(
|
||||||
xEnd - 3 - weightBarWidth,
|
xEnd - 3 - weightBarWidth + inventoryScrOffX,
|
||||||
yEnd-20 + 3f,
|
yEnd-20 + 3f,
|
||||||
if (actor?.inventory?.capacityMode == CAPACITY_MODE_NO_ENCUMBER)
|
if (actor.inventory.capacityMode == CAPACITY_MODE_NO_ENCUMBER)
|
||||||
1f
|
1f
|
||||||
else // make sure 1px is always be seen
|
else // make sure 1px is always be seen
|
||||||
minOf(weightBarWidth, maxOf(1f, weightBarWidth * encumbrancePerc)),
|
minOf(weightBarWidth, maxOf(1f, weightBarWidth * encumbrancePerc)),
|
||||||
controlHelpHeight - 5f
|
controlHelpHeight - 5f
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun rebuildList() {
|
fun rebuildList() {
|
||||||
itemList?.rebuild()
|
itemList.rebuild()
|
||||||
equipped?.rebuild()
|
equipped.rebuild()
|
||||||
|
|
||||||
actor?.let {
|
encumbrancePerc = actor.inventory.capacity.toFloat() / actor.inventory.maxCapacity
|
||||||
encumbrancePerc = actor!!.inventory.capacity.toFloat() / actor!!.inventory.maxCapacity
|
isEncumbered = actor.inventory.isEncumbered
|
||||||
isEncumbered = actor!!.inventory.isEncumbered
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
categoryBar.dispose()
|
categoryBar.dispose()
|
||||||
itemList?.dispose()
|
itemList.dispose()
|
||||||
equipped?.dispose()
|
equipped.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -245,7 +295,7 @@ class UIInventoryFull(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun endClosing(delta: Float) {
|
override fun endClosing(delta: Float) {
|
||||||
(Terrarum.ingame as? Ingame)?.setTooltipMessage(null) // required!!
|
(Terrarum.ingame as? Ingame)?.setTooltipMessage(null) // required!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -255,6 +305,9 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
offsetX = ((Terrarum.WIDTH - internalWidth) / 2).toFloat()
|
offsetX = ((Terrarum.WIDTH - internalWidth) / 2).toFloat()
|
||||||
offsetY = ((Terrarum.HEIGHT - internalHeight) / 2).toFloat()
|
offsetY = ((Terrarum.HEIGHT - internalHeight) / 2).toFloat()
|
||||||
|
|
||||||
|
xEnd = (Terrarum.WIDTH + internalWidth).div(2).toFloat()
|
||||||
|
yEnd = (Terrarum.HEIGHT + internalHeight).div(2).toFloat()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,9 @@ class UIItemInventoryDynamicList(
|
|||||||
highlightable = false
|
highlightable = false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// deal with the moving position
|
||||||
|
private var oldPosX = posX
|
||||||
|
|
||||||
fun scrollItemPage(relativeAmount: Int) {
|
fun scrollItemPage(relativeAmount: Int) {
|
||||||
itemPage = if (itemPageCount == 0) 0 else (itemPage + relativeAmount).fmod(itemPageCount)
|
itemPage = if (itemPageCount == 0) 0 else (itemPage + relativeAmount).fmod(itemPageCount)
|
||||||
}
|
}
|
||||||
@@ -205,6 +208,15 @@ class UIItemInventoryDynamicList(
|
|||||||
private val upDownButtonGapToDots = 7 // apparent gap may vary depend on the texture itself
|
private val upDownButtonGapToDots = 7 // apparent gap may vary depend on the texture itself
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
|
val posXDelta = posX - oldPosX
|
||||||
|
itemGrid.forEach { it.posX += posXDelta }
|
||||||
|
itemList.forEach { it.posX += posXDelta }
|
||||||
|
gridModeButtons.forEach { it.posX += posXDelta }
|
||||||
|
scrollUpButton.posX += posXDelta
|
||||||
|
scrollDownButton.posX += posXDelta
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun getScrollDotYHeight(i: Int) = scrollUpButton.posY + 10 + upDownButtonGapToDots + 10 * i
|
fun getScrollDotYHeight(i: Int) = scrollUpButton.posY + 10 + upDownButtonGapToDots + 10 * i
|
||||||
|
|
||||||
scrollDownButton.posY = getScrollDotYHeight(itemPageCount) + upDownButtonGapToDots
|
scrollDownButton.posY = getScrollDotYHeight(itemPageCount) + upDownButtonGapToDots
|
||||||
@@ -230,6 +242,8 @@ class UIItemInventoryDynamicList(
|
|||||||
}
|
}
|
||||||
|
|
||||||
super.render(batch, camera)
|
super.render(batch, camera)
|
||||||
|
|
||||||
|
oldPosX = posX
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,15 @@ class UIItemInventoryEquippedView(
|
|||||||
|
|
||||||
private val spriteDrawCol = Color(0xddddddff.toInt())
|
private val spriteDrawCol = Color(0xddddddff.toInt())
|
||||||
|
|
||||||
|
// deal with the moving position
|
||||||
|
private var oldPosX = posX
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
|
val posXDelta = posX - oldPosX
|
||||||
|
itemGrid.forEach { it.posX += posXDelta }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// sprite background
|
// sprite background
|
||||||
blendNormal(batch)
|
blendNormal(batch)
|
||||||
batch.color = spriteViewBackCol
|
batch.color = spriteViewBackCol
|
||||||
@@ -88,6 +96,9 @@ class UIItemInventoryEquippedView(
|
|||||||
// TODO inscribe slot image on each cells HERE
|
// TODO inscribe slot image on each cells HERE
|
||||||
|
|
||||||
itemGrid.forEach { it.render(batch, camera) }
|
itemGrid.forEach { it.render(batch, camera) }
|
||||||
|
|
||||||
|
|
||||||
|
oldPosX = posX
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun rebuild() {
|
internal fun rebuild() {
|
||||||
|
|||||||
BIN
work_files/UI/minimap_inventory_gamemenu.psd
LFS
Normal file
BIN
work_files/UI/minimap_inventory_gamemenu.psd
LFS
Normal file
Binary file not shown.
Reference in New Issue
Block a user