Search in sources :

Example 6 with UIButton

use of net.malisis.core.client.gui.component.interaction.UIButton in project Almura by AlmuraDev.

the class ExchangeGUI method construct.

@Override
public void construct() {
    guiscreenBackground = false;
    Keyboard.enableRepeatEvents(true);
    // Master Pane
    final UIFormContainer form = new UIFormContainer(this, 600, 400, "");
    form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
    form.setMovable(true);
    form.setClosable(true);
    form.setBorder(FontColors.WHITE, 1, 185);
    form.setBackgroundAlpha(215);
    form.setBottomPadding(3);
    form.setRightPadding(3);
    form.setTopPadding(20);
    form.setLeftPadding(3);
    UILabel titleLabel = new UILabel(this, "Almura Grand Exchange");
    titleLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build());
    titleLabel.setPosition(0, -15, Anchor.CENTER | Anchor.TOP);
    // Item Search Area
    final UIFormContainer searchArea = new UIFormContainer(this, 295, 315, "");
    searchArea.setPosition(0, 10, Anchor.LEFT | Anchor.TOP);
    searchArea.setMovable(false);
    searchArea.setClosable(false);
    searchArea.setBorder(FontColors.WHITE, 1, 185);
    searchArea.setBackgroundAlpha(215);
    searchArea.setBottomPadding(3);
    searchArea.setRightPadding(3);
    searchArea.setTopPadding(3);
    searchArea.setLeftPadding(3);
    UILabel searchLabel = new UILabel(this, "Item Name:");
    searchLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build());
    searchLabel.setPosition(0, 0, Anchor.LEFT | Anchor.TOP);
    this.itemSearchField = new UITextField(this, "", false);
    this.itemSearchField.setSize(150, 0);
    this.itemSearchField.setPosition(searchLabel.getWidth() + innerPadding, searchLabel.getY(), Anchor.LEFT | Anchor.TOP);
    this.itemSearchField.setEditable(true);
    this.itemSearchField.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(false).build());
    // Seller Search Area
    UILabel sellerLabel = new UILabel(this, "Seller:");
    sellerLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build());
    sellerLabel.setPosition(itemSearchField.getX() - sellerLabel.getWidth() + innerPadding, searchLabel.getY() + 15, Anchor.LEFT | Anchor.TOP);
    this.sellerSearchField = new UITextField(this, "", false);
    this.sellerSearchField.setSize(150, 0);
    this.sellerSearchField.setPosition(itemSearchField.getX(), sellerLabel.getY(), Anchor.LEFT | Anchor.TOP);
    this.sellerSearchField.setEditable(true);
    this.sellerSearchField.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(false).build());
    // Search button
    final UIButton buttonSearch = new UIButtonBuilder(this).width(40).anchor(Anchor.LEFT | Anchor.TOP).position(sellerSearchField.getX() + sellerSearchField.getWidth() + 10, sellerLabel.getY() - 7).text("Search").listener(this).build("button.search");
    // Bottom Page Control - first button
    final UIButton buttonFirstPage = new UIButtonBuilder(this).width(40).anchor(Anchor.LEFT | Anchor.BOTTOM).position(0, 0).text("First").listener(this).build("button.first");
    // Bottom Page Control - previous button
    final UIButton buttonPreviousPage = new UIButtonBuilder(this).width(40).anchor(Anchor.LEFT | Anchor.BOTTOM).position(buttonFirstPage.getX() + buttonFirstPage.getWidth() + innerPadding, 0).text("Previous").listener(this).build("button.previous");
    // Bottom Page Control - last button
    final UIButton buttonLastPage = new UIButtonBuilder(this).width(40).anchor(Anchor.RIGHT | Anchor.BOTTOM).position(0, 0).text("Last").listener(this).build("button.last");
    // Bottom Page Control - next button
    final UIButton buttonNextPage = new UIButtonBuilder(this).width(40).anchor(Anchor.RIGHT | Anchor.BOTTOM).position(-(buttonLastPage.getX() + buttonLastPage.getWidth() + innerPadding), 0).text("Next").listener(this).build("button.next");
    // Add Elements of Search Area
    searchArea.add(searchLabel, itemSearchField, sellerLabel, sellerSearchField, buttonSearch, buttonFirstPage, buttonPreviousPage, buttonNextPage, buttonLastPage);
    // Economy Pane
    final UIFormContainer economyActionArea = new UIFormContainer(this, 295, 50, "");
    economyActionArea.setPosition(0, searchArea.getY() + searchArea.getHeight() + innerPadding, Anchor.LEFT | Anchor.TOP);
    economyActionArea.setMovable(false);
    economyActionArea.setClosable(false);
    economyActionArea.setBorder(FontColors.WHITE, 1, 185);
    economyActionArea.setBackgroundAlpha(215);
    economyActionArea.setBottomPadding(3);
    economyActionArea.setRightPadding(3);
    economyActionArea.setTopPadding(3);
    economyActionArea.setLeftPadding(3);
    // Bottom Economy Pane - buyStack button
    final UIButton buttonBuyStack = new UIButtonBuilder(this).width(40).anchor(Anchor.LEFT | Anchor.BOTTOM).position(0, 0).text("Buy Stack").listener(this).build("button.buyStack");
    // Bottom Economy Pane - buyStack button
    final UIButton buttonBuySingle = new UIButtonBuilder(this).width(40).anchor(Anchor.CENTER | Anchor.BOTTOM).position(0, 0).text("Buy 1").listener(this).build("button.buySingle");
    // Bottom Economy Pane - buyStack button
    final UIButton buttonBuyQuantity = new UIButtonBuilder(this).width(40).anchor(Anchor.RIGHT | Anchor.BOTTOM).position(0, 0).text("Buy Quantity").listener(this).build("button.buyQuantity");
    economyActionArea.add(buttonBuyStack, buttonBuySingle, buttonBuyQuantity);
    // Seller Inventory Area
    final UIFormContainer sellerInventoryArea = new UIFormContainer(this, 295, 30, "");
    sellerInventoryArea.setPosition(0, 10, Anchor.RIGHT | Anchor.TOP);
    sellerInventoryArea.setMovable(false);
    sellerInventoryArea.setClosable(false);
    sellerInventoryArea.setBorder(FontColors.WHITE, 1, 185);
    sellerInventoryArea.setBackgroundAlpha(215);
    sellerInventoryArea.setBottomPadding(3);
    sellerInventoryArea.setRightPadding(3);
    sellerInventoryArea.setTopPadding(3);
    sellerInventoryArea.setLeftPadding(3);
    final UISlot exchangeSlot1 = new UISlot(this, new MalisisSlot());
    exchangeSlot1.setPosition(0, 0, Anchor.LEFT | Anchor.MIDDLE);
    exchangeSlot1.setTooltip("Exchange Slot 1");
    final UISlot exchangeSlot2 = new UISlot(this, new MalisisSlot());
    exchangeSlot2.setPosition(exchangeSlot1.getX() + exchangeSlot1.getWidth() + 10, 0, Anchor.LEFT | Anchor.MIDDLE);
    exchangeSlot2.setTooltip("Exchange Slot 2");
    final UISlot exchangeSlot3 = new UISlot(this, new MalisisSlot());
    exchangeSlot3.setPosition(exchangeSlot2.getX() + exchangeSlot2.getWidth() + 10, 0, Anchor.LEFT | Anchor.MIDDLE);
    exchangeSlot3.setTooltip("Exchange Slot 3");
    final UISlot exchangeSlot4 = new UISlot(this, new MalisisSlot());
    exchangeSlot4.setPosition(exchangeSlot3.getX() + exchangeSlot3.getWidth() + 10, 0, Anchor.LEFT | Anchor.MIDDLE);
    exchangeSlot4.setTooltip("Exchange Slot 4");
    final UISlot exchangeSlot5 = new UISlot(this, new MalisisSlot());
    exchangeSlot5.setPosition(exchangeSlot4.getX() + exchangeSlot4.getWidth() + 10, 0, Anchor.LEFT | Anchor.MIDDLE);
    exchangeSlot5.setTooltip("Exchange Slot 5");
    final UISlot exchangeSlot6 = new UISlot(this, new MalisisSlot());
    exchangeSlot6.setPosition(exchangeSlot5.getX() + exchangeSlot5.getWidth() + 10, 0, Anchor.LEFT | Anchor.MIDDLE);
    exchangeSlot6.setTooltip("Exchange Slot 6");
    sellerInventoryArea.add(exchangeSlot1, exchangeSlot2, exchangeSlot3, exchangeSlot4, exchangeSlot5, exchangeSlot6);
    // Inventory Area Section (right pane)
    final UIFormContainer inventoryArea = new UIFormContainer(this, 295, 315, "");
    inventoryArea.setPosition(0, 45, Anchor.RIGHT | Anchor.TOP);
    inventoryArea.setMovable(false);
    inventoryArea.setClosable(false);
    inventoryArea.setBorder(FontColors.WHITE, 1, 185);
    inventoryArea.setBackgroundAlpha(215);
    inventoryArea.setBottomPadding(3);
    inventoryArea.setRightPadding(3);
    inventoryArea.setTopPadding(3);
    inventoryArea.setLeftPadding(3);
    // Bottom Economy Pane - buyStack button
    final UIButton buttonList = new UIButtonBuilder(this).width(40).anchor(Anchor.LEFT | Anchor.BOTTOM).position(0, 0).text("List for Sale").listener(this).build("button.listForSaleButton");
    // Bottom Economy Pane - buyStack button
    final UIButton buttonSetPrice = new UIButtonBuilder(this).width(40).anchor(Anchor.CENTER | Anchor.BOTTOM).position(0, 0).text("Set Price").listener(this).build("button.setPrice");
    // Bottom Economy Pane - buyStack button
    final UIButton buttonRemoveItem = new UIButtonBuilder(this).width(40).anchor(Anchor.RIGHT | Anchor.BOTTOM).position(0, 0).text("Remove Item").listener(this).build("button.removeItem");
    inventoryArea.add(buttonList, buttonSetPrice, buttonRemoveItem);
    // Close button
    final UIButton buttonClose = new UIButtonBuilder(this).width(40).anchor(Anchor.BOTTOM | Anchor.RIGHT).text(Text.of("almura.guide.button.close")).listener(this).build("button.close");
    form.add(titleLabel, searchArea, economyActionArea, sellerInventoryArea, inventoryArea, buttonClose);
    addToScreen(form);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) UISlot(net.malisis.core.client.gui.component.UISlot) UIButtonBuilder(com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) MalisisSlot(net.malisis.core.inventory.MalisisSlot) UIFormContainer(com.almuradev.almura.shared.client.ui.component.UIFormContainer) UITextField(net.malisis.core.client.gui.component.interaction.UITextField)

