Search in sources :

Example 6 with WidgetComboBox

use of me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox in project pnc-repressurized by TeamPneumatic.

the class GuiProgWidgetArea method switchToWidgets.

private void switchToWidgets(AreaType type) {
    saveWidgets();
    areaTypeValueWidgets.forEach(p -> removeWidget(p.getRight()));
    areaTypeStaticWidgets.forEach(w -> removeWidget(w));
    areaTypeValueWidgets.clear();
    areaTypeStaticWidgets.clear();
    int curY = guiTop + 60;
    int x = guiLeft + 150;
    List<AreaTypeWidget> widgets = new ArrayList<>();
    type.addUIWidgets(widgets);
    for (AreaTypeWidget widget : widgets) {
        WidgetLabel titleWidget = new WidgetLabel(x, curY, I18n.format(widget.title));
        addWidget(titleWidget);
        areaTypeStaticWidgets.add(titleWidget);
        curY += fontRenderer.FONT_HEIGHT + 1;
        if (widget instanceof AreaTypeWidgetInteger) {
            AreaTypeWidgetInteger intWidget = (AreaTypeWidgetInteger) widget;
            WidgetTextFieldNumber intField = new WidgetTextFieldNumber(fontRenderer, x, curY, 40, fontRenderer.FONT_HEIGHT + 1);
            intField.setValue(intWidget.readAction.get());
            addWidget(intField);
            areaTypeValueWidgets.add(new ImmutablePair<AreaType.AreaTypeWidget, IGuiWidget>(widget, intField));
            curY += fontRenderer.FONT_HEIGHT + 20;
        } else if (widget instanceof AreaTypeWidgetEnum<?>) {
            AreaTypeWidgetEnum<?> enumWidget = (AreaTypeWidgetEnum<?>) widget;
            WidgetComboBox enumCbb = new WidgetComboBox(fontRenderer, x, curY, 80, fontRenderer.FONT_HEIGHT + 1).setFixedOptions();
            enumCbb.setElements(getEnumNames(enumWidget.enumClass));
            enumCbb.setText(enumWidget.readAction.get().toString());
            addWidget(enumCbb);
            areaTypeValueWidgets.add(new ImmutablePair<AreaType.AreaTypeWidget, IGuiWidget>(widget, enumCbb));
            curY += fontRenderer.FONT_HEIGHT + 20;
        } else {
            throw new IllegalStateException("Invalid widget type: " + widget.getClass());
        }
    }
}
Also used : WidgetLabel(me.desht.pneumaticcraft.client.gui.widget.WidgetLabel) AreaTypeWidgetInteger(me.desht.pneumaticcraft.common.progwidgets.area.AreaType.AreaTypeWidgetInteger) WidgetTextFieldNumber(me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber) IGuiWidget(me.desht.pneumaticcraft.client.gui.widget.IGuiWidget) ArrayList(java.util.ArrayList) AreaType(me.desht.pneumaticcraft.common.progwidgets.area.AreaType) AreaTypeWidgetEnum(me.desht.pneumaticcraft.common.progwidgets.area.AreaType.AreaTypeWidgetEnum) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) AreaTypeWidget(me.desht.pneumaticcraft.common.progwidgets.area.AreaType.AreaTypeWidget) WidgetComboBox(me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)

Example 7 with WidgetComboBox

use of me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox in project pnc-repressurized by TeamPneumatic.

the class GuiRemoteEditor method initGui.

