Rename SquareButton to RectangleButton
This commit is contained in:
parent
04568a044e
commit
97577f9c3e
@ -12,7 +12,7 @@ import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
|||||||
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
import ru.dbotthepony.mc.otm.client.render.UVWindingOrder
|
||||||
import ru.dbotthepony.mc.otm.client.render.Widgets18
|
import ru.dbotthepony.mc.otm.client.render.Widgets18
|
||||||
import ru.dbotthepony.mc.otm.client.screen.ExoSuitInventoryScreen
|
import ru.dbotthepony.mc.otm.client.screen.ExoSuitInventoryScreen
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.LargeSquareButtonPanel
|
import ru.dbotthepony.mc.otm.client.screen.panels.LargeRectangleButtonPanel
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.Panel2Widget
|
import ru.dbotthepony.mc.otm.client.screen.panels.Panel2Widget
|
||||||
import ru.dbotthepony.mc.otm.core.IConditionalTickable
|
import ru.dbotthepony.mc.otm.core.IConditionalTickable
|
||||||
import ru.dbotthepony.mc.otm.core.ITickable
|
import ru.dbotthepony.mc.otm.core.ITickable
|
||||||
@ -61,7 +61,7 @@ fun onPostScreenInit(event: ScreenEvent.Init.Post) {
|
|||||||
val screen = event.screen as? InventoryScreen ?: return
|
val screen = event.screen as? InventoryScreen ?: return
|
||||||
|
|
||||||
if (player.hasExoSuit) {
|
if (player.hasExoSuit) {
|
||||||
val widget = Panel2Widget(LargeSquareButtonPanel(screen, null,
|
val widget = Panel2Widget(LargeRectangleButtonPanel(screen, null,
|
||||||
x = screen.guiLeft + screen.xSize + 2f,
|
x = screen.guiLeft + screen.xSize + 2f,
|
||||||
y = screen.guiTop.toFloat(),
|
y = screen.guiTop.toFloat(),
|
||||||
skinElement = Widgets18.RETURN_ARROW_LEFT,
|
skinElement = Widgets18.RETURN_ARROW_LEFT,
|
||||||
|
@ -128,7 +128,7 @@ class ExoSuitInventoryScreen(menu: ExoSuitInventoryMenu) : MatteryScreen<ExoSuit
|
|||||||
scrollPanel.dock = Dock.RIGHT
|
scrollPanel.dock = Dock.RIGHT
|
||||||
scrollPanel.setDockMargin(right = 3f)
|
scrollPanel.setDockMargin(right = 3f)
|
||||||
|
|
||||||
LargeSquareButtonPanel(this, frame, x = frame.width + 2f, skinElement = Widgets18.RETURN_ARROW_LEFT, onPress = {
|
LargeRectangleButtonPanel(this, frame, x = frame.width + 2f, skinElement = Widgets18.RETURN_ARROW_LEFT, onPress = {
|
||||||
shouldOpenVanillaInventory = true
|
shouldOpenVanillaInventory = true
|
||||||
val minecraft = minecraft!!
|
val minecraft = minecraft!!
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
|||||||
|
|
||||||
val arrowLine = EditablePanel(this, arrowAndButtons, y = 38f, height = 8f, width = arrowAndButtons.width)
|
val arrowLine = EditablePanel(this, arrowAndButtons, y = 38f, height = 8f, width = arrowAndButtons.width)
|
||||||
|
|
||||||
val refillPriority = SmallEnumSquareButtonPanel(this, arrowLine,
|
val refillPriority = SmallEnumRectangleButtonPanel(this, arrowLine,
|
||||||
enum = ItemMonitorPlayerSettings.IngredientPriority::class.java,
|
enum = ItemMonitorPlayerSettings.IngredientPriority::class.java,
|
||||||
prop = menu.settings::ingredientPriority,
|
prop = menu.settings::ingredientPriority,
|
||||||
defaultValue = ItemMonitorPlayerSettings.IngredientPriority.SYSTEM,
|
defaultValue = ItemMonitorPlayerSettings.IngredientPriority.SYSTEM,
|
||||||
@ -147,7 +147,7 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
|||||||
|
|
||||||
SlotPanel(this, resultAndButtons, menu.craftingResult, y = 18f)
|
SlotPanel(this, resultAndButtons, menu.craftingResult, y = 18f)
|
||||||
|
|
||||||
val resultTarget = SmallEnumSquareButtonPanel(this, resultAndButtons, y = 38f,
|
val resultTarget = SmallEnumRectangleButtonPanel(this, resultAndButtons, y = 38f,
|
||||||
enum = ItemMonitorPlayerSettings.ResultTarget::class.java,
|
enum = ItemMonitorPlayerSettings.ResultTarget::class.java,
|
||||||
prop = menu.settings::resultTarget,
|
prop = menu.settings::resultTarget,
|
||||||
defaultValue = ItemMonitorPlayerSettings.ResultTarget.MIXED,
|
defaultValue = ItemMonitorPlayerSettings.ResultTarget.MIXED,
|
||||||
@ -158,7 +158,7 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
|||||||
resultTarget.add(ItemMonitorPlayerSettings.ResultTarget.ALL_INVENTORY, ItemMonitorPlayerSettings.ResultTarget.ALL_INVENTORY.component, Widgets8.ARROW_PAINTED_UP, UVWindingOrder.FLIP)
|
resultTarget.add(ItemMonitorPlayerSettings.ResultTarget.ALL_INVENTORY, ItemMonitorPlayerSettings.ResultTarget.ALL_INVENTORY.component, Widgets8.ARROW_PAINTED_UP, UVWindingOrder.FLIP)
|
||||||
resultTarget.add(ItemMonitorPlayerSettings.ResultTarget.ALL_SYSTEM, ItemMonitorPlayerSettings.ResultTarget.ALL_SYSTEM.component, Widgets8.ARROW_PAINTED_UP)
|
resultTarget.add(ItemMonitorPlayerSettings.ResultTarget.ALL_SYSTEM, ItemMonitorPlayerSettings.ResultTarget.ALL_SYSTEM.component, Widgets8.ARROW_PAINTED_UP)
|
||||||
|
|
||||||
val craftingAmount = SmallEnumSquareButtonPanel(this, resultAndButtons, x = 10f, y = 38f,
|
val craftingAmount = SmallEnumRectangleButtonPanel(this, resultAndButtons, x = 10f, y = 38f,
|
||||||
enum = ItemMonitorPlayerSettings.Amount::class.java,
|
enum = ItemMonitorPlayerSettings.Amount::class.java,
|
||||||
prop = menu.settings::craftingAmount,
|
prop = menu.settings::craftingAmount,
|
||||||
defaultValue = ItemMonitorPlayerSettings.Amount.STACK,
|
defaultValue = ItemMonitorPlayerSettings.Amount.STACK,
|
||||||
|
@ -113,7 +113,7 @@ open class ButtonPanel<out S : AbstractContainerScreen<*>>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("PropertyName")
|
@Suppress("PropertyName")
|
||||||
abstract class SquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
abstract class RectangleButtonPanel<out S : AbstractContainerScreen<*>>(
|
||||||
screen: S,
|
screen: S,
|
||||||
parent: EditablePanel<*>?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
@ -185,7 +185,7 @@ abstract class SquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class EnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : Enum<T>>(
|
abstract class EnumRectangleButtonPanel<out S : AbstractContainerScreen<*>, T : Enum<T>>(
|
||||||
screen: S,
|
screen: S,
|
||||||
parent: EditablePanel<*>?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
@ -196,13 +196,13 @@ abstract class EnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : Enu
|
|||||||
val prop: KMutableProperty0<T>,
|
val prop: KMutableProperty0<T>,
|
||||||
val defaultValue: T,
|
val defaultValue: T,
|
||||||
val onChange: ((newValue: T) -> Unit)? = null,
|
val onChange: ((newValue: T) -> Unit)? = null,
|
||||||
) : SquareButtonPanel<S>(screen, parent, x, y, width, height, null) {
|
) : RectangleButtonPanel<S>(screen, parent, x, y, width, height, null) {
|
||||||
private var building = true
|
private var building = true
|
||||||
|
|
||||||
protected val enumMapping = EnumMap<T, Pair<SkinElement, UVWindingOrder>>(enum)
|
protected val enumMapping = EnumMap<T, Pair<SkinElement, UVWindingOrder>>(enum)
|
||||||
protected val tooltipMapping = EnumMap<T, Component>(enum)
|
protected val tooltipMapping = EnumMap<T, Component>(enum)
|
||||||
|
|
||||||
fun addTooltip(value: T, component: Component): EnumSquareButtonPanel<S, T> {
|
fun addTooltip(value: T, component: Component): EnumRectangleButtonPanel<S, T> {
|
||||||
check(tooltipMapping.put(value, component) == null) { "Already has mapping for $value" }
|
check(tooltipMapping.put(value, component) == null) { "Already has mapping for $value" }
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
@ -238,19 +238,19 @@ abstract class EnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : Enu
|
|||||||
return missing
|
return missing
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value: T, skinElement: SkinElement, winding: UVWindingOrder = UVWindingOrder.NORMAL): EnumSquareButtonPanel<S, T> {
|
fun add(value: T, skinElement: SkinElement, winding: UVWindingOrder = UVWindingOrder.NORMAL): EnumRectangleButtonPanel<S, T> {
|
||||||
return add(value, skinElement to winding)
|
return add(value, skinElement to winding)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value: T, skinElement: SkinElement, component: Component, winding: UVWindingOrder = UVWindingOrder.NORMAL): EnumSquareButtonPanel<S, T> {
|
fun add(value: T, skinElement: SkinElement, component: Component, winding: UVWindingOrder = UVWindingOrder.NORMAL): EnumRectangleButtonPanel<S, T> {
|
||||||
return add(value, component, skinElement to winding)
|
return add(value, component, skinElement to winding)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value: T, component: Component, skinElement: SkinElement, winding: UVWindingOrder = UVWindingOrder.NORMAL): EnumSquareButtonPanel<S, T> {
|
fun add(value: T, component: Component, skinElement: SkinElement, winding: UVWindingOrder = UVWindingOrder.NORMAL): EnumRectangleButtonPanel<S, T> {
|
||||||
return add(value, component, skinElement to winding)
|
return add(value, component, skinElement to winding)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value: T, pair: Pair<SkinElement, UVWindingOrder>): EnumSquareButtonPanel<S, T> {
|
fun add(value: T, pair: Pair<SkinElement, UVWindingOrder>): EnumRectangleButtonPanel<S, T> {
|
||||||
check(building) { "Not building" }
|
check(building) { "Not building" }
|
||||||
check(enumMapping.put(value, pair) == null) { "Already has mapping for $value" }
|
check(enumMapping.put(value, pair) == null) { "Already has mapping for $value" }
|
||||||
|
|
||||||
@ -261,12 +261,12 @@ abstract class EnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : Enu
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value: T, component: Component, pair: Pair<SkinElement, UVWindingOrder>): EnumSquareButtonPanel<S, T> {
|
fun add(value: T, component: Component, pair: Pair<SkinElement, UVWindingOrder>): EnumRectangleButtonPanel<S, T> {
|
||||||
addTooltip(value, component)
|
addTooltip(value, component)
|
||||||
return add(value, pair)
|
return add(value, pair)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun finish(): EnumSquareButtonPanel<S, T> {
|
fun finish(): EnumRectangleButtonPanel<S, T> {
|
||||||
check(building) { "Not building" }
|
check(building) { "Not building" }
|
||||||
check(isFullyDefined()) {
|
check(isFullyDefined()) {
|
||||||
"Not all enums having their mapping defined, missing are: ${missingValues.joinToString(", ")}"
|
"Not all enums having their mapping defined, missing are: ${missingValues.joinToString(", ")}"
|
||||||
@ -354,7 +354,7 @@ abstract class EnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : Enu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class LargeSquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
open class LargeRectangleButtonPanel<out S : AbstractContainerScreen<*>>(
|
||||||
screen: S,
|
screen: S,
|
||||||
parent: EditablePanel<*>?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
@ -364,7 +364,7 @@ open class LargeSquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
|||||||
onPress: ((clickButton: Int) -> Unit)? = null,
|
onPress: ((clickButton: Int) -> Unit)? = null,
|
||||||
val skinElement: SkinElement? = null,
|
val skinElement: SkinElement? = null,
|
||||||
val skinElementWinding: UVWindingOrder? = null,
|
val skinElementWinding: UVWindingOrder? = null,
|
||||||
) : SquareButtonPanel<S>(screen, parent, x, y, width, height, onPress) {
|
) : RectangleButtonPanel<S>(screen, parent, x, y, width, height, onPress) {
|
||||||
final override val IDLE = Widgets18.BUTTON_IDLE
|
final override val IDLE = Widgets18.BUTTON_IDLE
|
||||||
final override val HOVERED = Widgets18.BUTTON_HOVERED
|
final override val HOVERED = Widgets18.BUTTON_HOVERED
|
||||||
final override val PRESSED = Widgets18.BUTTON_PRESSED
|
final override val PRESSED = Widgets18.BUTTON_PRESSED
|
||||||
@ -385,7 +385,7 @@ open class LargeSquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class LargeEnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : Enum<T>>(
|
open class LargeEnumRectangleButtonPanel<out S : AbstractContainerScreen<*>, T : Enum<T>>(
|
||||||
screen: S,
|
screen: S,
|
||||||
parent: EditablePanel<*>?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
@ -396,7 +396,7 @@ open class LargeEnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : En
|
|||||||
prop: KMutableProperty0<T>,
|
prop: KMutableProperty0<T>,
|
||||||
defaultValue: T,
|
defaultValue: T,
|
||||||
onChange: ((newValue: T) -> Unit)? = null,
|
onChange: ((newValue: T) -> Unit)? = null,
|
||||||
) : EnumSquareButtonPanel<S, T>(screen, parent, x, y, width, height, enum, prop, defaultValue, onChange) {
|
) : EnumRectangleButtonPanel<S, T>(screen, parent, x, y, width, height, enum, prop, defaultValue, onChange) {
|
||||||
final override val IDLE = Widgets18.BUTTON_IDLE
|
final override val IDLE = Widgets18.BUTTON_IDLE
|
||||||
final override val HOVERED = Widgets18.BUTTON_HOVERED
|
final override val HOVERED = Widgets18.BUTTON_HOVERED
|
||||||
final override val PRESSED = Widgets18.BUTTON_PRESSED
|
final override val PRESSED = Widgets18.BUTTON_PRESSED
|
||||||
@ -407,7 +407,7 @@ open class LargeEnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : En
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class SmallSquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
open class SmallRectangleButtonPanel<out S : AbstractContainerScreen<*>>(
|
||||||
screen: S,
|
screen: S,
|
||||||
parent: EditablePanel<*>?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
@ -417,7 +417,7 @@ open class SmallSquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
|||||||
onPress: ((clickButton: Int) -> Unit)? = null,
|
onPress: ((clickButton: Int) -> Unit)? = null,
|
||||||
val skinElement: SkinElement? = null,
|
val skinElement: SkinElement? = null,
|
||||||
val skinElementWinding: UVWindingOrder? = null,
|
val skinElementWinding: UVWindingOrder? = null,
|
||||||
) : SquareButtonPanel<S>(screen, parent, x, y, width, height, onPress) {
|
) : RectangleButtonPanel<S>(screen, parent, x, y, width, height, onPress) {
|
||||||
final override val IDLE = Widgets8.BUTTON_IDLE
|
final override val IDLE = Widgets8.BUTTON_IDLE
|
||||||
final override val HOVERED = Widgets8.BUTTON_HOVERED
|
final override val HOVERED = Widgets8.BUTTON_HOVERED
|
||||||
final override val PRESSED = Widgets8.BUTTON_PRESSED
|
final override val PRESSED = Widgets8.BUTTON_PRESSED
|
||||||
@ -438,7 +438,7 @@ open class SmallSquareButtonPanel<out S : AbstractContainerScreen<*>>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class SmallEnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : Enum<T>>(
|
open class SmallEnumRectangleButtonPanel<out S : AbstractContainerScreen<*>, T : Enum<T>>(
|
||||||
screen: S,
|
screen: S,
|
||||||
parent: EditablePanel<*>?,
|
parent: EditablePanel<*>?,
|
||||||
x: Float = 0f,
|
x: Float = 0f,
|
||||||
@ -449,7 +449,7 @@ open class SmallEnumSquareButtonPanel<out S : AbstractContainerScreen<*>, T : En
|
|||||||
prop: KMutableProperty0<T>,
|
prop: KMutableProperty0<T>,
|
||||||
defaultValue: T,
|
defaultValue: T,
|
||||||
onChange: ((newValue: T) -> Unit)? = null,
|
onChange: ((newValue: T) -> Unit)? = null,
|
||||||
) : EnumSquareButtonPanel<S, T>(screen, parent, x, y, width, height, enum, prop, defaultValue, onChange) {
|
) : EnumRectangleButtonPanel<S, T>(screen, parent, x, y, width, height, enum, prop, defaultValue, onChange) {
|
||||||
final override val IDLE = Widgets8.BUTTON_IDLE
|
final override val IDLE = Widgets8.BUTTON_IDLE
|
||||||
final override val HOVERED = Widgets8.BUTTON_HOVERED
|
final override val HOVERED = Widgets8.BUTTON_HOVERED
|
||||||
final override val PRESSED = Widgets8.BUTTON_PRESSED
|
final override val PRESSED = Widgets8.BUTTON_PRESSED
|
||||||
|
Loading…
Reference in New Issue
Block a user