Search in sources :

Example 6 with GuiRadioButton

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

the class GuiProgrammer method initGui.

@Override
public void initGui() {
    if (pastebinGui != null && pastebinGui.outputTag != null) {
        te.readProgWidgetsFromNBT(pastebinGui.outputTag);
        pastebinGui = null;
        NetworkHandler.sendToServer(new PacketProgrammerUpdate(te));
    }
    super.initGui();
    if (programmerUnit != null) {
        te.translatedX = programmerUnit.getTranslatedX();
        te.translatedY = programmerUnit.getTranslatedY();
        te.zoomState = programmerUnit.getLastZoom();
    }
    programmerUnit = new GuiUnitProgrammer(te.progWidgets, fontRenderer, guiLeft, guiTop, xSize, width, height, PROGRAMMING_START_X, PROGRAMMING_START_Y, PROGRAMMING_WIDTH, PROGRAMMING_HEIGHT, te.translatedX, te.translatedY, te.zoomState);
    addWidget(programmerUnit.getScrollBar());
    int xStart = (width - xSize) / 2;
    int yStart = (height - ySize) / 2;
    // addProgWidgetTabs(xStart, yStart);
    importButton = new GuiButtonSpecial(1, xStart + 301, yStart + 3, 20, 15, "<--");
    importButton.setTooltipText("Import program");
    buttonList.add(importButton);
    exportButton = new GuiButtonSpecial(2, xStart + 301, yStart + 20, 20, 15, "-->");
    buttonList.add(exportButton);
    buttonList.add(new GuiButton(3, xStart + 294, yStart + 174, 10, 10, "-"));
    buttonList.add(new GuiButton(4, xStart + 335, yStart + 174, 10, 10, "+"));
    allWidgetsButton = new GuiButtonSpecial(8, xStart + 321, yStart + 159, 10, 10, "<");
    allWidgetsButton.setTooltipText(I18n.format("gui.programmer.button.openPanel.tooltip"));
    addWidget(allWidgetsButton);
    difficultyButtons = new ArrayList<>();
    for (int i = 0; i < IProgWidget.WidgetDifficulty.values().length; i++) {
        GuiRadioButton radioButton = new GuiRadioButton(i, xStart + 263, yStart + 200 + i * 12, 0xFF000000, IProgWidget.WidgetDifficulty.values()[i].getLocalizedName());
        radioButton.checked = ConfigHandler.getProgrammerDifficulty() == i;
        addWidget(radioButton);
        difficultyButtons.add(radioButton);
        radioButton.otherChoices = difficultyButtons;
        if (i == 1)
            radioButton.setTooltip(I18n.format("gui.programmer.difficulty.medium.tooltip"));
        if (i == 2)
            radioButton.setTooltip(I18n.format("gui.programmer.difficulty.advanced.tooltip"));
    }
    buttonList.add(new GuiButton(5, xStart + 5, yStart + 175, 87, 20, I18n.format("gui.programmer.button.showStart")));
    buttonList.add(new GuiButton(6, xStart + 5, yStart + 197, 87, 20, I18n.format("gui.programmer.button.showLatest")));
    addWidget(showInfo = new GuiCheckBox(-1, xStart + 5, yStart + 220, 0xFF000000, "gui.programmer.checkbox.showInfo").setChecked(te.showInfo));
    addWidget(showFlow = new GuiCheckBox(-1, xStart + 5, yStart + 232, 0xFF000000, "gui.programmer.checkbox.showFlow").setChecked(te.showFlow));
    GuiButtonSpecial pastebinButton = new GuiButtonSpecial(7, guiLeft - 24, guiTop + 44, 20, 20, "");
    pastebinButton.setTooltipText(I18n.format("gui.remote.button.pastebinButton"));
    pastebinButton.setRenderedIcon(Textures.GUI_PASTEBIN_ICON_LOCATION);
    buttonList.add(pastebinButton);
    undoButton = new GuiButtonSpecial(9, guiLeft - 24, guiTop + 2, 20, 20, "");
    redoButton = new GuiButtonSpecial(10, guiLeft - 24, guiTop + 23, 20, 20, "");
    GuiButtonSpecial clearAllButton = new GuiButtonSpecial(11, guiLeft - 24, guiTop + 65, 20, 20, "");
    convertToRelativeButton = new GuiButtonSpecial(12, guiLeft - 24, guiTop + 86, 20, 20, "Rel");
    undoButton.setRenderedIcon(Textures.GUI_UNDO_ICON_LOCATION);
    redoButton.setRenderedIcon(Textures.GUI_REDO_ICON_LOCATION);
    clearAllButton.setRenderedIcon(Textures.GUI_DELETE_ICON_LOCATION);
    undoButton.setTooltipText(I18n.format("gui.programmer.button.undoButton.tooltip"));
    redoButton.setTooltipText(I18n.format("gui.programmer.button.redoButton.tooltip"));
    clearAllButton.setTooltipText(I18n.format("gui.programmer.button.clearAllButton.tooltip"));
    buttonList.add(undoButton);
    buttonList.add(redoButton);
    buttonList.add(clearAllButton);
    buttonList.add(convertToRelativeButton);
    String containerName = I18n.format(te.getName() + ".name");
    addLabel(containerName, guiLeft + 7, guiTop + 5, 0xFF404040);
    nameField = new WidgetTextField(fontRenderer, guiLeft + 200, guiTop + 5, 98, fontRenderer.FONT_HEIGHT);
    addWidget(nameField);
    filterField = new FilterTextField(fontRenderer, guiLeft + 78, guiTop + 26, 100, fontRenderer.FONT_HEIGHT);
    filterField.setListener(this);
    addWidget(filterField);
    String name = I18n.format("gui.programmer.name");
    addLabel(name, guiLeft + 197 - fontRenderer.getStringWidth(name), guiTop + 5, 0xFF404040);
    updateVisibleProgWidgets();
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) PacketGuiButton(me.desht.pneumaticcraft.common.network.PacketGuiButton) PacketProgrammerUpdate(me.desht.pneumaticcraft.common.network.PacketProgrammerUpdate) GuiRadioButton(me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton) GuiCheckBox(me.desht.pneumaticcraft.client.gui.widget.GuiCheckBox) Point(java.awt.Point) WidgetTextField(me.desht.pneumaticcraft.client.gui.widget.WidgetTextField)

