From 1e6f51e16cbce3b2cb3622ed99c7411919eed657 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Wed, 5 Jul 2023 21:35:41 +0900 Subject: [PATCH] oops now it's broken but I still had to commit lol --- .../terrarum/modulebasegame/ui/UILoadList.kt | 242 +++++++++++++++++- .../modulebasegame/ui/UILoadNewCharacter.kt | 29 +++ .../modulebasegame/ui/UILoadSavegame.kt | 81 +++--- 3 files changed, 308 insertions(+), 44 deletions(-) create mode 100644 src/net/torvald/terrarum/modulebasegame/ui/UILoadNewCharacter.kt diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UILoadList.kt b/src/net/torvald/terrarum/modulebasegame/ui/UILoadList.kt index 89adc4cc2..976b4a9b0 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UILoadList.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UILoadList.kt @@ -1,10 +1,18 @@ package net.torvald.terrarum.modulebasegame.ui -import com.badlogic.gdx.graphics.Camera +import com.badlogic.gdx.Input +import com.badlogic.gdx.graphics.* import com.badlogic.gdx.graphics.g2d.SpriteBatch -import net.torvald.terrarum.App +import com.badlogic.gdx.graphics.g2d.TextureRegion +import com.badlogic.gdx.graphics.glutils.FrameBuffer +import net.torvald.terrarum.* +import net.torvald.terrarum.langpack.Lang +import net.torvald.terrarum.ui.Movement import net.torvald.terrarum.ui.Toolkit import net.torvald.terrarum.ui.UICanvas +import net.torvald.unicode.getKeycapConsole +import net.torvald.unicode.getKeycapPC +import kotlin.math.roundToInt /** * Created by minjaesong on 2023-07-05. @@ -14,16 +22,240 @@ class UILoadList(val full: UILoadSavegame) : UICanvas() { override var width: Int = Toolkit.drawWidth override var height: Int = App.scr.height + private val controlHelp: String + get() = if (App.environment == RunningEnvironment.PC) + "${getKeycapPC(App.getConfigInt("control_key_up"))}${getKeycapPC(App.getConfigInt("control_key_down"))}" + + " ${Lang["MENU_CONTROLS_SCROLL"]}" + else + "${getKeycapConsole('R')} ${Lang["MENU_CONTROLS_SCROLL"]}" + + internal val uiWidth = SAVE_CELL_WIDTH + internal val uiXdiffChatOverlay = App.scr.chatWidth / 2 + internal val textH = App.fontGame.lineHeight.toInt() + // internal val titleTextPosY: Int = App.scr.tvSafeGraphicsHeight + 10 + internal val cellGap = 20 + internal val cellInterval = cellGap + SAVE_CELL_HEIGHT + internal val gradAreaHeight = 32 + // internal val titleTextPosY: Int = App.scr.tvSafeGraphicsHeight + 10 + internal val titleTopGradStart: Int = App.scr.tvSafeGraphicsHeight + internal val titleTopGradEnd: Int = titleTopGradStart + gradAreaHeight + internal val titleBottomGradStart: Int = height - App.scr.tvSafeGraphicsHeight - gradAreaHeight + internal val titleBottomGradEnd: Int = titleBottomGradStart + gradAreaHeight + internal val controlHelperY: Int = titleBottomGradStart + gradAreaHeight - textH + + private var scrollAreaHeight = height - 2 * App.scr.tvSafeGraphicsHeight - 64 + private var listScroll = 0 // only update when animation is finished + private var savesVisible = (scrollAreaHeight + cellGap) / cellInterval + private var uiScroll = 0f + private var scrollFrom = 0 + private var scrollTarget = 0 + private var scrollAnimCounter = 0f + private val scrollAnimLen = 0.1f + private var sliderFBO = FrameBuffer(Pixmap.Format.RGBA8888, uiWidth + 10, height, false) + + private val playerCells = ArrayList() + + private val mode1Node = Yaml(UITitleRemoConYaml.injectedMenuSingleCharSel).parse() + + + override fun show() { + mode1Node.parent = full.remoCon.treeRoot + mode1Node.data = "MENU_MODE_SINGLEPLAYER : net.torvald.terrarum.modulebasegame.ui.UILoadSavegame" + full.remoCon.setNewRemoConContents(mode1Node) + + try { + full.remoCon.handler.lockToggle() + full.showSpinner = true + + Thread { + // read savegames + var savegamesCount = 0 + App.sortedPlayers.forEach { uuid -> + val skimmer = App.savegamePlayers[uuid]!!.loadable() + val x = full.uiX + val y = titleTopGradEnd + cellInterval * savegamesCount + try { + playerCells.add(UIItemPlayerCells(full, x, y, skimmer)) + savegamesCount += 1 + } + catch (e: Throwable) { + System.err.println("[UILoadSavegame] Error while loading Player '${skimmer.diskFile.absolutePath}'") + e.printStackTrace() + } + } + + + full.remoCon.handler.unlockToggle() + full.showSpinner = false + }.start() + + } + catch (e: UninitializedPropertyAccessException) {} + } + override fun updateUI(delta: Float) { - TODO("Not yet implemented") + if (scrollTarget != listScroll) { + if (scrollAnimCounter < scrollAnimLen) { + scrollAnimCounter += delta + uiScroll = Movement.fastPullOut( + scrollAnimCounter / scrollAnimLen, + listScroll * cellInterval.toFloat(), + scrollTarget * cellInterval.toFloat() + ) + } + else { + scrollAnimCounter = 0f + listScroll = scrollTarget + uiScroll = cellInterval.toFloat() * scrollTarget + } + } + + for (index in 0 until playerCells.size) { + val it = playerCells[index] + if (index in listScroll - 2 until listScroll + savesVisible + 2) { + // re-position + it.posY = (it.initialY - uiScroll).roundToInt() + it.update(delta) + } + } } override fun renderUI(batch: SpriteBatch, camera: Camera) { - TODO("Not yet implemented") + batch.end() + + val cells = playerCells + + lateinit var savePixmap: Pixmap + sliderFBO.inAction(camera as OrthographicCamera, batch) { + gdxClearAndEnableBlend(0f, 0f, 0f, 0f) + + full.setCameraPosition(batch, camera, 0f, 0f) + batch.color = Color.WHITE + batch.inUse { + for (index in 0 until cells.size) { + val it = cells[index] + + if (App.getConfigBoolean("fx_streamerslayout")) + it.posX += uiXdiffChatOverlay + + if (index in listScroll - 2 until listScroll + savesVisible + 2) + it.render(batch, camera) + + if (App.getConfigBoolean("fx_streamerslayout")) + it.posX -= uiXdiffChatOverlay + } + } + savePixmap = Pixmap.createFromFrameBuffer(0, 0, sliderFBO.width, sliderFBO.height) + savePixmap.blending = Pixmap.Blending.None + } + + + // implement "wipe-out" by CPU-rendering (*deep exhale*) + //savePixmap.setColor(1f,1f,1f,0f) + savePixmap.setColor(0f, 0f, 0f, 0f) + savePixmap.fillRectangle(0, savePixmap.height - titleTopGradStart, savePixmap.width, titleTopGradStart) + // top grad + for (y in titleTopGradStart until titleTopGradEnd) { + val alpha = (y - titleTopGradStart).toFloat() / gradAreaHeight + for (x in 0 until savePixmap.width) { + val col = savePixmap.getPixel(x, savePixmap.height - y) + val blendAlpha = (col.and(0xFF) * alpha).roundToInt() + savePixmap.drawPixel(x, savePixmap.height - y, col.and(0xFFFFFF00.toInt()) or blendAlpha) + } + } + // bottom grad + for (y in titleBottomGradStart until titleBottomGradEnd) { + val alpha = 1f - ((y - titleBottomGradStart).toFloat() / gradAreaHeight) + for (x in 0 until savePixmap.width) { + val col = savePixmap.getPixel(x, savePixmap.height - y) + val blendAlpha = (col.and(0xFF) * alpha).roundToInt() + savePixmap.drawPixel(x, savePixmap.height - y, col.and(0xFFFFFF00.toInt()) or blendAlpha) + } + } + savePixmap.setColor(0f, 0f, 0f, 0f) + savePixmap.fillRectangle(0, 0, savePixmap.width, height - titleBottomGradEnd + 1) + + + + full.setCameraPosition(batch, camera, 0f, 0f) + val saveTex = TextureRegion(Texture(savePixmap)); saveTex.flip(false, true) + batch.inUse { + batch.draw(saveTex, (width - uiWidth - 10) / 2f, 0f) + // Control help + App.fontGame.draw(batch, controlHelp, full.uiX.toFloat(), controlHelperY.toFloat()) + } + + saveTex.texture.dispose() + savePixmap.dispose() + + batch.begin() } override fun dispose() { - TODO("Not yet implemented") + } + + override fun keyDown(keycode: Int): Boolean { + if (this.isVisible) { + val cells = playerCells + + if ((keycode == Input.Keys.UP || keycode == App.getConfigInt("control_key_up")) && scrollTarget > 0) { + scrollFrom = listScroll + scrollTarget -= 1 + scrollAnimCounter = 0f + } + else if ((keycode == Input.Keys.DOWN || keycode == App.getConfigInt("control_key_down")) && scrollTarget < cells.size - savesVisible) { + scrollFrom = listScroll + scrollTarget += 1 + scrollAnimCounter = 0f + } + } + return true + } + + override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean { + playerCells.forEach { it.touchDown(screenX, screenY, pointer, button) } + return true + } + + override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean { + playerCells.forEach { it.touchUp(screenX, screenY, pointer, button) } + return true + } + + override fun scrolled(amountX: Float, amountY: Float): Boolean { + if (this.isVisible) { + val cells = playerCells + + if (amountY <= -1f && scrollTarget > 0) { + scrollFrom = listScroll + scrollTarget -= 1 + scrollAnimCounter = 0f + } + else if (amountY >= 1f && scrollTarget < cells.size - savesVisible) { + scrollFrom = listScroll + scrollTarget += 1 + scrollAnimCounter = 0f + } + } + return true + } + + override fun hide() { + playerCells.forEach { it.dispose() } + playerCells.clear() + } + + override fun resize(width: Int, height: Int) { + super.resize(width, height) + scrollAreaHeight = height - 2 * App.scr.tvSafeGraphicsHeight - 64 + savesVisible = (scrollAreaHeight + cellInterval) / (cellInterval + SAVE_CELL_HEIGHT) + + listScroll = 0 + scrollTarget = 0 + uiScroll = 0f + + sliderFBO.dispose() + sliderFBO = FrameBuffer(Pixmap.Format.RGBA8888, uiWidth + 10, height, false) } } \ No newline at end of file diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UILoadNewCharacter.kt b/src/net/torvald/terrarum/modulebasegame/ui/UILoadNewCharacter.kt new file mode 100644 index 000000000..efd0d55fc --- /dev/null +++ b/src/net/torvald/terrarum/modulebasegame/ui/UILoadNewCharacter.kt @@ -0,0 +1,29 @@ +package net.torvald.terrarum.modulebasegame.ui + +import com.badlogic.gdx.graphics.Camera +import com.badlogic.gdx.graphics.g2d.SpriteBatch +import net.torvald.terrarum.App +import net.torvald.terrarum.ui.Toolkit +import net.torvald.terrarum.ui.UICanvas + +/** + * Created by minjaesong on 2023-07-05. + */ +class UILoadNewCharacter(val full: UILoadSavegame) : UICanvas() { + + override var width: Int = Toolkit.drawWidth + override var height: Int = App.scr.height + + override fun updateUI(delta: Float) { + TODO("Not yet implemented") + } + + override fun renderUI(batch: SpriteBatch, camera: Camera) { + TODO("Not yet implemented") + } + + override fun dispose() { + TODO("Not yet implemented") + } + +} \ No newline at end of file diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UILoadSavegame.kt b/src/net/torvald/terrarum/modulebasegame/ui/UILoadSavegame.kt index fcdea49d0..37bd15ea7 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UILoadSavegame.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UILoadSavegame.kt @@ -66,11 +66,9 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { internal val uiXdiffChatOverlay = App.scr.chatWidth / 2 internal val textH = App.fontGame.lineHeight.toInt() - internal val cellGap = 20 internal val cellInterval = cellGap + SAVE_CELL_HEIGHT internal val gradAreaHeight = 32 - // internal val titleTextPosY: Int = App.scr.tvSafeGraphicsHeight + 10 internal val titleTopGradStart: Int = App.scr.tvSafeGraphicsHeight internal val titleTopGradEnd: Int = titleTopGradStart + gradAreaHeight @@ -90,18 +88,16 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { private var scrollAreaHeight = height - 2 * App.scr.tvSafeGraphicsHeight - 64 private var listScroll = 0 // only update when animation is finished private var savesVisible = (scrollAreaHeight + cellGap) / cellInterval - private var uiScroll = 0f private var scrollFrom = 0 private var scrollTarget = 0 private var scrollAnimCounter = 0f private val scrollAnimLen = 0.1f - private var sliderFBO = FrameBuffer(Pixmap.Format.RGBA8888, uiWidth + 10, height, false) - private var showSpinner = false + internal var showSpinner = false - private val playerCells = ArrayList() +// private val playerCells = ArrayList() var mode = 0 // 0: show players, 1: show worlds private set(value) { @@ -122,9 +118,10 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { private val goButtonWidth = 180 private val drawX = (Toolkit.drawWidth - 480) / 2 private val drawY = (App.scr.height - 480) / 2 - private val corruptedBackButton = UIItemTextButton(this, "MENU_LABEL_BACK", (Toolkit.drawWidth - goButtonWidth) / 2, drawY + 480 - 24, goButtonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true) - private val confirmCancelButton = UIItemTextButton(this, "MENU_LABEL_CANCEL", drawX + (240 - goButtonWidth) / 2, drawY + 480 - 24, goButtonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true) - private val confirmDeleteButton = UIItemTextButton(this, "MENU_LABEL_DELETE", drawX + 240 + (240 - goButtonWidth) / 2, drawY + 480- 24, goButtonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true, inactiveCol = Toolkit.Theme.COL_RED, activeCol = Toolkit.Theme.COL_REDD) + private val buttonRowY = drawY + 480 - 24 + private val corruptedBackButton = UIItemTextButton(this, "MENU_LABEL_BACK", (Toolkit.drawWidth - goButtonWidth) / 2, buttonRowY, goButtonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true) + private val confirmCancelButton = UIItemTextButton(this, "MENU_LABEL_CANCEL", drawX + (240 - goButtonWidth) / 2, buttonRowY, goButtonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true) + private val confirmDeleteButton = UIItemTextButton(this, "MENU_LABEL_DELETE", drawX + 240 + (240 - goButtonWidth) / 2, buttonRowY, goButtonWidth, true, alignment = UIItemTextButton.Companion.Alignment.CENTRE, hasBorder = true, inactiveCol = Toolkit.Theme.COL_RED, activeCol = Toolkit.Theme.COL_REDD) private lateinit var loadables: SavegameCollectionPair @@ -171,6 +168,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { private val transitionalListing = UILoadList(this) private val transitionalAutosave = UILoadAutosave(this) private val transitionalManage = UILoadManage(this) + private val transitionalNewCharacter = UILoadNewCharacter(this) private val transitionPanel = UIItemHorizontalFadeSlide( this, (width - internalWidth) / 2, @@ -182,7 +180,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { ) init { - listOf(transitionalAutosave, transitionalManage).forEach { + listOf(transitionalAutosave, transitionalManage, transitionalNewCharacter).forEach { it.posX = (-width / 2f).roundToInt() it.initialX = (-width / 2f).roundToInt() it.posY = 0 @@ -202,7 +200,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { init { corruptedBackButton.clickOnceListener = { _,_ -> remoCon.openUI(UILoadSavegame(remoCon)) } - confirmCancelButton.clickOnceListener = { _, _ -> remoCon.openUI(UILoadSavegame(remoCon)) } + confirmCancelButton.clickOnceListener = { _,_ -> remoCon.openUI(UILoadSavegame(remoCon)) } confirmDeleteButton.clickOnceListener = { _,_ -> val pu = buttonSelectedForDeletion!!.playerUUID val wu = buttonSelectedForDeletion!!.worldUUID @@ -357,7 +355,8 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { } override fun show() { - try { + transitionPanel.show() + /*try { remoCon.handler.lockToggle() showSpinner = true @@ -384,26 +383,27 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { }.start() } - catch (e: UninitializedPropertyAccessException) {} + catch (e: UninitializedPropertyAccessException) {}*/ } override fun hide() { - playerCells.forEach { it.dispose() } - playerCells.clear() + transitionPanel.hide() +// playerCells.forEach { it.dispose() } +// playerCells.clear() } private var touchLatched = false - private fun getCells() = playerCells +// private fun getCells() = playerCells private var loadFired = 0 private var oldMode = -1 - private val mode1Node = Yaml(UITitleRemoConYaml.injectedMenuSingleCharSel).parse() +// private val mode1Node = Yaml(UITitleRemoConYaml.injectedMenuSingleCharSel).parse() // private val mode2Node = Yaml(UITitleRemoConYaml.injectedMenuSingleWorldSel).parse() // private val menus = listOf(mode1Node, mode2Node) - private val deleteCharacterButton = UIItemTextButton( + /*private val deleteCharacterButton = UIItemTextButton( this, "CONTEXT_CHARACTER_DELETE", UIRemoCon.menubarOffX - UIRemoCon.UIRemoConElement.paddingLeft + 72, UIRemoCon.menubarOffY - UIRemoCon.UIRemoConElement.lineHeight * 3 + 16, @@ -418,7 +418,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { mode = MODE_SAVE_DELETE it.highlighted = true } - } + }*/ init { // this UI will NOT persist; the parent of the mode1Node must be set using an absolute value (e.g. treeRoot, not remoCon.currentRemoConContents) @@ -426,10 +426,10 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { //printdbg(this, "UILoadSavegame called, from:") //printStackTrace(this) - mode1Node.parent = remoCon.treeRoot +// mode1Node.parent = remoCon.treeRoot // mode2Node.parent = mode1Node - mode1Node.data = "MENU_MODE_SINGLEPLAYER : net.torvald.terrarum.modulebasegame.ui.UILoadSavegame" +// mode1Node.data = "MENU_MODE_SINGLEPLAYER : net.torvald.terrarum.modulebasegame.ui.UILoadSavegame" // mode2Node.data = "MENU_MODE_SINGLEPLAYER : net.torvald.terrarum.modulebasegame.ui.UILoadSavegame" // printdbg(this, "mode1Node parent: ${mode1Node.parent?.data}") // will be 'null' because the parent is the root node @@ -441,11 +441,12 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { private fun modeChangedHandler(mode: Int) { printdbg(this, "Change mode: $oldMode -> $mode") // remoCon.setNewRemoConContents(menus[mode]) - remoCon.setNewRemoConContents(mode1Node) +// remoCon.setNewRemoConContents(mode1Node) } override fun updateUI(delta: Float) { - if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE) { + transitionPanel.update(delta) + /*if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE) { if (oldMode != mode) { modeChangedHandler(mode) @@ -480,7 +481,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { it.update(delta) } } - } + }*/ if (mode == MODE_SAVE_DELETE_CONFIRM && deleteCellAnimCounter <= scrollAnimLen) { // do transitional moving stuff @@ -495,6 +496,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { private var deleteCellPosYstart = 0f override fun renderUI(batch: SpriteBatch, camera: Camera) { + transitionPanel.render(batch, camera) if (mode == MODE_LOAD_DA_SHIT_ALREADY) { loadFired += 1 @@ -514,7 +516,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { } } else if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE) { - batch.end() + /*batch.end() val cells = getCells() @@ -581,7 +583,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { saveTex.texture.dispose() savePixmap.dispose() - batch.begin() + batch.begin()*/ } else if (mode == MODE_SAVE_MULTIPLE_CHOICES) { // "The Autosave is more recent than the manual save" @@ -604,7 +606,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE || mode == MODE_SAVE_DELETE_CONFIRM) { - deleteCharacterButton.render(batch, camera) +// deleteCharacterButton.render(batch, camera) } if (mode == MODE_SAVE_DELETE_CONFIRM) { buttonSelectedForDeletion?.render(batch, camera) @@ -622,7 +624,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { } override fun keyDown(keycode: Int): Boolean { - if (this.isVisible && (mode == MODE_SELECT || mode == MODE_SAVE_DELETE)) { + /*if (this.isVisible && (mode == MODE_SELECT || mode == MODE_SAVE_DELETE)) { val cells = getCells() if ((keycode == Input.Keys.UP || keycode == App.getConfigInt("control_key_up")) && scrollTarget > 0) { @@ -635,7 +637,8 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { scrollTarget += 1 scrollAnimCounter = 0f } - } + }*/ + transitionPanel.keyDown(keycode) return true } @@ -647,15 +650,15 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { if (::loadManualThumbButton.isInitialized) loadManualThumbButton.touchDown(screenX, screenY, pointer, button) } else if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE) { - getCells().forEach { it.touchDown(screenX, screenY, pointer, button) } - deleteCharacterButton.touchDown(screenX, screenY, pointer, button) +// getCells().forEach { it.touchDown(screenX, screenY, pointer, button) } +// deleteCharacterButton.touchDown(screenX, screenY, pointer, button) } else if (mode == MODE_SAVE_DELETE_CONFIRM) { confirmCancelButton.touchDown(screenX, screenY, pointer, button) confirmDeleteButton.touchDown(screenX, screenY, pointer, button) } else if (mode == MODE_SAVE_DAMAGED) corruptedBackButton.touchDown(screenX, screenY, pointer, button) - + transitionPanel.touchDown(screenX, screenY, pointer, button) return true } @@ -665,21 +668,20 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { if (::loadManualThumbButton.isInitialized) loadManualThumbButton.touchUp(screenX, screenY, pointer, button) } else if (mode == MODE_SELECT || mode == MODE_SAVE_DELETE) { - getCells().forEach { it.touchUp(screenX, screenY, pointer, button) } - deleteCharacterButton.touchUp(screenX, screenY, pointer, button) +// getCells().forEach { it.touchUp(screenX, screenY, pointer, button) } +// deleteCharacterButton.touchUp(screenX, screenY, pointer, button) } else if (mode == MODE_SAVE_DELETE_CONFIRM) { confirmCancelButton.touchUp(screenX, screenY, pointer, button) confirmDeleteButton.touchUp(screenX, screenY, pointer, button) } else if (mode == MODE_SAVE_DAMAGED) corruptedBackButton.touchUp(screenX, screenY, pointer, button) - - + transitionPanel.touchUp(screenX, screenY, pointer, button) return true } override fun scrolled(amountX: Float, amountY: Float): Boolean { - if (this.isVisible && mode == MODE_SELECT || mode == MODE_SAVE_DELETE) { + /*if (this.isVisible && mode == MODE_SELECT || mode == MODE_SAVE_DELETE) { val cells = getCells() if (amountY <= -1f && scrollTarget > 0) { @@ -692,7 +694,8 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { scrollTarget += 1 scrollAnimCounter = 0f } - } + }*/ + transitionPanel.scrolled(amountX, amountY) return true } @@ -724,7 +727,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() { sliderFBO = FrameBuffer(Pixmap.Format.RGBA8888, uiWidth + 10, height, false) } - private fun setCameraPosition(batch: SpriteBatch, camera: Camera, newX: Float, newY: Float) { + internal fun setCameraPosition(batch: SpriteBatch, camera: Camera, newX: Float, newY: Float) { camera.position.set((-newX + App.scr.halfw).round(), (-newY + App.scr.halfh).round(), 0f) camera.update() batch.projectionMatrix = camera.combined