Example 7 with UIButton

use of net.malisis.core.client.gui.component.interaction.UIButton in project Almura by AlmuraDev.

the class SimplePageView method construct.

@Override
public void construct() {
    guiscreenBackground = false;
    Keyboard.enableRepeatEvents(true);
    final UIFormContainer form = new UIFormContainer(this, 420, 225, TextFormatting.WHITE + I18n.format("almura.guide.view.form.title"));
    form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
    form.setMovable(true);
    form.setClosable(true);
    form.setBorder(FontColors.WHITE, 1, 185);
    form.setBackgroundAlpha(185);
    form.setBottomPadding(3);
    form.setRightPadding(3);
    form.setTopPadding(20);
    form.setLeftPadding(3);
    // Remove button
    this.buttonRemove = new UIButtonBuilder(this).width(10).text(Text.of(TextColors.RED, "-")).tooltip(Text.of("almura.guide.view.button.remove.tooltip")).visible(hasAnyPermission()).enabled(hasRemovePermission()).listener(this).build("button.remove");
    // Details button
    this.buttonDetails = new UIButtonBuilder(this).width(10).text(Text.of(TextColors.YELLOW, "?")).tooltip(Text.of(I18n.format("almura.guide.view.button.details.tooltip"))).anchor(Anchor.TOP | Anchor.RIGHT).visible(hasAnyPermission()).listener(this).build("button.details");
    // Add button
    this.buttonAdd = new UIButtonBuilder(this).width(10).x(SimpleScreen.getPaddedX(this.buttonDetails, 2, Anchor.RIGHT)).text(Text.of(TextColors.GREEN, "+")).tooltip(Text.of("almura.guide.view.button.add.tooltip")).anchor(Anchor.TOP | Anchor.RIGHT).visible(hasAnyPermission()).enabled(hasAddPermission()).listener(this).build("button.add");
    // Pages dropdown
    this.pagesSelect = new UISelect<>(this, SimpleScreen.getPaddedWidth(form));
    this.pagesSelect.setLabelFunction(PageListEntry::getName);
    this.pagesSelect.setName("combobox.pages");
    this.pagesSelect.setPosition(this.buttonRemove.isVisible() ? SimpleScreen.getPaddedX(this.buttonRemove, innerPadding) : 0, 0);
    this.pagesSelect.register(this);
    if (hasAnyPermission()) {
        this.pagesSelect.setSize(this.pagesSelect.getWidth() - this.buttonDetails.getWidth() - this.buttonAdd.getWidth() - this.buttonRemove.getWidth() - (innerPadding * 4) + 2, 15);
    }
    // Formatted button
    this.buttonFormat = new UIButtonBuilder(this).width(10).anchor(Anchor.BOTTOM | Anchor.LEFT).visible(this.hasAnyPermission()).listener(this).build("button.format");
    // Content text field
    contentField = new UITextField(this, "", true);
    contentField.setSize(SimpleScreen.getPaddedWidth(form), SimpleScreen.getPaddedHeight(form) - this.pagesSelect.getHeight() - (innerPadding * 2) - this.buttonFormat.getHeight());
    contentField.setPosition(0, SimpleScreen.getPaddedY(this.pagesSelect, innerPadding));
    contentField.setEditable(this.hasModifyPermission());
    contentField.setOptions(0x555555, 0xc8c8c8, 0x00000);
    // Close button
    final UIButton buttonClose = new UIButtonBuilder(this).width(40).anchor(Anchor.BOTTOM | Anchor.RIGHT).text(Text.of("almura.guide.button.close")).listener(this).build("button.close");
    // Save button
    this.buttonSave = new UIButtonBuilder(this).width(40).anchor(Anchor.BOTTOM | Anchor.RIGHT).x(SimpleScreen.getPaddedX(buttonClose, innerPadding, Anchor.RIGHT)).text(Text.of("almura.guide.button.save")).visible(hasAnyPermission()).enabled(hasModifyPermission()).listener(this).build("button.save");
    form.add(this.buttonRemove, this.pagesSelect, this.buttonDetails, this.buttonAdd, this.buttonFormat, contentField, buttonClose, buttonSave);
    addToScreen(form);
    this.updateButtons();
}
Also used : UIButtonBuilder(com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) UIFormContainer(com.almuradev.almura.shared.client.ui.component.UIFormContainer) UITextField(net.malisis.core.client.gui.component.interaction.UITextField) PageListEntry(com.almuradev.almura.feature.guide.PageListEntry)

