some adjustments for the quickslot and pie

This commit is contained in:
minjaesong
2023-05-28 01:47:17 +09:00
parent 065f80224f
commit a3ecd4a4f4
4 changed files with 12 additions and 9 deletions

View File

@@ -33,8 +33,9 @@ object ItemSlotImageFactory {
return ItemSlotImage(slotImage.get(number, 0 or isBlack.toInt().shl(1)), ItemCodex.getItemImage(item))
}
fun produceLarge(isBlack: Boolean, number: Int = 10, item: GameItem?): ItemSlotImage {
return ItemSlotImage(slotImage.get(number, 1 or isBlack.toInt().shl(1)), ItemCodex.getItemImage(item))
fun produceLarge(isBlack: Boolean, number: Int = 10, item: GameItem?, hasGauge: Boolean): ItemSlotImage {
val y = if (hasGauge && isBlack) 9 else if (hasGauge && !isBlack) 8 else if (!hasGauge && isBlack) 3 else 1
return ItemSlotImage(slotImage.get(number, y), ItemCodex.getItemImage(item))
}

View File

@@ -37,7 +37,7 @@ class UIQuickslotBar : UICanvas() {
companion object {
const val SLOT_COUNT = 10
const val DISPLAY_OPACITY = 0.8f
const val DISPLAY_OPACITY = 0.92f
const val COMMON_OPEN_CLOSE = 0.12f
}
@@ -85,9 +85,10 @@ class UIQuickslotBar : UICanvas() {
for (i in 0 until SLOT_COUNT) {
val qs = actor.inventory.getQuickslotItem(i)
val item = ItemCodex[qs?.itm]
val itemHasGauge = ((item?.maxDurability ?: 0) > 0.0) || item?.stackable == true
val image = if (i == selection)
ItemSlotImageFactory.produceLarge(false, (i + 1) % SLOT_COUNT, item)
ItemSlotImageFactory.produceLarge(false, (i + 1) % SLOT_COUNT, item, itemHasGauge)
else
ItemSlotImageFactory.produce(true, (i + 1) % SLOT_COUNT, item)

View File

@@ -26,7 +26,7 @@ class UIQuickslotPie : UICanvas() {
private val slotCount = UIQuickslotBar.SLOT_COUNT
private val slotDistanceFromCentre: Double
get() = cellSize * 2.5 * handler.scale
get() = cellSize * 2.666 * handler.scale
override var width: Int = cellSize * 7
override var height: Int = width
@@ -36,7 +36,7 @@ class UIQuickslotPie : UICanvas() {
*/
override var openCloseTime: Second = COMMON_OPEN_CLOSE
private val smallenSize = 0.93f
private val smallenSize = 0.92f
var selection: Int = -1
@@ -66,6 +66,7 @@ class UIQuickslotPie : UICanvas() {
for (i in 0 until slotCount) {
val qs = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying?.inventory?.getQuickslotItem(i)
val item = ItemCodex[qs?.itm]
val itemHasGauge = ((item?.maxDurability ?: 0) > 0.0) || item?.stackable == true
// set position
val angle = Math.PI * 2.0 * (i.toDouble() / slotCount) + Math.PI // 180 deg monitor-wise
@@ -73,7 +74,7 @@ class UIQuickslotPie : UICanvas() {
// draw cells
val image = if (i == selection)
ItemSlotImageFactory.produceLarge(false, (i + 1) % SLOT_COUNT, item)
ItemSlotImageFactory.produceLarge(false, (i + 1) % SLOT_COUNT, item, itemHasGauge)
else
ItemSlotImageFactory.produce(true, (i + 1) % SLOT_COUNT, item)