Search in sources :

Example 1 with GuiRadioButton

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

the class GuiProgWidgetArea method actionPerformed.

@Override
public void actionPerformed(IGuiWidget guiWidget) {
    if (guiWidget instanceof GuiRadioButton) {
        AreaType areaType = allAreaTypes.get(guiWidget.getID());
        widget.type = areaType;
        switchToWidgets(areaType);
    }
    super.actionPerformed(guiWidget);
}
Also used : GuiRadioButton(me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton) AreaType(me.desht.pneumaticcraft.common.progwidgets.area.AreaType)

Example 2 with GuiRadioButton

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

the class GuiProgWidgetCondition method initGui.

@Override
public void initGui() {
    super.initGui();
    if (isSidedWidget()) {
        for (int i = 0; i < 6; i++) {
            String sideName = PneumaticCraftUtils.getOrientationName(EnumFacing.getFront(i));
            GuiCheckBox checkBox = new GuiCheckBox(i, guiLeft + 4, guiTop + 30 + i * 12, 0xFF404040, sideName);
            checkBox.checked = ((ISidedWidget) widget).getSides()[i];
            addWidget(checkBox);
        }
    }
    int baseX = isSidedWidget() ? 90 : 4;
    int baseY = isUsingAndOr() ? 60 : 30;
    List<GuiRadioButton> radioButtons;
    GuiRadioButton radioButton;
    if (isUsingAndOr()) {
        radioButtons = new ArrayList<>();
        radioButton = new GuiRadioButton(6, guiLeft + baseX, guiTop + 30, 0xFF404040, "Any block");
        radioButton.checked = !((ICondition) widget).isAndFunction();
        addWidget(radioButton);
        radioButtons.add(radioButton);
        radioButton.otherChoices = radioButtons;
        radioButton = new GuiRadioButton(7, guiLeft + baseX, guiTop + 42, 0xFF404040, "All blocks");
        radioButton.checked = ((ICondition) widget).isAndFunction();
        addWidget(radioButton);
        radioButtons.add(radioButton);
        radioButton.otherChoices = radioButtons;
    }
    if (requiresNumber()) {
        radioButtons = new ArrayList<>();
        for (int i = 0; i < ICondition.Operator.values().length; i++) {
            radioButton = new GuiRadioButton(8 + i, guiLeft + baseX, guiTop + baseY + i * 12, 0xFF404040, ICondition.Operator.values()[i].toString());
            radioButton.checked = ((ICondition) widget).getOperator().ordinal() == i;
            addWidget(radioButton);
            radioButtons.add(radioButton);
            radioButton.otherChoices = radioButtons;
        }
        textField = new WidgetTextField(Minecraft.getMinecraft().fontRenderer, guiLeft + baseX, guiTop + baseY + 30, 50, 11);
        textField.setText(((ICondition) widget).getRequiredCount() + "");
        addWidget(textField);
    }
}
Also used : ISidedWidget(me.desht.pneumaticcraft.common.progwidgets.ISidedWidget) GuiCheckBox(me.desht.pneumaticcraft.client.gui.widget.GuiCheckBox) GuiRadioButton(me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton) ICondition(me.desht.pneumaticcraft.common.progwidgets.ICondition) WidgetTextField(me.desht.pneumaticcraft.client.gui.widget.WidgetTextField)

Example 3 with GuiRadioButton

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

the class GuiProgWidgetCoordinateOperator method initGui.

@Override
public void initGui() {
    super.initGui();
    List<GuiRadioButton> radioButtons = new ArrayList<GuiRadioButton>();
    for (int i = 0; i < EnumOperator.values().length; i++) {
        GuiRadioButton radioButton = new GuiRadioButton(i, guiLeft + 7, guiTop + 42 + 12 * i, 0xFF404040, I18n.format(EnumOperator.values()[i].getUnlocalizedName()));
        radioButtons.add(radioButton);
        radioButton.checked = widget.getOperator().ordinal() == i;
        radioButton.otherChoices = radioButtons;
        addWidget(radioButton);
    }
    variableField = new WidgetComboBox(fontRenderer, guiLeft + 90, guiTop + 42, 80, fontRenderer.FONT_HEIGHT + 1);
    variableField.setElements(guiProgrammer.te.getAllVariables());
    addWidget(variableField);
    variableField.setText(widget.getVariable());
}
Also used : ArrayList(java.util.ArrayList) GuiRadioButton(me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton) WidgetComboBox(me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)

