quickslot design change

This commit is contained in:
minjaesong
2022-10-01 01:51:54 +09:00
parent 37cf747cab
commit 0904ff1cd0
4 changed files with 11 additions and 11 deletions

View File

@@ -55,9 +55,9 @@ data class ItemSlotImage(val baseTex: TextureRegion, val itemTex: TextureRegion?
fun draw(batch: SpriteBatch, cx: Int, cy: Int) { fun draw(batch: SpriteBatch, cx: Int, cy: Int) {
// just draws two image on the centre // just draws two image on the centre
batch.draw(baseTex, cx - (baseTex.regionWidth).div(2).toFloat(), cy - (baseTex.regionHeight).div(2).toFloat()) batch.draw(baseTex, cx - (baseTex.regionWidth).div(2).toFloat(), cy - (baseTex.regionWidth).div(2).toFloat())
if (itemTex != null) if (itemTex != null)
batch.draw(itemTex, cx - (itemTex.regionWidth).div(2).toFloat(), cy - (itemTex.regionHeight).div(2).toFloat()) batch.draw(itemTex, cx - (itemTex.regionWidth).div(2).toFloat(), cy - (itemTex.regionWidth).div(2).toFloat())
} }
} }

View File

@@ -106,20 +106,20 @@ class UIQuickslotBar : UICanvas() {
val percentage = item.durability / item.maxDurability val percentage = item.durability / item.maxDurability
val barCol = UIItemInventoryCellCommonRes.getHealthMeterColour(percentage, 0f, 1f) val barCol = UIItemInventoryCellCommonRes.getHealthMeterColour(percentage, 0f, 1f)
val barBack = barCol mul UIItemInventoryCellCommonRes.meterBackDarkening val barBack = barCol mul UIItemInventoryCellCommonRes.meterBackDarkening
val durabilityIndex = percentage.times(36).roundToInt() val durabilityIndex = percentage.times(38).roundToInt()
// draw bar background // draw bar background
batch.color = barBack batch.color = barBack
batch.draw(ItemSlotImageFactory.slotImage.get(6,7), slotX - 19f, slotY - 21f) batch.draw(ItemSlotImageFactory.slotImage.get(8,7), slotX - 19f, slotY - 19f)
// draw bar foreground // draw bar foreground
batch.color = barCol batch.color = barCol
batch.draw(ItemSlotImageFactory.slotImage.get(durabilityIndex % 10,4 + durabilityIndex / 10), slotX - 19f, slotY - 21f) batch.draw(ItemSlotImageFactory.slotImage.get(durabilityIndex % 10,4 + durabilityIndex / 10), slotX - 19f, slotY - 19f)
} }
else if (item.stackable) { else if (item.stackable) {
val amountString = qs!!.qty.toItemCountText() val amountString = qs!!.qty.toItemCountText()
batch.color = Color(0xfff066_ff.toInt()) batch.color = Color(0xfff066_ff.toInt())
val textLen = amountString.length * App.fontSmallNumbers.W val textLen = amountString.length * App.fontSmallNumbers.W
val y = slotY + 23 - App.fontSmallNumbers.H val y = slotY + 25 - App.fontSmallNumbers.H
val x = slotX - 19 + (38 - textLen) / 2 val x = slotX - 19 + (38 - textLen) / 2
App.fontSmallNumbers.draw(batch, amountString, x.toFloat(), y.toFloat()) App.fontSmallNumbers.draw(batch, amountString, x.toFloat(), y.toFloat())
} }

View File

@@ -90,20 +90,20 @@ class UIQuickslotPie : UICanvas() {
val percentage = item.durability / item.maxDurability val percentage = item.durability / item.maxDurability
val barCol = UIItemInventoryCellCommonRes.getHealthMeterColour(percentage, 0f, 1f) val barCol = UIItemInventoryCellCommonRes.getHealthMeterColour(percentage, 0f, 1f)
val barBack = barCol mul UIItemInventoryCellCommonRes.meterBackDarkening val barBack = barCol mul UIItemInventoryCellCommonRes.meterBackDarkening
val durabilityIndex = percentage.times(36).roundToInt() val durabilityIndex = percentage.times(38).roundToInt()
// draw bar background // draw bar background
batch.color = barBack batch.color = barBack
batch.draw(ItemSlotImageFactory.slotImage.get(6,7), slotX - 19f, slotY - 21f) batch.draw(ItemSlotImageFactory.slotImage.get(8,7), slotX - 19f, slotY - 19f)
// draw bar foreground // draw bar foreground
batch.color = barCol batch.color = barCol
batch.draw(ItemSlotImageFactory.slotImage.get(durabilityIndex % 10,4 + durabilityIndex / 10), slotX - 19f, slotY - 21f) batch.draw(ItemSlotImageFactory.slotImage.get(durabilityIndex % 10,4 + durabilityIndex / 10), slotX - 19f, slotY - 19f)
} }
else if (item.stackable) { else if (item.stackable) {
val amountString = qs!!.qty.toItemCountText() val amountString = qs!!.qty.toItemCountText()
batch.color = Color(0xfff066_ff.toInt()) batch.color = Color(0xfff066_ff.toInt())
val textLen = amountString.length * App.fontSmallNumbers.W val textLen = amountString.length * App.fontSmallNumbers.W
val y = slotY + 23 - App.fontSmallNumbers.H val y = slotY + 25 - App.fontSmallNumbers.H
val x = slotX - 19 + (38 - textLen) / 2 val x = slotX - 19 + (38 - textLen) / 2
App.fontSmallNumbers.draw(batch, amountString, x.toFloat(), y.toFloat()) App.fontSmallNumbers.draw(batch, amountString, x.toFloat(), y.toFloat())
} }