use of com.lowdragmc.lowdraglib.gui.widget.SelectorWidget in project Multiblocked by Low-Drag-MC.
the class ProgressCapabilityTrait method initSettingDialog.
@Override
protected void initSettingDialog(DialogWidget dialog, DraggableWidgetGroup slot) {
ImageWidget imageWidget = (ImageWidget) slot.widgets.get(0);
ButtonWidget setting = (ButtonWidget) slot.widgets.get(1);
ButtonWidget imageSelector = (ButtonWidget) new ButtonWidget(5, 65, width, height, new GuiTextureGroup(new ColorBorderTexture(1, -1), new ResourceTexture(texture).getSubTexture(0, 0, 1, 0.5)), null).setHoverTooltips("multiblocked.gui.tips.select_image");
dialog.addWidget(new TextFieldWidget(5, 25, 50, 15, null, s -> {
width = Integer.parseInt(s);
Size size = new Size(width, height);
slot.setSize(size);
imageWidget.setSize(size);
imageSelector.setSize(size);
setting.setSelfPosition(new Position(width - 8, 0));
}).setCurrentString(width + "").setNumbersOnly(1, 180).setHoverTooltips("multiblocked.gui.trait.set_width"));
dialog.addWidget(new TextFieldWidget(5, 45, 50, 15, null, s -> {
height = Integer.parseInt(s);
Size size = new Size(width, height);
slot.setSize(size);
imageWidget.setSize(size);
imageSelector.setSize(size);
setting.setSelfPosition(new Position(width - 8, 0));
}).setCurrentString(height + "").setNumbersOnly(1, 180).setHoverTooltips("multiblocked.gui.trait.set_height"));
dialog.addWidget(new SelectorWidget(5, 5, 50, 15, Arrays.stream(IO.VALUES).map(Enum::name).collect(Collectors.toList()), -1).setValue(capabilityIO.name()).setOnChanged(io -> {
capabilityIO = IO.valueOf(io);
imageWidget.setImage(new GuiTextureGroup(new ResourceTexture(texture).getSubTexture(0, 0, 1, 0.5), new ColorBorderTexture(1, getColorByIO(capabilityIO))));
}).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.trait.capability_io"));
dialog.addWidget(imageSelector);
imageSelector.setOnPressCallback(cd -> new ResourceTextureWidget(dialog.getParent().getGui().mainGroup, texture1 -> {
if (texture1 != null) {
texture = texture1.imageLocation.toString();
ResourceTexture resourceTexture = new ResourceTexture(texture).getSubTexture(0, 0, 1, 0.5);
imageSelector.setButtonTexture(new GuiTextureGroup(new ColorBorderTexture(1, -1), resourceTexture));
imageWidget.setImage(new GuiTextureGroup(resourceTexture, new ColorBorderTexture(1, getColorByIO(capabilityIO))));
}
}));
}
use of com.lowdragmc.lowdraglib.gui.widget.SelectorWidget in project Multiblocked by Low-Drag-MC.
the class SingleCapabilityTrait method initSettingDialog.
protected void initSettingDialog(DialogWidget dialog, DraggableWidgetGroup slot) {
ImageWidget imageWidget = (ImageWidget) slot.widgets.get(0);
dialog.addWidget(new SelectorWidget(5, 5, 40, 15, Arrays.stream(IO.VALUES).map(Enum::name).collect(Collectors.toList()), -1).setValue(capabilityIO.name()).setOnChanged(io -> {
capabilityIO = IO.valueOf(io);
imageWidget.setImage(new GuiTextureGroup(new ColorRectTexture(getColorByIO(guiIO)), new ColorBorderTexture(1, getColorByIO(capabilityIO))));
}).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.trait.capability_io"));
dialog.addWidget(new SelectorWidget(50, 5, 40, 15, Arrays.stream(IO.VALUES).map(Enum::name).collect(Collectors.toList()), -1).setValue(guiIO.name()).setOnChanged(io -> {
guiIO = IO.valueOf(io);
imageWidget.setImage(new GuiTextureGroup(new ColorRectTexture(getColorByIO(guiIO)), new ColorBorderTexture(1, getColorByIO(capabilityIO))));
}).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.trait.gui_io"));
}
Aggregations