Example 4 with GuiRadioButton

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

the class GuiProgWidgetGoto method initGui.

@Override
public void initGui() {
    super.initGui();
    List<GuiRadioButton> radioButtons = new ArrayList<GuiRadioButton>();
    GuiRadioButton radioButton = new GuiRadioButton(0, guiLeft + 4, guiTop + 44, 0xFF404040, "Done when arrived");
    radioButton.checked = !((ProgWidgetGoToLocation) widget).doneWhenDeparting;
    addWidget(radioButton);
    radioButtons.add(radioButton);
    radioButton.otherChoices = radioButtons;
    GuiRadioButton radioButton2 = new GuiRadioButton(1, guiLeft + 4, guiTop + 58, 0xFF404040, "Done when departing");
    radioButton2.checked = ((ProgWidgetGoToLocation) widget).doneWhenDeparting;
    addWidget(radioButton2);
    radioButtons.add(radioButton2);
    radioButton2.otherChoices = radioButtons;
}
Also used : ProgWidgetGoToLocation(me.desht.pneumaticcraft.common.progwidgets.ProgWidgetGoToLocation) ArrayList(java.util.ArrayList) GuiRadioButton(me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton)

Example 5 with GuiRadioButton

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

the class GuiProgWidgetPlace method initGui.

@Override
public void initGui() {
    super.initGui();
    List<GuiRadioButton> radioButtons = new ArrayList<GuiRadioButton>();
    for (int i = 0; i < 6; i++) {
        GuiRadioButton radioButton = new GuiRadioButton(i + 10, guiLeft + 4, guiTop + 80 + i * 12, 0xFF404040, PneumaticCraftUtils.getOrientationName(EnumFacing.getFront(i)));
        radioButton.checked = widget.placeDir.ordinal() == i;
        addWidget(radioButton);
        radioButtons.add(radioButton);
        radioButton.otherChoices = radioButtons;
    }
}
Also used : ArrayList(java.util.ArrayList) GuiRadioButton(me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton)

Aggregations

GuiRadioButton (me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton)10 ArrayList (java.util.ArrayList)6 GuiCheckBox (me.desht.pneumaticcraft.client.gui.widget.GuiCheckBox)4 WidgetComboBox (me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)2 WidgetTextField (me.desht.pneumaticcraft.client.gui.widget.WidgetTextField)2 AreaType (me.desht.pneumaticcraft.common.progwidgets.area.AreaType)2 Point (java.awt.Point)1 GuiButtonSpecial (me.desht.pneumaticcraft.client.gui.GuiButtonSpecial)1 WidgetTextFieldNumber (me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber)1 PacketGuiButton (me.desht.pneumaticcraft.common.network.PacketGuiButton)1 PacketProgrammerUpdate (me.desht.pneumaticcraft.common.network.PacketProgrammerUpdate)1 ICondition (me.desht.pneumaticcraft.common.progwidgets.ICondition)1 ISidedWidget (me.desht.pneumaticcraft.common.progwidgets.ISidedWidget)1 ProgWidgetDropItem (me.desht.pneumaticcraft.common.progwidgets.ProgWidgetDropItem)1 ProgWidgetGoToLocation (me.desht.pneumaticcraft.common.progwidgets.ProgWidgetGoToLocation)1 GuiButton (net.minecraft.client.gui.GuiButton)1 ItemStack (net.minecraft.item.ItemStack)1 BlockPos (net.minecraft.util.math.BlockPos)1