Search in sources :

Example 11 with ColorBorderTexture

use of com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture in project Multiblocked by Low-Drag-MC.

the class SingleCapabilityTrait method refreshSlots.

protected void refreshSlots(DraggableScrollableWidgetGroup dragGroup) {
    dragGroup.widgets.forEach(dragGroup::waitToRemoved);
    ButtonWidget setting = (ButtonWidget) new ButtonWidget(10, 0, 8, 8, new ResourceTexture("multiblocked:textures/gui/option.png"), null).setHoverBorderTexture(1, -1).setHoverTooltips("multiblocked.gui.tips.settings");
    ImageWidget imageWidget = new ImageWidget(1, 1, 16, 16, new GuiTextureGroup(new ColorRectTexture(getColorByIO(guiIO)), new ColorBorderTexture(1, getColorByIO(capabilityIO))));
    setting.setVisible(false);
    DraggableWidgetGroup slot = new DraggableWidgetGroup(x, y, 18, 18);
    slot.setOnSelected(w -> setting.setVisible(true));
    slot.setOnUnSelected(w -> setting.setVisible(false));
    slot.addWidget(imageWidget);
    slot.addWidget(setting);
    slot.setOnEndDrag(b -> {
        x = b.getSelfPosition().x;
        y = b.getSelfPosition().y;
    });
    dragGroup.addWidget(slot);
    setting.setOnPressCallback(cd2 -> {
        DialogWidget dialog = new DialogWidget(dragGroup, true);
        dialog.addWidget(new ImageWidget(0, 0, 176, 256, new ColorRectTexture(0xaf000000)));
        initSettingDialog(dialog, slot);
    });
}
Also used : ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) DraggableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableWidgetGroup) DialogWidget(com.lowdragmc.lowdraglib.gui.widget.DialogWidget) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget) GuiTextureGroup(com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup)

Example 12 with ColorBorderTexture

use of com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture 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"));
}
Also used : ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) SelectorWidget(com.lowdragmc.lowdraglib.gui.widget.SelectorWidget) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) GuiTextureGroup(com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup)

Aggregations

ColorBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture)12 ColorRectTexture (com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture)10 ImageWidget (com.lowdragmc.lowdraglib.gui.widget.ImageWidget)10 ResourceTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceTexture)9 GuiTextureGroup (com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup)8 ButtonWidget (com.lowdragmc.lowdraglib.gui.widget.ButtonWidget)6 WidgetGroup (com.lowdragmc.lowdraglib.gui.widget.WidgetGroup)6 DialogWidget (com.lowdragmc.lowdraglib.gui.widget.DialogWidget)5 DraggableScrollableWidgetGroup (com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup)5 JsonObject (com.google.gson.JsonObject)4 TextTexture (com.lowdragmc.lowdraglib.gui.texture.TextTexture)4 DraggableWidgetGroup (com.lowdragmc.lowdraglib.gui.widget.DraggableWidgetGroup)4 LabelWidget (com.lowdragmc.lowdraglib.gui.widget.LabelWidget)4 SelectorWidget (com.lowdragmc.lowdraglib.gui.widget.SelectorWidget)4 SwitchWidget (com.lowdragmc.lowdraglib.gui.widget.SwitchWidget)4 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)4 ResourceBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture)3 TextFieldWidget (com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget)3 ResourceTextureWidget (com.lowdragmc.multiblocked.api.gui.dialogs.ResourceTextureWidget)3 Collections (java.util.Collections)3