Example 8 with UIButton

use of net.malisis.core.client.gui.component.interaction.UIButton in project Almura by AlmuraDev.

the class SimpleConfirmRemove method construct.

@Override
public void construct() {
    // Create the form
    final UIForm form = new UIForm(this, 250, 60, I18n.format("almura.guide.view.form.title"));
    form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
    // Confirmation Window Text
    final UILabel line1 = new UILabel(this, "Do you wish to delete the selected guide?");
    line1.setPosition(0, 0, Anchor.CENTER | Anchor.TOP);
    final UIButton yesButton = new UIButton(this, "Yes");
    yesButton.setSize(30, 10);
    yesButton.setPosition(-45, 0, Anchor.RIGHT | Anchor.BOTTOM);
    yesButton.setName("button.yes");
    yesButton.register(this);
    // Cancel
    final UIButton noButton = new UIButton(this, "No");
    noButton.setSize(30, 10);
    noButton.setPosition(-10, 0, Anchor.RIGHT | Anchor.BOTTOM);
    noButton.setName("button.no");
    noButton.register(this);
    form.add(line1, yesButton, noButton);
    addToScreen(form);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) UIForm(com.almuradev.almura.shared.client.ui.component.UIForm)

Example 9 with UIButton

use of net.malisis.core.client.gui.component.interaction.UIButton in project Almura by AlmuraDev.