Example 7 with GuiRadioButton

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

the class GuiProgWidgetArea method initGui.

@Override
public void initGui() {
    super.initGui();
    addLabel(I18n.format("gui.progWidget.area.point1"), guiLeft + 50, guiTop + 10);
    addLabel(I18n.format("gui.progWidget.area.point2"), guiLeft + 177, guiTop + 10);
    addLabel(I18n.format("gui.progWidget.area.type"), guiLeft + 4, guiTop + 50);
    boolean advancedMode = ConfigHandler.getProgrammerDifficulty() == 2;
    GuiButtonSpecial gpsButton1 = new GuiButtonSpecial(0, guiLeft + (advancedMode ? 6 : 55), guiTop + 20, 20, 20, "");
    GuiButtonSpecial gpsButton2 = new GuiButtonSpecial(1, guiLeft + (advancedMode ? 133 : 182), guiTop + 20, 20, 20, "");
    gpsButton1.setRenderStacks(new ItemStack(Itemss.GPS_TOOL));
    gpsButton2.setRenderStacks(new ItemStack(Itemss.GPS_TOOL));
    buttonList.add(gpsButton1);
    buttonList.add(gpsButton2);
    variableField1 = new WidgetComboBox(fontRenderer, guiLeft + 28, guiTop + 25, 88, fontRenderer.FONT_HEIGHT + 1);
    variableField2 = new WidgetComboBox(fontRenderer, guiLeft + 155, guiTop + 25, 88, fontRenderer.FONT_HEIGHT + 1);
    Set<String> variables = guiProgrammer == null ? Collections.emptySet() : guiProgrammer.te.getAllVariables();
    variableField1.setElements(variables);
    variableField2.setElements(variables);
    variableField1.setText(widget.getCoord1Variable());
    variableField2.setText(widget.getCoord2Variable());
    if (advancedMode) {
        addWidget(variableField1);
        addWidget(variableField2);
    }
    final int widgetsPerColumn = 5;
    List<GuiRadioButton> radioButtons = new ArrayList<>();
    for (int i = 0; i < allAreaTypes.size(); i++) {
        AreaType areaType = allAreaTypes.get(i);
        GuiRadioButton radioButton = new GuiRadioButton(i, guiLeft + widgetsPerColumn + i / widgetsPerColumn * 80, guiTop + 60 + i % widgetsPerColumn * 12, 0xFF404040, areaType.getName());
        if (widget.type.getClass() == areaType.getClass()) {
            allAreaTypes.set(i, widget.type);
            radioButton.checked = true;
        }
        addWidget(radioButton);
        radioButtons.add(radioButton);
        radioButton.otherChoices = radioButtons;
    }
    // typeInfoField.setTooltip(I18n.format("gui.progWidget.area.extraInfo.tooltip"));
    // addWidget(new WidgetLabel(guiLeft + 160, guiTop + 100, I18n.format("gui.progWidget.area.extraInfo")));
    switchToWidgets(widget.type);
    if (invSearchGui != null) {
        BlockPos pos = !invSearchGui.getSearchStack().isEmpty() ? ItemGPSTool.getGPSLocation(invSearchGui.getSearchStack()) : null;
        if (pos != null) {
            if (pointSearched == 0) {
                widget.x1 = pos.getX();
                widget.y1 = pos.getY();
                widget.z1 = pos.getZ();
            } else {
                widget.x2 = pos.getX();
                widget.y2 = pos.getY();
                widget.z2 = pos.getZ();
            }
        } else {
            if (pointSearched == 0) {
                widget.x1 = widget.y1 = widget.z1 = 0;
            } else {
                widget.x2 = widget.y2 = widget.z2 = 0;
            }
        }
    }
    List<String> b1List = Lists.newArrayList(I18n.format("gui.progWidget.area.selectGPS1"));
    if (widget.x1 != 0 || widget.y1 != 0 || widget.z1 != 0) {
        b1List.add(String.format(TextFormatting.GRAY + "[Current] %d, %d, %d", widget.x1, widget.y1, widget.z1));
    }
    gpsButton1.setTooltipText(b1List);
    List<String> b2List = Lists.newArrayList(I18n.format("gui.progWidget.area.selectGPS2"));
    if (widget.x2 != 0 || widget.y2 != 0 || widget.z2 != 0) {
        b2List.add(String.format(TextFormatting.GRAY + "[Current] %d, %d, %d", widget.x2, widget.y2, widget.z2));
    }
    gpsButton2.setTooltipText(b2List);
}
Also used : ArrayList(java.util.ArrayList) AreaType(me.desht.pneumaticcraft.common.progwidgets.area.AreaType) GuiButtonSpecial(me.desht.pneumaticcraft.client.gui.GuiButtonSpecial) GuiRadioButton(me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack) WidgetComboBox(me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)

