Search in sources :

Example 1 with GuiTab

use of com.wuest.prefab.Gui.Controls.GuiTab in project MC-Prefab by Brian-Wuest.

the class GuiStartHouseChooser method Initialize.

private void Initialize() {
    // Get the upper left hand corner of the GUI box.
    int grayBoxX = (this.width / 2) - 188;
    int grayBoxY = (this.height / 2) - 83;
    int color = Color.DARK_GRAY.getRGB();
    this.serverConfiguration = ((ClientProxy) Prefab.proxy).getServerConfiguration();
    // Create the Controls.
    // Column 1:
    this.btnHouseStyle = new GuiButtonExt(4, grayBoxX + 10, grayBoxY + 20, 90, 20, this.houseConfiguration.houseStyle.getDisplayName());
    this.buttonList.add(this.btnHouseStyle);
    this.btnVisualize = new GuiButtonExt(4, grayBoxX + 10, grayBoxY + 60, 90, 20, GuiLangKeys.translateString(GuiLangKeys.GUI_BUTTON_PREVIEW));
    this.buttonList.add(this.btnVisualize);
    int x = grayBoxX + 10;
    int y = grayBoxY + 10;
    int secondColumnY = y;
    int secondColumnX = x + 137;
    this.btnAddFurnace = new GuiCheckBox(5, secondColumnX, secondColumnY, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_FURNACE), this.houseConfiguration.addFurnace);
    this.btnAddFurnace.setStringColor(color);
    this.btnAddFurnace.setWithShadow(false);
    this.btnAddFurnace.visible = false;
    this.buttonList.add(this.btnAddFurnace);
    if (this.serverConfiguration.addFurnace) {
        secondColumnY += 15;
    }
    this.btnAddBed = new GuiCheckBox(2, secondColumnX, secondColumnY, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_BED), this.houseConfiguration.addBed);
    this.btnAddBed.setStringColor(color);
    this.btnAddBed.setWithShadow(false);
    this.btnAddBed.visible = false;
    this.buttonList.add(this.btnAddBed);
    if (this.serverConfiguration.addBed) {
        secondColumnY += 15;
    }
    this.btnAddFarm = new GuiCheckBox(6, secondColumnX, secondColumnY, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_FARM), this.houseConfiguration.addFarm);
    this.btnAddFarm.setStringColor(color);
    this.btnAddFarm.setWithShadow(false);
    this.btnAddFarm.visible = false;
    this.buttonList.add(this.btnAddFarm);
    if (this.serverConfiguration.addFarm) {
        secondColumnY += 15;
    }
    this.btnAddCraftingTable = new GuiCheckBox(5, x, y, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_CRAFTING_TABLE), this.houseConfiguration.addCraftingTable);
    this.btnAddCraftingTable.setStringColor(color);
    this.btnAddCraftingTable.setWithShadow(false);
    this.btnAddCraftingTable.visible = false;
    this.buttonList.add(this.btnAddCraftingTable);
    if (this.serverConfiguration.addCraftingTable) {
        y += 15;
    }
    this.btnAddTorches = new GuiCheckBox(1, x, y, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_TORCHES), this.houseConfiguration.addTorches);
    this.btnAddTorches.setStringColor(color);
    this.btnAddTorches.setWithShadow(false);
    this.btnAddTorches.visible = false;
    this.buttonList.add(this.btnAddTorches);
    if (this.serverConfiguration.addTorches) {
        y += 15;
    }
    this.btnAddChest = new GuiCheckBox(3, x, y, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_CHEST), this.houseConfiguration.addChest);
    this.btnAddChest.setStringColor(color);
    this.btnAddChest.setWithShadow(false);
    this.btnAddChest.visible = false;
    this.buttonList.add(this.btnAddChest);
    if (this.serverConfiguration.addChests) {
        y += 15;
    }
    this.btnAddMineShaft = new GuiCheckBox(7, x, y, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_BUILD_MINESHAFT), this.houseConfiguration.addMineShaft);
    this.btnAddMineShaft.setStringColor(color);
    this.btnAddMineShaft.setWithShadow(false);
    this.btnAddMineShaft.visible = false;
    this.buttonList.add(this.btnAddMineShaft);
    if (this.serverConfiguration.addMineshaft) {
        y += 15;
    }
    this.btnAddChestContents = new GuiCheckBox(4, x, y, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_ADD_CHEST_CONTENTS), this.houseConfiguration.addChestContents);
    this.btnAddChestContents.setStringColor(color);
    this.btnAddChestContents.setWithShadow(false);
    this.btnAddChestContents.visible = false;
    this.buttonList.add(this.btnAddChestContents);
    if (this.allowItemsInChestAndFurnace) {
        y += 15;
    }
    this.btnIsCeilingFlat = new GuiCheckBox(8, x, y, GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_CEILING_FLAT), this.houseConfiguration.isCeilingFlat);
    this.btnIsCeilingFlat.setStringColor(color);
    this.btnIsCeilingFlat.setWithShadow(false);
    this.btnIsCeilingFlat.visible = false;
    this.buttonList.add(this.btnIsCeilingFlat);
    this.btnFloorBlock = new GuiTextSlider(11, grayBoxX + 10, grayBoxY + 20, 90, 20, 0, 2, this.houseConfiguration.floorBlock.getValue(), GuiLangKeys.STARTER_HOUSE_FLOOR_STONE);
    this.buttonList.add(this.btnFloorBlock);
    this.btnCeilingBlock = new GuiTextSlider(12, grayBoxX + 10, grayBoxY + 60, 90, 20, 0, 2, this.houseConfiguration.ceilingBlock.getValue(), GuiLangKeys.STARTER_HOUSE_CEILING_TYPE);
    this.buttonList.add(this.btnCeilingBlock);
    this.btnWallWoodType = new GuiTextSlider(13, grayBoxX + 10, grayBoxY + 100, 90, 20, 0, 5, this.houseConfiguration.wallWoodType.getValue(), GuiLangKeys.STARTER_HOUSE_WALL_TYPE);
    this.buttonList.add(this.btnWallWoodType);
    this.btnGlassColor = new GuiButtonExt(17, grayBoxX + 10, grayBoxY + 20, 90, 20, GuiLangKeys.translateDye(this.houseConfiguration.glassColor));
    this.buttonList.add(this.btnGlassColor);
    // Column 2:
    // Column 3:
    this.btnHouseDepth = new GuiSlider(15, grayBoxX + 147, grayBoxY + 20, 90, 20, "", "", 5, serverConfiguration.maximumStartingHouseSize, this.houseConfiguration.houseDepth, false, true);
    this.buttonList.add(this.btnHouseDepth);
    this.btnHouseWidth = new GuiSlider(16, grayBoxX + 147, grayBoxY + 60, 90, 20, "", "", 5, serverConfiguration.maximumStartingHouseSize, this.houseConfiguration.houseWidth, false, true);
    this.buttonList.add(this.btnHouseWidth);
    // Tabs:
    this.tabGeneral = new GuiTab(this.Tabs, GuiLangKeys.translateString(GuiLangKeys.STARTER_TAB_GENERAL), grayBoxX + 3, grayBoxY - 20);
    this.Tabs.AddTab(this.tabGeneral);
    this.tabConfig = new GuiTab(this.Tabs, GuiLangKeys.translateString(GuiLangKeys.STARTER_TAB_CONFIG), grayBoxX + 54, grayBoxY - 20);
    this.Tabs.AddTab(this.tabConfig);
    this.tabBlockTypes = new GuiTab(this.Tabs, GuiLangKeys.translateString(GuiLangKeys.STARTER_TAB_BLOCK), grayBoxX + 105, grayBoxY - 20);
    this.tabBlockTypes.width = 70;
    this.Tabs.AddTab(this.tabBlockTypes);
    // Create the done and cancel buttons.
    this.btnBuild = new GuiButtonExt(1, grayBoxX + 10, grayBoxY + 136, 90, 20, GuiLangKeys.translateString(GuiLangKeys.GUI_BUTTON_BUILD));
    this.buttonList.add(this.btnBuild);
    this.btnCancel = new GuiButtonExt(2, grayBoxX + 147, grayBoxY + 136, 90, 20, GuiLangKeys.translateString(GuiLangKeys.GUI_BUTTON_CANCEL));
    this.buttonList.add(this.btnCancel);
}
Also used : GuiTab(com.wuest.prefab.Gui.Controls.GuiTab) GuiButtonExt(net.minecraftforge.fml.client.config.GuiButtonExt) GuiCheckBox(com.wuest.prefab.Gui.Controls.GuiCheckBox) GuiTextSlider(com.wuest.prefab.Gui.Controls.GuiTextSlider) GuiSlider(net.minecraftforge.fml.client.config.GuiSlider)

