Skip to content

Commit

Permalink
more work on ui (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghzdude committed Jan 14, 2024
1 parent af04a1e commit 2f93eb7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/main/java/gregtech/common/covers/CoverItemFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<ToggleButton> createFilterModeButton(EnumSyncValue<ItemFilterMode> value, ItemFilterMode mode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ public ParentWidget<?> createWidgets(GuiSyncManager syncManager) {
List<OreFilterTestSlot> oreSlots = new ArrayList<>();

return new Column().widthRel(1f).coverChildrenHeight()
.top(22).margin(7)
.child(new HighlightedTextField()
.setHighlightRule(this::highlightRule)
.onUnfocus(() -> {
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
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{

@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));
}
}

0 comments on commit 2f93eb7

Please sign in to comment.