Example 8 with GuiRadioButton

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

the class GuiProgWidgetDigAndPlace method initGui.

@Override
public void initGui() {
    super.initGui();
    List<GuiRadioButton> radioButtons = new ArrayList<>();
    ProgWidgetDigAndPlace.EnumOrder[] orders = ProgWidgetDigAndPlace.EnumOrder.values();
    for (int i = 0; i < orders.length; i++) {
        GuiRadioButton radioButton = new GuiRadioButton(i, guiLeft + 4, guiTop + 30 + i * 12, 0xFF404040, orders[i].getLocalizedName());
        radioButton.checked = orders[i] == widget.getOrder();
        addWidget(radioButton);
        radioButtons.add(radioButton);
        radioButton.otherChoices = radioButtons;
    }
    useMaxActions = new GuiCheckBox(16, guiLeft + (moveActionsToSide() ? 54 : 4), guiTop + 115, 0xFF404040, I18n.format("gui.progWidget.digAndPlace.useMaxActions"));
    useMaxActions.setTooltip("gui.progWidget.digAndPlace.useMaxActions.tooltip");
    useMaxActions.checked = widget.useMaxActions();
    addWidget(useMaxActions);
    textField = new WidgetTextFieldNumber(Minecraft.getMinecraft().fontRenderer, guiLeft + (moveActionsToSide() ? 57 : 7), guiTop + 128, 50, 11);
    textField.setValue(widget.getMaxActions());
    textField.setEnabled(useMaxActions.checked);
    addWidget(textField);
}
Also used : WidgetTextFieldNumber(me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber) ArrayList(java.util.ArrayList) GuiRadioButton(me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton) GuiCheckBox(me.desht.pneumaticcraft.client.gui.widget.GuiCheckBox)