@Override
public void initGui() {
    if (pastebinGui != null && pastebinGui.outputTag != null) {
        NBTTagCompound tag = remote.getTagCompound();
        if (tag == null) {
            tag = new NBTTagCompound();
            remote.setTagCompound(tag);
        }
        tag.setTag("actionWidgets", pastebinGui.outputTag.getTagList("main", 10));
    } else if (remoteLayout != null) {
        NBTTagCompound tag = remote.getTagCompound();
        if (tag == null) {
            tag = new NBTTagCompound();
            remote.setTagCompound(tag);
        }
        tag.setTag("actionWidgets", remoteLayout.toNBT(oldGuiLeft, oldGuiTop).getTagList("actionWidgets", 10));
    }
    if (invSearchGui != null && invSearchGui.getSearchStack() != null && invSearchGui.getSearchStack().getItem() == Itemss.REMOTE) {
        if (ItemRemote.hasSameSecuritySettings(remote, invSearchGui.getSearchStack())) {
            remoteLayout = new RemoteLayout(invSearchGui.getSearchStack(), guiLeft, guiTop);
        } else {
            mc.player.sendStatusMessage(new TextComponentString("gui.remote.differentSecuritySettings"), false);
        }
    }
    super.initGui();
    oldGuiLeft = guiLeft;
    oldGuiTop = guiTop;
    visibleSpawnWidgets.clear();
    visibleSpawnWidgets.add(new ActionWidgetCheckBox(new GuiCheckBox(-1, guiLeft + 200, guiTop + 10, 0xFF000000, I18n.format("remote.checkbox.name"))));
    visibleSpawnWidgets.add(new ActionWidgetLabel(new WidgetLabelVariable(guiLeft + 200, guiTop + 25, I18n.format("remote.label.name"))));
    visibleSpawnWidgets.add(new ActionWidgetButton(new GuiButtonSpecial(-1, guiLeft + 200, guiTop + 40, 50, 20, I18n.format("remote.button.name"))));
    visibleSpawnWidgets.add(new ActionWidgetDropdown(new WidgetComboBox(fontRenderer, guiLeft + 200, guiTop + 70, 70, fontRenderer.FONT_HEIGHT + 1).setFixedOptions()));
    for (ActionWidget actionWidget : visibleSpawnWidgets) {
        addWidget(actionWidget.getWidget());
    }
    GuiButtonSpecial importRemoteButton = new GuiButtonSpecial(0, guiLeft - 24, guiTop + 20, 20, 20, "");
    importRemoteButton.setTooltipText(I18n.format("gui.remote.button.importRemoteButton"));
    importRemoteButton.setRenderStacks(new ItemStack(Itemss.REMOTE));
    buttonList.add(importRemoteButton);
    GuiButtonSpecial pastebinButton = new GuiButtonSpecial(1, guiLeft - 24, guiTop + 44, 20, 20, "");
    pastebinButton.setTooltipText(I18n.format("gui.remote.button.pastebinButton"));
    // pastebinButton.setRenderStacks(new ItemStack(Itemss.advancedPCB));
    pastebinButton.setRenderedIcon(Textures.GUI_PASTEBIN_ICON_LOCATION);
    buttonList.add(pastebinButton);
}
Also used : PacketUpdateRemoteLayout(me.desht.pneumaticcraft.common.network.PacketUpdateRemoteLayout) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) TextComponentString(net.minecraft.util.text.TextComponentString) GuiCheckBox(me.desht.pneumaticcraft.client.gui.widget.GuiCheckBox) ItemStack(net.minecraft.item.ItemStack) WidgetComboBox(me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)

Example 8 with WidgetComboBox

use of me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox in project pnc-repressurized by TeamPneumatic.

the class GuiRemoteOptionBase method initGui.

@Override
public void initGui() {
    super.initGui();
    String title = I18n.format("remote." + widget.getId() + ".name");
    addLabel(I18n.format("gui.remote.enable"), guiLeft + 10, guiTop + 150);
    addLabel(title, width / 2 - fontRenderer.getStringWidth(title) / 2, guiTop + 5);
    addLabel("#", guiLeft + 10, guiTop + 161);
    if (widget instanceof IActionWidgetLabeled) {
        addLabel(I18n.format("gui.remote.text"), guiLeft + 10, guiTop + 20);
        addLabel(I18n.format("gui.remote.tooltip"), guiLeft + 10, guiTop + 46);
    }
    addLabel(I18n.format("gui.remote.enableValue"), guiLeft + 10, guiTop + 175);
    addLabel("X:", guiLeft + 10, guiTop + 186);
    addLabel("Y:", guiLeft + 67, guiTop + 186);
    addLabel("Z:", guiLeft + 124, guiTop + 186);
    enableField = new WidgetComboBox(fontRenderer, guiLeft + 18, guiTop + 160, 152, 10);
    enableField.setElements(((ContainerRemote) guiRemote.inventorySlots).variables);
    enableField.setText(widget.getEnableVariable());
    enableField.setTooltip(I18n.format("gui.remote.enable.tooltip"));
    addWidget(enableField);
    String valueTooltip = I18n.format("gui.remote.enableValue.tooltip");
    xValueField = new WidgetTextFieldNumber(fontRenderer, guiLeft + 20, guiTop + 185, 38, 10);
    xValueField.setValue(widget.getEnablingValue().getX());
    xValueField.setTooltip(valueTooltip);
    addWidget(xValueField);
    yValueField = new WidgetTextFieldNumber(fontRenderer, guiLeft + 78, guiTop + 185, 38, 10);
    yValueField.setValue(widget.getEnablingValue().getY());
    yValueField.setTooltip(valueTooltip);
    addWidget(yValueField);
    zValueField = new WidgetTextFieldNumber(fontRenderer, guiLeft + 136, guiTop + 185, 38, 10);
    zValueField.setValue(widget.getEnablingValue().getZ());
    zValueField.setTooltip(valueTooltip);
    addWidget(zValueField);
    if (widget instanceof IActionWidgetLabeled) {
        labelField = new WidgetTextField(fontRenderer, guiLeft + 10, guiTop + 30, 160, 10);
        labelField.setText(((IActionWidgetLabeled) widget).getText());
        labelField.setTooltip(I18n.format("gui.remote.label.tooltip"));
        labelField.setMaxStringLength(1000);
        addWidget(labelField);
        tooltipField = new WidgetTextField(fontRenderer, guiLeft + 10, guiTop + 56, 160, 10);
        tooltipField.setText(((IActionWidgetLabeled) widget).getTooltip());
        addWidget(tooltipField);
    }
}
Also used : IActionWidgetLabeled(me.desht.pneumaticcraft.common.remote.IActionWidgetLabeled) WidgetTextFieldNumber(me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber) WidgetComboBox(me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox) WidgetTextField(me.desht.pneumaticcraft.client.gui.widget.WidgetTextField)

