From 2f93eb7aee91d8d040fa881fc4022d95135651b5 Mon Sep 17 00:00:00 2001 From: Ghzdude <44148655+ghzdude@users.noreply.github.com> Date: Sat, 13 Jan 2024 20:48:38 -0700 Subject: [PATCH] more work on ui (again) --- .../common/covers/CoverItemFilter.java | 4 ++-- .../filter/OreDictionaryItemFilter.java | 24 +++++++++---------- .../filter/OreDictFilterUIManager.java | 7 ++++-- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/main/java/gregtech/common/covers/CoverItemFilter.java b/src/main/java/gregtech/common/covers/CoverItemFilter.java index 279d4f11618..f6cc42593d3 100644 --- a/src/main/java/gregtech/common/covers/CoverItemFilter.java +++ b/src/main/java/gregtech/common/covers/CoverItemFilter.java @@ -161,13 +161,13 @@ public ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManag return getItemFilter().createPanel(guiSyncManager) .size(176, 188).padding(7) .child(CoverWithUI.createTitleRow(getPickItem()).left(7)) - .child(new Column().coverChildren().align(Alignment.TopLeft).top(22) + .child(new Column().widthRel(1f).align(Alignment.TopLeft).top(22).coverChildrenHeight() .child(new Row().coverChildren().marginBottom(4).left(0) .child(createFilterModeButton(filteringMode, ItemFilterMode.FILTER_INSERT)) .child(createFilterModeButton(filteringMode, ItemFilterMode.FILTER_EXTRACT)) .child(createFilterModeButton(filteringMode, ItemFilterMode.FILTER_BOTH))) .child(getItemFilter().createWidgets(guiSyncManager))) - .child(SlotGroupWidget.playerInventory().left(7)); + .child(SlotGroupWidget.playerInventory(0).bottom(7).left(7)); } private Widget createFilterModeButton(EnumSyncValue value, ItemFilterMode mode) { diff --git a/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java b/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java index b6a388973d2..292240c405d 100644 --- a/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java +++ b/src/main/java/gregtech/common/covers/filter/OreDictionaryItemFilter.java @@ -192,7 +192,6 @@ public ParentWidget createWidgets(GuiSyncManager syncManager) { List oreSlots = new ArrayList<>(); return new Column().widthRel(1f).coverChildrenHeight() - .top(22).margin(7) .child(new HighlightedTextField() .setHighlightRule(this::highlightRule) .onUnfocus(() -> { @@ -223,20 +222,21 @@ public ParentWidget createWidgets(GuiSyncManager syncManager) { return slot; }) .build().marginRight(4)) - .child(new CycleButtonWidget() + .child(new ToggleButton() .size(18).value(caseSensitive) - // todo fix the textures for hovering - .textureGetter(i -> GTGuiTextures.BUTTON_CASE_SENSITIVE[i]) + .background(GTGuiTextures.BUTTON_CASE_SENSITIVE[1]) + .hoverBackground(GTGuiTextures.BUTTON_CASE_SENSITIVE[1]) + .selectedBackground(GTGuiTextures.BUTTON_CASE_SENSITIVE[0]) + .selectedHoverBackground(GTGuiTextures.BUTTON_CASE_SENSITIVE[0]) .marginRight(4) - .tooltip(tooltip -> tooltip.setAutoUpdate(true)) - .addTooltipLine(IKey.lang("cover.ore_dictionary_filter.case_sensitive", - caseSensitive.getBoolValue()))) - .child(new CycleButtonWidget() + .tooltip(tooltip -> tooltip.setAutoUpdate(true))) + .child(new ToggleButton() .size(18).value(matchAll) - .textureGetter(i -> GTGuiTextures.BUTTON_MATCH_ALL[i]) - .tooltip(tooltip -> tooltip.setAutoUpdate(true)) - .addTooltipLine(IKey.lang("cover.ore_dictionary_filter.match_all", - matchAll.getBoolValue())))); + .background(GTGuiTextures.BUTTON_MATCH_ALL[1]) + .hoverBackground(GTGuiTextures.BUTTON_MATCH_ALL[1]) + .selectedHoverBackground(GTGuiTextures.BUTTON_MATCH_ALL[0]) + .selectedBackground(GTGuiTextures.BUTTON_MATCH_ALL[0]) + .tooltip(tooltip -> tooltip.setAutoUpdate(true)))); } protected void getStatusIcon(Widget widget) { diff --git a/src/main/java/gregtech/common/items/behaviors/filter/OreDictFilterUIManager.java b/src/main/java/gregtech/common/items/behaviors/filter/OreDictFilterUIManager.java index 28732e0b1bf..e4009d174a6 100644 --- a/src/main/java/gregtech/common/items/behaviors/filter/OreDictFilterUIManager.java +++ b/src/main/java/gregtech/common/items/behaviors/filter/OreDictFilterUIManager.java @@ -4,6 +4,8 @@ import com.cleanroommc.modularui.screen.ModularPanel; import com.cleanroommc.modularui.value.sync.GuiSyncManager; +import com.cleanroommc.modularui.widgets.SlotGroupWidget; + import gregtech.common.covers.filter.FilterTypeRegistry; public class OreDictFilterUIManager extends BaseFilterUIManager{ @@ -11,7 +13,8 @@ public class OreDictFilterUIManager extends BaseFilterUIManager{ @Override public ModularPanel buildUI(HandGuiData guiData, GuiSyncManager guiSyncManager) { var filter = FilterTypeRegistry.getItemFilterForStack(guiData.getUsedItemStack()); - return createBasePanel(filter.getContainerStack()) - .child(filter.createWidgets(guiSyncManager)); + return createBasePanel(filter.getContainerStack()).height(160) + .child(filter.createWidgets(guiSyncManager).top(22).margin(7, 0)) + .child(SlotGroupWidget.playerInventory(0).bottom(7).left(7)); } }