Example 2 with GuiTab

use of com.wuest.prefab.Gui.Controls.GuiTab in project MC-Prefab by Brian-Wuest.

the class GuiDrafter method createGeneralTabControls.

private int createGeneralTabControls(int grayBoxX, int grayBoxY, int uiComponentID) {
    int roomX = grayBoxX + 40;
    int roomY = grayBoxY + 30;
    // Create the 49 room buttons.
    for (int i = 1; i < 50; i++) {
        GuiRoomInfoButton roomButton = new GuiRoomInfoButton(uiComponentID++, roomX, roomY, 18, 18, "");
        HoverChecker hoverChecker = new HoverChecker(roomButton, 800);
        this.roomHovers.add(hoverChecker);
        this.buttonList.add(roomButton);
        this.roomButtons.add(roomButton);
        roomX = roomX + 18;
        if (i % 7 == 0) {
            roomX = grayBoxX + 40;
            roomY = roomY + 18;
        }
    }
    this.btnBasement2 = new GuiButtonExt(uiComponentID++, grayBoxX + 10, grayBoxY + 145, 20, 20, "B2");
    this.buttonList.add(this.btnBasement2);
    this.btnBasement1 = new GuiButtonExt(uiComponentID++, grayBoxX + 10, grayBoxY + 120, 20, 20, "B1");
    this.buttonList.add(this.btnBasement1);
    this.btnGroundFloor = new GuiButtonExt(uiComponentID++, grayBoxX + 10, grayBoxY + 95, 20, 20, "G");
    this.btnGroundFloor.enabled = false;
    this.buttonList.add(this.btnGroundFloor);
    this.btnSecondFloor = new GuiButtonExt(uiComponentID++, grayBoxX + 10, grayBoxY + 70, 20, 20, "2");
    this.buttonList.add(this.btnSecondFloor);
    this.btnThirdFloor = new GuiButtonExt(uiComponentID++, grayBoxX + 10, grayBoxY + 45, 20, 20, "3");
    this.buttonList.add(this.btnThirdFloor);
    this.btnClearPending = new GuiButtonExt(uiComponentID++, grayBoxX + 110, grayBoxY + 186, 80, 20, "Clear Pending");
    this.buttonList.add(this.btnClearPending);
    this.btnBuild = new GuiButtonExt(uiComponentID++, grayBoxX + 195, grayBoxY + 186, 50, 20, GuiLangKeys.translateString(GuiLangKeys.GUI_BUTTON_BUILD));
    this.buttonList.add(this.btnBuild);
    this.btnCancel = new GuiButtonExt(uiComponentID++, grayBoxX + 250, grayBoxY + 186, 50, 20, "Close");
    this.buttonList.add(this.btnCancel);
    // Tabs:
    this.tabGeneral = new GuiTab(this.Tabs, GuiLangKeys.translateString(GuiLangKeys.STARTER_TAB_GENERAL), grayBoxX + 5, grayBoxY - 10);
    this.Tabs.AddTab(this.tabGeneral);
    this.tabDesignRoom = new GuiTab(this.Tabs, "Design Room", grayBoxX + 58, grayBoxY - 10);
    this.tabDesignRoom.width = 90;
    this.tabDesignRoom.visible = false;
    this.Tabs.AddTab(tabDesignRoom);
    this.tabPendingChanges = new GuiTab(this.Tabs, "Pending Changes", grayBoxX + 151, grayBoxY - 10);
    this.tabPendingChanges.width = 100;
    this.tabPendingChanges.visible = false;
    this.Tabs.AddTab(this.tabPendingChanges);
    try {
        this.actionPerformed(this.btnGroundFloor);
        this.roomButtons.get(45).roomInfo.StructureName = AvailableRoomType.Foyer;
        this.actionPerformed(this.btnGroundFloor);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return uiComponentID;
}
Also used : GuiTab(com.wuest.prefab.Gui.Controls.GuiTab) GuiRoomInfoButton(com.wuest.prefab.Gui.Controls.GuiRoomInfoButton) GuiButtonExt(net.minecraftforge.fml.client.config.GuiButtonExt) IOException(java.io.IOException) HoverChecker(net.minecraftforge.fml.client.config.HoverChecker)

Example 3 with GuiTab

use of com.wuest.prefab.Gui.Controls.GuiTab in project MC-Prefab by Brian-Wuest.

the class GuiTabScreen method mouseClicked.

/**
 * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
 */
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
    if (mouseButton == 0) {
        // This handles the button presses.
        super.mouseClicked(mouseX, mouseY, mouseButton);
        // Handle the tab clicking.
        ArrayList<GuiTab> guiTabs = this.Tabs.GetTabs();
        for (GuiTab tab : guiTabs) {
            if (tab.mousePressed(mc, mouseX, mouseY)) {
                tab.playPressSound(mc.getSoundHandler());
                this.tabClicked(tab);
                break;
            }
        }
    }
}
Also used : GuiTab(com.wuest.prefab.Gui.Controls.GuiTab)

Aggregations

GuiTab (com.wuest.prefab.Gui.Controls.GuiTab)3 GuiButtonExt (net.minecraftforge.fml.client.config.GuiButtonExt)2 GuiCheckBox (com.wuest.prefab.Gui.Controls.GuiCheckBox)1 GuiRoomInfoButton (com.wuest.prefab.Gui.Controls.GuiRoomInfoButton)1 GuiTextSlider (com.wuest.prefab.Gui.Controls.GuiTextSlider)1 IOException (java.io.IOException)1 GuiSlider (net.minecraftforge.fml.client.config.GuiSlider)1 HoverChecker (net.minecraftforge.fml.client.config.HoverChecker)1