Example 9 with WidgetComboBox

use of me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox in project pnc-repressurized by TeamPneumatic.

the class GuiRemoteVariable method initGui.

@Override
public void initGui() {
    super.initGui();
    addLabel(I18n.format("gui.progWidget.coordinate.variableName"), guiLeft + 10, guiTop + 70);
    addLabel("#", guiLeft + 10, guiTop + 81);
    variableField = new WidgetComboBox(fontRenderer, guiLeft + 18, guiTop + 80, 152, 10);
    variableField.setElements(((ContainerRemote) guiRemote.inventorySlots).variables);
    variableField.setText(widget.getVariableName());
    variableField.setTooltip(I18n.format("gui.remote.variable.tooltip"));
    addWidget(variableField);
}
Also used : WidgetComboBox(me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)

Example 10 with WidgetComboBox

use of me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox in project pnc-repressurized by TeamPneumatic.

the class GuiProgWidgetForEach method initGui.

@Override
public void initGui() {
    super.initGui();
    variableField = new WidgetComboBox(fontRenderer, guiLeft + 10, guiTop + 42, 160, fontRenderer.FONT_HEIGHT + 1);
    variableField.setElements(guiProgrammer.te.getAllVariables());
    addWidget(variableField);
    variableField.setText(((IVariableSetWidget) widget).getVariable());
    variableField.setFocused(true);
}
Also used : WidgetComboBox(me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)

Aggregations

WidgetComboBox (me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)11 ArrayList (java.util.ArrayList)4 GuiCheckBox (me.desht.pneumaticcraft.client.gui.widget.GuiCheckBox)2 GuiRadioButton (me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton)2 IGuiWidget (me.desht.pneumaticcraft.client.gui.widget.IGuiWidget)2 WidgetLabel (me.desht.pneumaticcraft.client.gui.widget.WidgetLabel)2 WidgetTextFieldNumber (me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber)2 AreaType (me.desht.pneumaticcraft.common.progwidgets.area.AreaType)2 AreaTypeWidget (me.desht.pneumaticcraft.common.progwidgets.area.AreaType.AreaTypeWidget)2 AreaTypeWidgetEnum (me.desht.pneumaticcraft.common.progwidgets.area.AreaType.AreaTypeWidgetEnum)2 AreaTypeWidgetInteger (me.desht.pneumaticcraft.common.progwidgets.area.AreaType.AreaTypeWidgetInteger)2 ItemStack (net.minecraft.item.ItemStack)2 List (java.util.List)1 GuiButtonSpecial (me.desht.pneumaticcraft.client.gui.GuiButtonSpecial)1 WidgetTextField (me.desht.pneumaticcraft.client.gui.widget.WidgetTextField)1 PacketUpdateRemoteLayout (me.desht.pneumaticcraft.common.network.PacketUpdateRemoteLayout)1 IActionWidgetLabeled (me.desht.pneumaticcraft.common.remote.IActionWidgetLabeled)1 GuiButton (net.minecraft.client.gui.GuiButton)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 BlockPos (net.minecraft.util.math.BlockPos)1