Example 9 with GuiRadioButton

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

the class GuiProgWidgetDropItem method initGui.

@Override
public void initGui() {
    super.initGui();
    List<GuiRadioButton> radioButtons = new ArrayList<>();
    GuiRadioButton radioButton = new GuiRadioButton(7, guiLeft + 4, guiTop + 80, 0xFF404040, "Random");
    radioButton.checked = !((ProgWidgetDropItem) widget).dropStraight();
    addWidget(radioButton);
    radioButtons.add(radioButton);
    radioButton.otherChoices = radioButtons;
    GuiRadioButton radioButton2 = new GuiRadioButton(8, guiLeft + 4, guiTop + 94, 0xFF404040, "Straight");
    radioButton2.checked = ((ProgWidgetDropItem) widget).dropStraight();
    addWidget(radioButton2);
    radioButtons.add(radioButton2);
    radioButton2.otherChoices = radioButtons;
}
Also used : ProgWidgetDropItem(me.desht.pneumaticcraft.common.progwidgets.ProgWidgetDropItem) ArrayList(java.util.ArrayList) GuiRadioButton(me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton)

Example 10 with GuiRadioButton

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

the class GuiWidgetCoordinateCondition method initGui.

@Override
public void initGui() {
    super.initGui();
    checkingAxis[0] = new GuiCheckBox(0, guiLeft + 10, guiTop + 30, 0xFF404040, "X");
    checkingAxis[1] = new GuiCheckBox(1, guiLeft + 10, guiTop + 42, 0xFF404040, "Y");
    checkingAxis[2] = new GuiCheckBox(2, guiLeft + 10, guiTop + 54, 0xFF404040, "Z");
    for (int i = 0; i < 3; i++) {
        checkingAxis[i] = new GuiCheckBox(i, guiLeft + 10, guiTop + 30 + i * 12, 0xFF404040, i == 0 ? "X" : i == 1 ? "Y" : "Z");
        addWidget(checkingAxis[i]);
        checkingAxis[i].setChecked(widget.checkingAxis[i]);
    }
    radioButtons = new ArrayList<>();
    for (int i = 0; i < ICondition.Operator.values().length; i++) {
        GuiRadioButton radioButton = new GuiRadioButton(3 + i, guiLeft + 80, guiTop + 30 + i * 12, 0xFF404040, ICondition.Operator.values()[i].toString());
        radioButton.checked = widget.getOperator().ordinal() == i;
        addWidget(radioButton);
        radioButtons.add(radioButton);
        radioButton.otherChoices = radioButtons;
    }
}
Also used : GuiCheckBox(me.desht.pneumaticcraft.client.gui.widget.GuiCheckBox) 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