fixed a bug where quickslot and itemgrid would respond to scrollX instead of scrollY

This commit is contained in:
minjaesong
2021-09-20 01:29:59 +09:00
parent 4784956627
commit 3748f1ecf3
4 changed files with 8 additions and 10 deletions

View File

@@ -77,9 +77,9 @@ object PlayerBuilderSigrid {
fun fillTestInventory(inventory: ActorInventory) {
App.tileMaker.tags.forEach { t, _ ->
inventory.add(t, 5)
inventory.add(t, 9995)
try {
inventory.add("wall@"+t, 9995) // this code will try to add nonexisting wall items, do not get surprised with NPEs
inventory.add("wall@$t", 9995) // this code will try to add nonexisting wall items, do not get surprised with NPEs
}
catch (e: Throwable) {
System.err.println("[PlayerBuilder] $e")

View File

@@ -1,15 +1,14 @@
package net.torvald.terrarum.modulebasegame.ui
import com.badlogic.gdx.Input
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.Input
import net.torvald.terrarum.*
import net.torvald.terrarum.UIItemInventoryCatBar.Companion.CAT_ALL
import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.gameitem.GameItem
import net.torvald.terrarum.gameworld.fmod
import net.torvald.terrarum.itemproperties.ItemCodex
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory
@@ -22,7 +21,6 @@ import net.torvald.terrarum.ui.UIItem
import net.torvald.terrarum.ui.UIItemImageButton
import net.torvald.terrarum.ui.UIItemTextButton.Companion.defaultActiveCol
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
import java.util.*
import kotlin.math.floor
/**
@@ -524,7 +522,7 @@ class UIItemInventoryItemGrid(
// scroll the item list (for now)
if (mouseUp) {
scrollItemPage(amountX.toInt())
scrollItemPage(amountY.toInt())
}
return true

View File

@@ -4,13 +4,13 @@ import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.App
import net.torvald.terrarum.ItemCodex
import net.torvald.terrarum.Second
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.gameworld.fmod
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.*
/**
* A bar-shaped representation of the Quickslot.
@@ -86,7 +86,7 @@ class UIQuickslotBar : UICanvas() {
override fun scrolled(amountX: Float, amountY: Float): Boolean {
// super.scrolled(amount) // no UIItems here
selection = selection.plus(if (amountX > 1) 1 else if (amountX < -1) -1 else 0).fmod(SLOT_COUNT)
selection = selection.plus(if (amountY > 1) 1 else if (amountY < -1) -1 else 0).fmod(SLOT_COUNT)
return true
}

View File

@@ -15,10 +15,10 @@ open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
private val textAreaHMargin = 48
override var width = App.scr.width - UIRemoCon.remoConWidth - textAreaHMargin
override var width = 600
override var height = App.scr.height - textAreaHMargin * 2
private val textArea = UIItemTextArea(this,
UIRemoCon.remoConWidth, textAreaHMargin,
(App.scr.width - width) / 2, textAreaHMargin,
width, height
)