Search in sources :

Example 1 with GuiToggleButtonSmall

use of mods.railcraft.client.gui.buttons.GuiToggleButtonSmall in project Railcraft by Railcraft.

the class GuiLocomotive method initGui.

@Override
public void initGui() {
    super.initGui();
    if (loco == null)
        return;
    buttonList.clear();
    int w = (width - xSize) / 2;
    int h = (height - ySize) / 2;
    int id = 0;
    for (LocoMode mode : loco.getAllowedModes()) {
        GuiToggleButtonSmall button = new GuiToggleButtonSmall(id++, 0, h + ySize - 129, 55, LocalizationPlugin.translate("gui.railcraft.locomotive.mode." + mode.getName()), loco.clientMode == mode);
        button.setClickConsumer(b -> loco.clientMode = mode);
        button.setStatusUpdater(b -> b.active = loco.clientMode == mode);
        button.setToolTip(ToolTip.buildToolTip("gui.railcraft.locomotive." + typeTag + ".tips.button.mode." + mode.getName()));
        modeButtons.put(mode, button);
    }
    GuiTools.newButtonRowAuto(buttonList, w + 3, 171, modeButtons.values());
    GuiToggleButtonSmall reverseButton = new GuiToggleButtonSmall(id++, 0, h + ySize - 112, 12, "R", loco.isReverse());
    reverseButton.setClickConsumer(b -> loco.setReverse(!loco.isReverse()));
    reverseButton.setStatusUpdater(b -> b.active = loco.isReverse());
    speedButtons.add(reverseButton);
    for (LocoSpeed speed : LocoSpeed.VALUES) {
        String label = "";
        for (int i = 0; i < speed.getLevel(); i++) {
            label += ">";
        }
        GuiToggleButtonSmall button = new GuiToggleButtonSmall(id++, 0, h + ySize - 112, 7 + speed.getLevel() * 5, label, loco.clientSpeed == speed);
        button.setClickConsumer(b -> loco.clientSpeed = speed);
        button.setStatusUpdater(b -> b.active = loco.clientSpeed == speed);
        speedButtons.add(button);
    }
    GuiTools.newButtonRow(buttonList, w + 8, 3, speedButtons);
    buttonList.add(lockButton = GuiMultiButton.create(id, w + 152, h + ySize - 111, 16, loco.getLockController()));
    lockButton.enabled = loco.clientCanLock;
}
Also used : GuiToggleButtonSmall(mods.railcraft.client.gui.buttons.GuiToggleButtonSmall) LocoSpeed(mods.railcraft.common.carts.EntityLocomotive.LocoSpeed) LocoMode(mods.railcraft.common.carts.EntityLocomotive.LocoMode)

Example 2 with GuiToggleButtonSmall

use of mods.railcraft.client.gui.buttons.GuiToggleButtonSmall in project Railcraft by Railcraft.

the class GuiDetectorVillager method initGui.

@Override
public void initGui() {
    if (tile == null) {
        return;
    }
    buttonList.clear();
    int w = (width - xSize) / 2;
    int h = (height - ySize) / 2;
    buttonList.add(new GuiButton(0, w + 10, h + 25, 30, 20, "<"));
    buttonList.add(new GuiButton(1, w + 135, h + 25, 30, 20, ">"));
    buttonList.add(any = new GuiToggleButtonSmall(2, w + 10, h + 55, 45, LocalizationPlugin.translate("gui.railcraft.detector.villager.any"), mode == Mode.ANY));
    buttonList.add(none = new GuiToggleButtonSmall(3, w + 10, h + 75, 45, LocalizationPlugin.translate("gui.railcraft.detector.villager.none"), mode == Mode.NONE));
    buttonList.add(equals = new GuiToggleButtonSmall(4, w + 122, h + 55, 45, LocalizationPlugin.translate("gui.railcraft.detector.villager.equals"), mode == Mode.EQUALS));
    buttonList.add(not = new GuiToggleButtonSmall(5, w + 122, h + 75, 45, LocalizationPlugin.translate("gui.railcraft.detector.villager.not"), mode == Mode.NOT));
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) GuiToggleButtonSmall(mods.railcraft.client.gui.buttons.GuiToggleButtonSmall)

Aggregations

GuiToggleButtonSmall (mods.railcraft.client.gui.buttons.GuiToggleButtonSmall)2 LocoMode (mods.railcraft.common.carts.EntityLocomotive.LocoMode)1 LocoSpeed (mods.railcraft.common.carts.EntityLocomotive.LocoSpeed)1 GuiButton (net.minecraft.client.gui.GuiButton)1