Add missing close buttons

This commit is contained in:
DBotThePony 2023-07-05 17:45:09 +07:00
parent 1ad0a41786
commit 90dc9060cf
Signed by: DBot
GPG Key ID: DCC23B5715498507
13 changed files with 35 additions and 4 deletions

View File

@ -12,6 +12,10 @@ import ru.dbotthepony.mc.otm.menu.decorative.CargoCrateMenu
class CargoCrateScreen(menu: CargoCrateMenu, inventory: Inventory, title: Component) : MatteryScreen<CargoCrateMenu>(menu, inventory, title) {
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = FramePanel(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH, 22f + 4f + 6f * 18f, getTitle())
frame.makeCloseButton()
frame.onClose { onClose() }
val grid = GridPanel(this, frame, 8f, 18f, 9f * 18f, 6f * 18f, 9, 6)
for (slot in menu.storageSlots)

View File

@ -16,6 +16,9 @@ class HoloSignScreen(menu: HoloSignMenu, inventory: Inventory, title: Component)
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = FramePanel(this, null, 0f, 0f, 200f, 200f, getTitle())
frame.makeCloseButton()
frame.onClose { onClose() }
val input = NetworkedStringInputPanel(this, frame, backend = menu.text)
input.dock = Dock.FILL
input.multiLine = true

View File

@ -11,6 +11,10 @@ import ru.dbotthepony.mc.otm.menu.decorative.MinecartCargoCrateMenu
class MinecartCargoCrateScreen(menu: MinecartCargoCrateMenu, inventory: Inventory, title: Component) : MatteryScreen<MinecartCargoCrateMenu>(menu, inventory, title) {
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = FramePanel(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH, 22f + 4f + 6f * 18f, getTitle())
frame.makeCloseButton()
frame.onClose { onClose() }
val grid = GridPanel(this, frame, 8f, 18f, 9f * 18f, 6f * 18f, 9, 6)
for (slot in menu.storageSlots)

View File

@ -49,6 +49,9 @@ class MatterPanelScreen(
val frame = FramePanel.padded(this, null, GRID_WIDTH * AbstractSlotPanel.SIZE + ScrollBarConstants.WIDTH + 4f, GRID_HEIGHT * AbstractSlotPanel.SIZE + 2f, title)
frame.dockPadding = frame.dockPadding.copy(top = frame.dockPadding.top + 2f)
frame.makeCloseButton()
frame.onClose { onClose() }
val controls = DeviceControls(this, frame)
LargeBooleanRectangleButtonPanel(this, controls,

View File

@ -1,6 +1,5 @@
package ru.dbotthepony.mc.otm.client.screen.storage
import com.mojang.blaze3d.vertex.PoseStack
import net.minecraft.client.gui.GuiGraphics
import net.minecraft.network.chat.Component
import net.minecraft.world.entity.player.Inventory
@ -28,6 +27,9 @@ class DriveViewerScreen(menu: DriveViewerMenu, inventory: Inventory, title: Comp
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = FramePanel(this, null, 0f, 0f, FRAME_WIDTH, FRAME_HEIGHT, getTitle())
frame.makeCloseButton()
frame.onClose { onClose() }
val views = ArrayList<EditablePanel<*>>()
val settings = ArrayList<EditablePanel<*>>()

View File

@ -42,6 +42,9 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = FramePanel(this@ItemMonitorScreen, null, 0f, 0f, 1f, 1f, getTitle())
frame.makeCloseButton()
frame.onClose { onClose() }
val topPanel = EditablePanel(this, frame)
topPanel.height = ITEM_GRID_HEIGHT * 18f
topPanel.dock = Dock.TOP

View File

@ -15,7 +15,7 @@ import ru.dbotthepony.mc.otm.menu.storage.StorageBusMenu
class StorageBusScreen(menu: StorageBusMenu, inventory: Inventory, title: Component) :
MatteryScreen<StorageBusMenu>(menu, inventory, title) {
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = super.makeMainFrame()!!
WidePowerGaugePanel(this, frame, menu.energyWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)

View File

@ -15,7 +15,7 @@ import ru.dbotthepony.mc.otm.menu.storage.StorageExporterMenu
class StorageExporterScreen(menu: StorageExporterMenu, inventory: Inventory, title: Component) :
MatteryScreen<StorageExporterMenu>(menu, inventory, title) {
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = super.makeMainFrame()!!
WidePowerGaugePanel(this, frame, menu.energyWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)

View File

@ -15,7 +15,7 @@ import ru.dbotthepony.mc.otm.menu.storage.StorageImporterMenu
class StorageImporterScreen(menu: StorageImporterMenu, inventory: Inventory, title: Component) :
MatteryScreen<StorageImporterMenu>(menu, inventory, title) {
override fun makeMainFrame(): FramePanel<out MatteryScreen<*>> {
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = super.makeMainFrame()!!
WidePowerGaugePanel(this, frame, menu.energyWidget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)

View File

@ -18,6 +18,9 @@ class StoragePowerSupplierScreen(menu: StoragePowerSupplierMenu, inventory: Inve
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = FramePanel(this, width = 200f, height = 60f, title)
frame.makeCloseButton()
frame.onClose { onClose() }
HorizontalPowerGaugePanel(this, frame, menu.energyWidget).also {
it.dock = Dock.BOTTOM
it.dockResize = DockResizeMode.NONE

View File

@ -656,6 +656,9 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
override fun makeMainFrame(): FramePanel<AndroidStationScreen> {
val frame = FramePanel(this, 200f, 108f, title)
frame.makeCloseButton()
frame.onClose { onClose() }
object : Label<AndroidStationScreen>(this@AndroidStationScreen, frame, height = 11f, shadow = true) {
init {
dock = Dock.BOTTOM

View File

@ -25,6 +25,9 @@ class EnergyServoScreen(menu: EnergyServoMenu, inventory: Inventory, title: Comp
width = AbstractSlotPanel.SIZE * 2f + HorizontalPowerGaugePanel.GAUGE_BACKGROUND_TALL.width + 8f + ProgressGaugePanel.GAUGE_BACKGROUND.width * 2f,
AbstractSlotPanel.SIZE + PlayerEquipmentPanel.HEIGHT + 4f, title)
frame.makeCloseButton()
frame.onClose { onClose() }
val equipment = PlayerEquipmentPanel(this, frame, armorSlots = menu.equipment.armorSlots)
equipment.dock = Dock.FILL
equipment.dockResize = DockResizeMode.NONE

View File

@ -34,6 +34,9 @@ class EssenceStorageScreen(menu: EssenceStorageMenu, inventory: Inventory, title
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
val frame = FramePanel.padded(this, width = DEFAULT_FRAME_WIDTH, height = 18f * 2f + 36f + 25f, title)
frame.makeCloseButton()
frame.onClose { onClose() }
val inputs = HorizontalStripPanel(this, frame, height = 18f)
inputs.dock = Dock.TOP
inputs.dockMargin = DockProperty(bottom = 3f, top = 3f)