the class SimplePageDetails method construct.

@Override
public void construct() {
    this.guiscreenBackground = true;
    this.validatePage();
    assert manager.getPage() != null;
    final UIForm form = new UIForm(this, 150, 225, I18n.format("almura.guide.details.form.title"));
    form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
    form.setMovable(true);
    form.setClosable(true);
    form.setZIndex(50);
    // File name
    final UILabel labelId = new UILabel(this, I18n.format("almura.guide.label.id"));
    labelId.setAnchor(Anchor.TOP | Anchor.LEFT);
    final UITextField textFieldId = new UITextField(this, manager.getPage().getId());
    textFieldId.setAnchor(Anchor.TOP | Anchor.LEFT);
    textFieldId.setPosition(0, SimpleScreen.getPaddedY(labelId, 1));
    textFieldId.setSize(UIComponent.INHERITED, 0);
    textFieldId.setFontOptions(this.readOnlyFontOptions);
    textFieldId.setEditable(false);
    // Index
    final UILabel labelIndex = new UILabel(this, I18n.format("almura.guide.label.index"));
    labelIndex.setAnchor(Anchor.TOP | Anchor.LEFT);
    labelIndex.setPosition(0, SimpleScreen.getPaddedY(textFieldId, padding));
    this.textFieldIndex = new UITextField(this, Integer.toString(manager.getPage().getIndex()));
    this.textFieldIndex.setAnchor(Anchor.TOP | Anchor.LEFT);
    this.textFieldIndex.setPosition(0, SimpleScreen.getPaddedY(labelIndex, 1));
    this.textFieldIndex.setSize(UIComponent.INHERITED, 0);
    this.textFieldIndex.setFilter(s -> s.replaceAll("[^\\d]", ""));
    // Title
    final UILabel labelName = new UILabel(this, I18n.format("almura.guide.label.name"));
    labelName.setAnchor(Anchor.TOP | Anchor.LEFT);
    labelName.setPosition(0, SimpleScreen.getPaddedY(this.textFieldIndex, padding));
    this.textFieldName = new UITextField(this, manager.getPage().getName());
    this.textFieldName.setAnchor(Anchor.TOP | Anchor.LEFT);
    this.textFieldName.setPosition(0, SimpleScreen.getPaddedY(labelName, 1));
    this.textFieldName.setSize(UIComponent.INHERITED, 0);
    // Creator
    final UILabel labelCreator = new UILabel(this, I18n.format("almura.guide.label.creator"));
    labelCreator.setAnchor(Anchor.TOP | Anchor.LEFT);
    labelCreator.setPosition(0, SimpleScreen.getPaddedY(this.textFieldName, padding));
    // TODO: Show username in format of: Username (UUID)
    final UITextField textFieldCreator = new UITextField(this, manager.getPage().getCreator().toString());
    textFieldCreator.setAnchor(Anchor.TOP | Anchor.LEFT);
    textFieldCreator.setPosition(0, SimpleScreen.getPaddedY(labelCreator, 1));
    textFieldCreator.setSize(UIComponent.INHERITED, 0);
    textFieldCreator.setFontOptions(this.readOnlyFontOptions);
    textFieldCreator.setEditable(false);
    // Created
    final UILabel labelCreated = new UILabel(this, I18n.format("almura.guide.label.created"));
    labelCreated.setAnchor(Anchor.TOP | Anchor.LEFT);
    labelCreated.setPosition(0, SimpleScreen.getPaddedY(textFieldCreator, padding));
    final UITextField textFieldCreated = new UITextField(this, formatter.format(manager.getPage().getCreated()));
    textFieldCreated.setAnchor(Anchor.TOP | Anchor.LEFT);
    textFieldCreated.setPosition(0, SimpleScreen.getPaddedY(labelCreated, 1));
    textFieldCreated.setSize(UIComponent.INHERITED, 0);
    textFieldCreated.setFontOptions(this.readOnlyFontOptions);
    textFieldCreated.setEditable(false);
    // Last Modifier
    final UILabel labelLastModifier = new UILabel(this, I18n.format("almura.guide.label.last_modifier"));
    labelLastModifier.setAnchor(Anchor.TOP | Anchor.LEFT);
    labelLastModifier.setPosition(0, SimpleScreen.getPaddedY(textFieldCreated, padding));
    // TODO: Show username in format of: Username (UUID)
    final UITextField textFieldLastModifier = new UITextField(this, manager.getPage().getLastModifier().toString());
    textFieldLastModifier.setAnchor(Anchor.TOP | Anchor.LEFT);
    textFieldLastModifier.setPosition(0, SimpleScreen.getPaddedY(labelLastModifier, 1));
    textFieldLastModifier.setSize(UIComponent.INHERITED, 0);
    textFieldLastModifier.setFontOptions(this.readOnlyFontOptions);
    textFieldLastModifier.setEditable(false);
    // Last Modified
    final UILabel labelLastModified = new UILabel(this, I18n.format("almura.guide.label.last_modified"));
    labelLastModified.setAnchor(Anchor.TOP | Anchor.LEFT);
    labelLastModified.setPosition(0, SimpleScreen.getPaddedY(textFieldLastModifier, padding));
    final UITextField textFieldLastModified = new UITextField(this, formatter.format(manager.getPage().getLastModified()));
    textFieldLastModified.setAnchor(Anchor.TOP | Anchor.LEFT);
    textFieldLastModified.setPosition(0, SimpleScreen.getPaddedY(labelLastModified, 1));
    textFieldLastModified.setSize(UIComponent.INHERITED, 0);
    textFieldLastModified.setFontOptions(this.readOnlyFontOptions);
    textFieldLastModified.setEditable(false);
    // Save/Cancel
    final UIButton buttonSave = new UIButtonBuilder(this).text(Text.of("almura.guide.button.close")).anchor(Anchor.BOTTOM | Anchor.RIGHT).width(40).listener(this).build("button.close");
    final UIButton buttonCancel = new UIButtonBuilder(this).text(Text.of("almura.guide.button.save")).anchor(Anchor.BOTTOM | Anchor.RIGHT).position(SimpleScreen.getPaddedX(buttonSave, 2, Anchor.RIGHT), 0).width(40).listener(this).build("button.save");
    form.add(labelId, textFieldId, labelIndex, this.textFieldIndex, labelName, this.textFieldName, labelCreator, textFieldCreator, labelCreated, textFieldCreated, labelLastModifier, textFieldLastModifier, labelLastModified, textFieldLastModified, buttonSave, buttonCancel);
    addToScreen(form);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) UIButtonBuilder(com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) UIForm(com.almuradev.almura.shared.client.ui.component.UIForm) UITextField(net.malisis.core.client.gui.component.interaction.UITextField)

