Search in sources :

Example 6 with UILabel

use of net.malisis.core.client.gui.component.decoration.UILabel in project Almura by AlmuraDev.

the class SimplePageCreate method construct.

@Override
public void construct() {
    this.guiscreenBackground = true;
    final UIForm form = new UIForm(this, 150, 125, I18n.format("almura.guide.create.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);
    this.textFieldId = new UITextField(this, "");
    this.textFieldId.setAnchor(Anchor.TOP | Anchor.LEFT);
    this.textFieldId.setPosition(0, SimpleScreen.getPaddedY(labelId, 1));
    this.textFieldId.setSize(UIComponent.INHERITED, 0);
    this.textFieldId.setFocused(true);
    this.textFieldId.setFilter(String::toLowerCase);
    // Index
    final UILabel labelIndex = new UILabel(this, I18n.format("almura.guide.label.index"));
    labelIndex.setAnchor(Anchor.TOP | Anchor.LEFT);
    labelIndex.setPosition(0, this.textFieldId.isVisible() ? SimpleScreen.getPaddedY(this.textFieldId, padding) : padding);
    this.textFieldIndex = new UITextField(this, Integer.toString(0));
    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, this.textFieldIndex.isVisible() ? SimpleScreen.getPaddedY(this.textFieldIndex, padding) : padding);
    this.textFieldName = new UITextField(this, "");
    this.textFieldName.setAnchor(Anchor.TOP | Anchor.LEFT);
    this.textFieldName.setPosition(0, SimpleScreen.getPaddedY(labelName, 1));
    this.textFieldName.setSize(UIComponent.INHERITED, 0);
    this.textFieldName.setFilter(s -> s.substring(0, Math.min(s.length(), 50)));
    // Save/Cancel
    final UIButton buttonSave = new UIButtonBuilder(this).text(Text.of("almura.guide.button.save")).anchor(Anchor.BOTTOM | Anchor.RIGHT).width(40).listener(this).build("button.save");
    final UIButton buttonCancel = new UIButtonBuilder(this).text(Text.of("almura.guide.button.cancel")).anchor(Anchor.BOTTOM | Anchor.RIGHT).position(SimpleScreen.getPaddedX(buttonSave, 2, Anchor.RIGHT), 0).width(40).listener(this).build("button.cancel");
    form.add(labelId, this.textFieldId, labelIndex, this.textFieldIndex, labelName, this.textFieldName, buttonCancel, buttonSave);
    addToScreen(form);
    this.textFieldId.setFocused(true);
}
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 7 with UILabel

use of net.malisis.core.client.gui.component.decoration.UILabel 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 8 with UILabel

use of net.malisis.core.client.gui.component.decoration.UILabel 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 UILabel

use of net.malisis.core.client.gui.component.decoration.UILabel 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 UILabel

use of net.malisis.core.client.gui.component.decoration.UILabel in project Almura by AlmuraDev.

the class PanoramicMainMenu method construct.

@SuppressWarnings("deprecation")
@Override
public void construct() {
    final UIBackgroundContainer container = new UIBackgroundContainer(this);
    container.setBackgroundAlpha(0);
    container.setPosition(0, -10, Anchor.MIDDLE | Anchor.CENTER);
    container.setSize(GuiConfig.Button.WIDTH_LONG, 205);
    // 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);
    this.buttonContainer = new UIBackgroundContainer(this, GuiConfig.Button.WIDTH_LONG + PADDING, (GuiConfig.Button.HEIGHT * 4) + (PADDING * 3));
    this.buttonContainer.setPosition(0, SimpleScreen.getPaddedY(almuraHeader, 10), Anchor.TOP | Anchor.CENTER);
    this.buttonContainer.setBackgroundAlpha(0);
    final UIButton singleplayerButton = new UIButtonBuilder(this).container(this.buttonContainer).text(Text.of(I18n.format("menu.singleplayer"))).size(GuiConfig.Button.WIDTH_LONG, GuiConfig.Button.HEIGHT).position(0, 0).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.singleplayer");
    final UIButton multiplayerButton = new UIButtonBuilder(this).container(this.buttonContainer).text(Text.of(I18n.format("menu.multiplayer"))).size(GuiConfig.Button.WIDTH_LONG, GuiConfig.Button.HEIGHT).position(0, SimpleScreen.getPaddedY(singleplayerButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.multiplayer");
    final UIButton optionsButton = new UIButtonBuilder(this).container(this.buttonContainer).text(Text.of(I18n.format("options.title"))).size(GuiConfig.Button.WIDTH_TINY, GuiConfig.Button.HEIGHT).position(-68, SimpleScreen.getPaddedY(multiplayerButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.options");
    final UIButton modsButton = new UIButtonBuilder(this).container(this.buttonContainer).text(Text.of(I18n.format("almura.menu_button.mods"))).size(GuiConfig.Button.WIDTH_TINY, GuiConfig.Button.HEIGHT).position(SimpleScreen.getPaddedX(optionsButton, PADDING), SimpleScreen.getPaddedY(multiplayerButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.mods");
    final UIButton aboutButton = new UIButtonBuilder(this).container(this.buttonContainer).text(Text.of(I18n.format("almura.menu_button.about"))).size(GuiConfig.Button.WIDTH_TINY, GuiConfig.Button.HEIGHT).position(SimpleScreen.getPaddedX(modsButton, PADDING), SimpleScreen.getPaddedY(multiplayerButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.about");
    final UIButton quitButton = new UIButtonBuilder(this).container(this.buttonContainer).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_LONG, GuiConfig.Button.HEIGHT).position(singleplayerButton.getX(), SimpleScreen.getPaddedY(optionsButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.quit");
    final UIButton forumsButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.ENJIN).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(-PADDING, -PADDING).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(Text.of(I18n.format("almura.menu_button.forums"))).build("button.forums");
    final UIButton issuesButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.FA_GITHUB).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(forumsButton, PADDING, Anchor.RIGHT), forumsButton.getY()).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(Text.of(I18n.format(I18n.format("almura.menu_button.issues")))).build("button.issues");
    final UIButton shopButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.FA_SHOPPING_BAG).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(issuesButton, PADDING, Anchor.RIGHT), issuesButton.getY()).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(Text.of(I18n.format("almura.menu_button.shop"))).build("button.shop");
    final UILabel trademarkLabel = new UILabel(this, TextFormatting.YELLOW + I18n.format("almura.menu.main.trademark"));
    trademarkLabel.setPosition(PADDING, -PADDING, Anchor.BOTTOM | Anchor.LEFT);
    final UILabel copyrightLabel = new UILabel(this, TextFormatting.YELLOW + I18n.format("almura.menu.main.copyright"));
    copyrightLabel.setPosition(trademarkLabel.getX(), SimpleScreen.getPaddedY(trademarkLabel, PADDING, Anchor.BOTTOM), trademarkLabel.getAnchor());
    container.add(almuraHeader, this.buttonContainer);
    // Disable escape key press
    registerKeyListener((keyChar, keyCode) -> keyCode == Keyboard.KEY_ESCAPE);
    // Add content to screen
    addToScreen(container);
    addToScreen(trademarkLabel);
    addToScreen(copyrightLabel);
    addToScreen(shopButton);
    addToScreen(forumsButton);
    addToScreen(issuesButton);
    // OpenGL Warning
    if (!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.areShadersSupported()) {
        final UILabel glWarning1 = new UILabel(this, TextSerializers.LEGACY_FORMATTING_CODE.serialize(Text.of(TextStyles.BOLD, TextColors.DARK_RED, I18n.format("almura.menu.main.opengl.0"))));
        glWarning1.setPosition(2, 2, Anchor.TOP | Anchor.LEFT);
        final UILabel glWarning2 = new UILabel(this, TextSerializers.LEGACY_FORMATTING_CODE.serialize(Text.of(TextStyles.BOLD, TextColors.DARK_RED, I18n.format("almura.menu.main.opengl.1"))));
        glWarning2.setPosition(2, SimpleScreen.getPaddedY(glWarning1, 2), Anchor.TOP | Anchor.LEFT);
        addToScreen(glWarning1);
        addToScreen(glWarning2);
    }
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) 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

UILabel (net.malisis.core.client.gui.component.decoration.UILabel)12 UIButton (net.malisis.core.client.gui.component.interaction.UIButton)10 UIButtonBuilder (com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder)8 UIBackgroundContainer (net.malisis.core.client.gui.component.container.UIBackgroundContainer)5 UIImage (net.malisis.core.client.gui.component.decoration.UIImage)4 UITextField (net.malisis.core.client.gui.component.interaction.UITextField)4 UIForm (com.almuradev.almura.shared.client.ui.component.UIForm)3 GuiTexture (net.malisis.core.client.gui.GuiTexture)3 UIFormContainer (com.almuradev.almura.shared.client.ui.component.UIFormContainer)2 UISlimScrollbar (net.malisis.core.client.gui.component.control.UISlimScrollbar)2 ClientCategory (com.almuradev.almura.core.client.config.ClientCategory)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 MalisisSlot (net.malisis.core.inventory.MalisisSlot)1