Example 10 with UIButton

use of net.malisis.core.client.gui.component.interaction.UIButton in project Almura by AlmuraDev.

the class SimpleIngameMenu method construct.

@Override
public void construct() {
    this.guiscreenBackground = true;
    final UIBackgroundContainer contentContainer = new UIBackgroundContainer(this);
    contentContainer.setBackgroundAlpha(0);
    contentContainer.setSize(220, 202);
    contentContainer.setAnchor(Anchor.MIDDLE | Anchor.CENTER);
    // Almura Header
    final UIImage almuraHeader = new UIImage(this, new GuiTexture(GuiConfig.Location.ALMURA_LOGO), null);
    almuraHeader.setSize(60, 99);
    almuraHeader.setPosition(0, 0, Anchor.TOP | Anchor.CENTER);
    final UIButton backButton = new UIButtonBuilder(this).text(I18n.format("menu.returnToGame")).size(220, 20).position(0, SimpleScreen.getPaddedY(almuraHeader, 10)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).container(contentContainer).build("button.back");
    final UIBackgroundContainer shortcutContainer = new UIBackgroundContainer(this);
    shortcutContainer.setBackgroundAlpha(0);
    shortcutContainer.setSize(220, 24);
    shortcutContainer.setPosition(backButton.getX(), SimpleScreen.getPaddedY(backButton, PADDING));
    shortcutContainer.setAnchor(Anchor.TOP | Anchor.CENTER);
    final boolean lanAvaiable = Minecraft.getMinecraft().isSingleplayer() && !Minecraft.getMinecraft().getIntegratedServer().getPublic();
    final boolean guideAvailable = Sponge.getPluginManager().getPlugin("guide").isPresent();
    final UIButton shopButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_SHOPPING_BAG).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("almura.menu_button.shop"))).build("button.shop");
    final UIButton guideButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_BOOK).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(shopButton, PADDING), shopButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("almura.menu_button.guide"))).enabled(guideAvailable).build("button.guide");
    final UIButton mapButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_MAP).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(guideButton, PADDING), guideButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("item.map.name"))).build("button.instance");
    final UIButton statisticsButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_PIE_CHART).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(mapButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("gui.stats"))).build("button.statistics");
    final UIButton advancementsButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_TROPHY).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(statisticsButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of("gui.advancements")).build("button.advancements");
    final UIButton forumsButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.ENJIN).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(advancementsButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("almura.menu_button.forums"))).build("button.forums");
    final UIButton lanButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_SITEMAP).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(forumsButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("menu.shareToLan"))).enabled(lanAvaiable).build("button.lan");
    final UIButton optionsButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_COG).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(lanButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(Text.of(I18n.format("menu.options"))).build("button.options");
    final UIButton quitButton = new UIButtonBuilder(this).container(contentContainer).text(Text.of(I18n.format("almura.menu_button.quit"))).fro(FontOptions.builder().from(FontColors.RED_FO).shadow(true).build()).hoverFro(FontOptions.builder().color(Color.ofRgb(255, 89, 89).getRgb()).shadow(true).build()).size(GuiConfig.Button.WIDTH_SHORT, GuiConfig.Button.HEIGHT).position(0, SimpleScreen.getPaddedY(shortcutContainer, 25)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.quit");
    contentContainer.add(almuraHeader, shortcutContainer);
    this.addToScreen(contentContainer);
}
Also used : GuiTexture(net.malisis.core.client.gui.GuiTexture) UIButtonBuilder(com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) UIImage(net.malisis.core.client.gui.component.decoration.UIImage) UIBackgroundContainer(net.malisis.core.client.gui.component.container.UIBackgroundContainer)

Aggregations

UIButton (net.malisis.core.client.gui.component.interaction.UIButton)13 UIButtonBuilder (com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder)10 UILabel (net.malisis.core.client.gui.component.decoration.UILabel)10 UIBackgroundContainer (net.malisis.core.client.gui.component.container.UIBackgroundContainer)6 UIImage (net.malisis.core.client.gui.component.decoration.UIImage)5 UITextField (net.malisis.core.client.gui.component.interaction.UITextField)5 GuiTexture (net.malisis.core.client.gui.GuiTexture)4 UIForm (com.almuradev.almura.shared.client.ui.component.UIForm)3 UIFormContainer (com.almuradev.almura.shared.client.ui.component.UIFormContainer)3 UISlimScrollbar (net.malisis.core.client.gui.component.control.UISlimScrollbar)2 ClientCategory (com.almuradev.almura.core.client.config.ClientCategory)1 PageListEntry (com.almuradev.almura.feature.guide.PageListEntry)1 GuiRemoteTexture (com.almuradev.almura.shared.client.texture.GuiRemoteTexture)1 UISimpleList (com.almuradev.almura.shared.client.ui.component.UISimpleList)1 UISliderBuilder (com.almuradev.almura.shared.client.ui.component.slider.UISliderBuilder)1 ArrayList (java.util.ArrayList)1 Optional (java.util.Optional)1 UISlot (net.malisis.core.client.gui.component.UISlot)1 UISeparator (net.malisis.core.client.gui.component.decoration.UISeparator)1 UICheckBox (net.malisis.core.client.gui.component.interaction.UICheckBox)1