Search in sources :

Example 11 with BasicForm

use of net.malisis.core.client.gui.component.container.BasicForm in project Almura by AlmuraDev.

the class PlayerDiedGUI method construct.

@Override
public void construct() {
    this.guiscreenBackground = true;
    Keyboard.enableRepeatEvents(true);
    this.form = new BasicForm(this, 50, 200, "You have died.");
    this.form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
    this.form.setMovable(false);
    this.form.setClosable(false);
    this.form.setBorder(FontColors.WHITE, 1, 185);
    this.form.setBackgroundAlpha(215);
    this.form.setBottomPadding(3);
    this.form.setRightPadding(3);
    this.form.setTopPadding(20);
    this.form.setLeftPadding(3);
    // Almura header
    final UIImage almuraHeader = new UIImage(this, new GuiTexture(GuiConfig.Location.DEAD_STEVE), null);
    almuraHeader.setSize(99, 99);
    almuraHeader.setPosition(0, 0, Anchor.TOP | Anchor.CENTER);
    this.messageLabel = new UILabel(this, getMessage(this.player.getName()));
    this.messageLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build());
    this.messageLabel.setPosition(0, 102, Anchor.CENTER | Anchor.TOP);
    final DecimalFormat dFormat = new DecimalFormat("###,###,###,###.00");
    this.droppedLabel = new UILabel(this, "You dropped: " + TextFormatting.GOLD + "$" + dFormat.format(this.droppedAmount) + TextFormatting.RESET + ".");
    this.droppedLabel.setVisible(this.dropCoins);
    this.droppedLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build());
    this.droppedLabel.setPosition(0, -40, Anchor.CENTER | Anchor.BOTTOM);
    this.deathTaxLabel = new UILabel(this, "You lost: " + TextFormatting.RED + "$" + dFormat.format(this.deathTaxAmount) + TextFormatting.RESET + " to death taxes.");
    this.deathTaxLabel.setVisible(this.dropCoins);
    this.deathTaxLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build());
    this.deathTaxLabel.setPosition(0, -26, Anchor.CENTER | Anchor.BOTTOM);
    this.form.setSize(this.messageLabel.getWidth() + 30, this.form.getHeight());
    if (this.form.getWidth() < this.droppedLabel.getWidth() + 30) {
        // Account for the width possibly being too small.
        this.form.setSize(this.droppedLabel.getWidth() + 20, this.form.getHeight());
    }
    if (this.form.getWidth() < this.deathTaxLabel.getWidth() + 30) {
        // Account for the width possibly being too small.
        this.form.setSize(this.deathTaxLabel.getWidth() + 20, this.form.getHeight());
    }
    if (!this.dropCoins) {
        this.form.setSize(this.form.getWidth(), 160);
    }
    final UISeparator topWindowTitleSeparator = new UISeparator(this);
    topWindowTitleSeparator.setSize(this.form.getWidth() - 5, 1);
    topWindowTitleSeparator.setPosition(0, -5, Anchor.TOP | Anchor.CENTER);
    this.form.add(topWindowTitleSeparator);
    final UISeparator aboveButtonsSeparator = new UISeparator(this);
    aboveButtonsSeparator.setSize(this.form.getWidth() - 5, 1);
    aboveButtonsSeparator.setPosition(0, -20, Anchor.BOTTOM | Anchor.CENTER);
    this.form.add(aboveButtonsSeparator);
    final UISeparator belowMessageSeparator = new UISeparator(this);
    belowMessageSeparator.setSize(form.getWidth() - 5, 1);
    belowMessageSeparator.setPosition(0, 40, Anchor.CENTER | Anchor.MIDDLE);
    belowMessageSeparator.setVisible(this.dropCoins);
    this.form.add(belowMessageSeparator);
    // Revive button
    this.buttonRevive = new UIButtonBuilder(this).width(40).anchor(Anchor.BOTTOM | Anchor.LEFT).text("Revive").listener(this).enabled(this.canRevive).build("button.revive");
    // Respawn button
    this.buttonRespawn = new UIButtonBuilder(this).width(40).anchor(Anchor.BOTTOM | Anchor.CENTER).position(0, 0).text("Respawn").listener(this).build("button.respawn");
    // Rage Quit button
    this.buttonRagequit = new UIButtonBuilder(this).width(40).anchor(Anchor.BOTTOM | Anchor.RIGHT).text(I18n.format("almura.menu_button.quit")).fontOptions(FontOptions.builder().from(FontColors.RED_FO).shadow(true).build()).listener(this).build("button.ragequit");
    this.form.add(almuraHeader, this.messageLabel, this.droppedLabel, this.deathTaxLabel, this.buttonRespawn, this.buttonRevive, this.buttonRagequit);
    addToScreen(this.form);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) BasicForm(net.malisis.core.client.gui.component.container.BasicForm) GuiTexture(net.malisis.core.client.gui.GuiTexture) UIButtonBuilder(net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder) DecimalFormat(java.text.DecimalFormat) UISeparator(net.malisis.core.client.gui.component.decoration.UISeparator) UIImage(net.malisis.core.client.gui.component.decoration.UIImage)

Example 12 with BasicForm

use of net.malisis.core.client.gui.component.container.BasicForm in project Almura by AlmuraDev.

the class MembershipGui method construct.

@Override
public void construct() {
    this.guiscreenBackground = true;
    Keyboard.enableRepeatEvents(true);
    this.form = new BasicForm(this, 310, 250, "Almura Memberships");
    this.form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
    this.form.setMovable(true);
    this.form.setClosable(true);
    this.form.setBorder(FontColors.WHITE, 1, 185);
    this.form.setBackgroundAlpha(215);
    this.form.setBottomPadding(3);
    this.form.setRightPadding(3);
    this.form.setTopPadding(20);
    this.form.setLeftPadding(3);
    final BasicForm citizenArea = new BasicForm(this, 100, 200, "");
    citizenArea.setPosition(0, 0, Anchor.LEFT | Anchor.TOP);
    citizenArea.setMovable(false);
    citizenArea.setClosable(false);
    citizenArea.setBorder(FontColors.WHITE, 1, 185);
    citizenArea.setBackgroundAlpha(215);
    citizenArea.setBottomPadding(3);
    citizenArea.setRightPadding(3);
    citizenArea.setTopPadding(3);
    citizenArea.setLeftPadding(3);
    final UIImage citizenLogo = new UIImage(this, new GuiTexture(GuiConfig.Location.citizen_logo), null);
    citizenLogo.setSize(99, 99);
    citizenLogo.setPosition(0, -3, Anchor.TOP | Anchor.CENTER);
    this.citizen_details_button = new UIButtonBuilder(this).fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).hoverFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).width(40).anchor(Anchor.TOP | Anchor.CENTER).position(0, citizenLogo.getY() + 100).text("Details").listener(this).enabled(true).build("button.citizen_details");
    final UILabel citizenLabel0 = new UILabel(this, "Chose One");
    citizenLabel0.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).underline(true).shadow(true).scale(0.8F).build());
    citizenLabel0.setPosition(0, 125, Anchor.CENTER | Anchor.TOP);
    this.citizen_donation_button = new UIButtonBuilder(this).fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).hoverFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).width(40).anchor(Anchor.TOP | Anchor.CENTER).position(0, citizenLabel0.getY() + 10).text("$25.00 Donation").listener(this).enabled(currentMembershipLevel == 0).build("button.citizen_donation");
    this.citizen_purchase_button = new UIButtonBuilder(this).fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).hoverFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).width(40).anchor(Anchor.TOP | Anchor.CENTER).position(0, citizen_donation_button.getY() + 18).text("$2.5 million in-game").listener(this).enabled(availableFunds >= 2500000 && currentMembershipLevel == 0).build("button.citizen_purchase");
    this.citizen_skills_button = new UIButtonBuilder(this).fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).hoverFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).width(40).anchor(Anchor.TOP | Anchor.CENTER).position(0, citizen_purchase_button.getY() + 18).text("Skills total at 250+").listener(this).enabled(skillsLevel >= 250 && currentMembershipLevel == 0).build("button.citizen_skills");
    citizenArea.add(citizenLogo, citizen_details_button, citizenLabel0, citizen_donation_button, citizen_skills_button, citizen_purchase_button);
    final BasicForm explorerArea = new BasicForm(this, 100, 200, "");
    explorerArea.setPosition(0, 0, Anchor.CENTER | Anchor.TOP);
    explorerArea.setMovable(false);
    explorerArea.setClosable(false);
    explorerArea.setBorder(FontColors.WHITE, 1, 185);
    explorerArea.setBackgroundAlpha(215);
    explorerArea.setBottomPadding(3);
    explorerArea.setRightPadding(3);
    explorerArea.setTopPadding(3);
    explorerArea.setLeftPadding(3);
    final UIImage explorerLogo = new UIImage(this, new GuiTexture(GuiConfig.Location.explorer_logo), null);
    explorerLogo.setSize(99, 99);
    explorerLogo.setPosition(0, -3, Anchor.TOP | Anchor.CENTER);
    this.explorer_details_button = new UIButtonBuilder(this).fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).hoverFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).width(40).anchor(Anchor.TOP | Anchor.CENTER).position(0, explorerLogo.getY() + 100).text("Details").listener(this).enabled(true).build("button.explorer_details");
    final UILabel explorerLabel0 = new UILabel(this, "Chose One");
    explorerLabel0.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).underline(true).shadow(true).scale(0.8F).build());
    explorerLabel0.setPosition(0, 125, Anchor.CENTER | Anchor.TOP);
    this.explorer_donation_button = new UIButtonBuilder(this).fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).hoverFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).width(40).anchor(Anchor.TOP | Anchor.CENTER).position(0, explorerLabel0.getY() + 10).text("$50.00 Donation").listener(this).enabled(currentMembershipLevel == 0 || currentMembershipLevel == 1).build("button.explorer_donation");
    this.explorer_purchase_button = new UIButtonBuilder(this).fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).hoverFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).width(40).anchor(Anchor.TOP | Anchor.CENTER).position(0, explorer_donation_button.getY() + 18).text("$5 million in-game").listener(this).enabled(availableFunds >= 5000000 && (currentMembershipLevel == 0 || currentMembershipLevel == 1)).build("button.explorer_purchase");
    this.explorer_skills_button = new UIButtonBuilder(this).fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).hoverFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).width(40).anchor(Anchor.TOP | Anchor.CENTER).position(0, explorer_purchase_button.getY() + 18).text("Skills total at 375+").listener(this).enabled(skillsLevel >= 375 && (currentMembershipLevel == 0 || currentMembershipLevel == 1)).build("button.explorer_skills");
    explorerArea.add(explorerLogo, explorer_details_button, explorerLabel0, explorer_donation_button, explorer_skills_button, explorer_purchase_button);
    final BasicForm pioneerArea = new BasicForm(this, 100, 200, "");
    pioneerArea.setPosition(0, 0, Anchor.RIGHT | Anchor.TOP);
    pioneerArea.setMovable(false);
    pioneerArea.setClosable(false);
    pioneerArea.setBorder(FontColors.WHITE, 1, 185);
    pioneerArea.setBackgroundAlpha(215);
    pioneerArea.setBottomPadding(3);
    pioneerArea.setRightPadding(3);
    pioneerArea.setTopPadding(3);
    pioneerArea.setLeftPadding(3);
    final UIImage pioneerLogo = new UIImage(this, new GuiTexture(GuiConfig.Location.pioneer_logo), null);
    pioneerLogo.setSize(99, 99);
    pioneerLogo.setPosition(0, -3, Anchor.TOP | Anchor.CENTER);
    this.pioneer_details_button = new UIButtonBuilder(this).fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).hoverFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).width(40).anchor(Anchor.TOP | Anchor.CENTER).position(0, pioneerLogo.getY() + 100).text("Details").listener(this).enabled(true).build("button.pioneer_details");
    final UILabel pioneerLabel0 = new UILabel(this, "Chose One");
    pioneerLabel0.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).underline(true).shadow(true).scale(0.8F).build());
    pioneerLabel0.setPosition(0, 125, Anchor.CENTER | Anchor.TOP);
    this.pioneer_donation_button = new UIButtonBuilder(this).fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).hoverFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).width(40).anchor(Anchor.TOP | Anchor.CENTER).position(0, pioneerLabel0.getY() + 10).text("$100.00 Donation").tooltip("Hi").listener(this).enabled(currentMembershipLevel == 0 || currentMembershipLevel == 1 || currentMembershipLevel == 2).build("button.pioneer_donation");
    this.pioneer_purchase_button = new UIButtonBuilder(this).fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).hoverFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).width(40).anchor(Anchor.TOP | Anchor.CENTER).position(0, pioneer_donation_button.getY() + 18).text("$10 million in-game").listener(this).enabled(availableFunds >= 10000000 && (currentMembershipLevel == 0 || currentMembershipLevel == 1 || currentMembershipLevel == 2)).build("button.pioneer_purchase");
    this.pioneer_skills_button = new UIButtonBuilder(this).fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).hoverFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build()).width(40).anchor(Anchor.TOP | Anchor.CENTER).position(0, pioneer_purchase_button.getY() + 18).text("Skills total at 400+").listener(this).enabled(skillsLevel >= 400 && (currentMembershipLevel == 0 || currentMembershipLevel == 1 || currentMembershipLevel == 2)).build("button.pioneer_skills");
    pioneerArea.add(pioneerLogo, pioneer_details_button, pioneerLabel0, pioneer_donation_button, pioneer_skills_button, pioneer_purchase_button);
    final UILabel skillsLabel = new UILabel(this, "Current Skills Total: ");
    skillsLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.8F).build());
    skillsLabel.setPosition(10, -5, Anchor.LEFT | Anchor.BOTTOM);
    final UILabel skillsLevelLabel = new UILabel(this, "" + skillsLevel);
    skillsLevelLabel.setFontOptions(FontOptions.builder().from(FontColors.BLUE_FO).shadow(true).scale(0.8F).build());
    skillsLevelLabel.setPosition(skillsLabel.getX() + skillsLabel.getWidth(), -5, Anchor.LEFT | Anchor.BOTTOM);
    final UISeparator topWindowTitleSeparator = new UISeparator(this);
    topWindowTitleSeparator.setSize(this.form.getWidth(), 1);
    topWindowTitleSeparator.setPosition(0, -5, Anchor.TOP | Anchor.CENTER);
    this.form.add(topWindowTitleSeparator);
    final UISeparator aboveButtonsSeparator = new UISeparator(this);
    aboveButtonsSeparator.setSize(this.form.getWidth() - 5, 1);
    aboveButtonsSeparator.setPosition(0, -20, Anchor.BOTTOM | Anchor.CENTER);
    this.form.add(aboveButtonsSeparator);
    this.buttonClose = new UIButtonBuilder(this).width(40).anchor(Anchor.BOTTOM | Anchor.RIGHT).text(I18n.format("almura.menu_button.close")).listener(this).build("button.close");
    this.form.add(citizenArea, explorerArea, pioneerArea, skillsLabel, skillsLevelLabel, this.buttonClose);
    addToScreen(this.form);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) BasicForm(net.malisis.core.client.gui.component.container.BasicForm) GuiTexture(net.malisis.core.client.gui.GuiTexture) UIButtonBuilder(net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder) UISeparator(net.malisis.core.client.gui.component.decoration.UISeparator) UIImage(net.malisis.core.client.gui.component.decoration.UIImage)

Example 13 with BasicForm

use of net.malisis.core.client.gui.component.container.BasicForm in project Almura by AlmuraDev.

the class ExchangeOfferScreen method construct.

@Override
public void construct() {
    this.guiscreenBackground = false;
    // Form
    final BasicForm form = new BasicForm(this, 400, 325, I18n.format("almura.feature.exchange.title.offer"));
    // Fixes issue overlapping draws from parent
    form.setZIndex(10);
    form.setBackgroundAlpha(255);
    // OK/Cancel buttons
    final UIButton buttonOk = new UIButtonBuilder(this).width(40).text(I18n.format("almura.button.ok")).x(1).anchor(Anchor.BOTTOM | Anchor.RIGHT).onClick(this::transact).build("button.ok");
    final UIButton buttonCancel = new UIButtonBuilder(this).width(40).text(I18n.format("almura.button.cancel")).x(getPaddedX(buttonOk, 2, Anchor.RIGHT)).anchor(Anchor.BOTTOM | Anchor.RIGHT).onClick(this::close).build("button.cancel");
    // Swap container
    final NonNullList<ItemStack> mainInventory = Minecraft.getMinecraft().player.inventory.mainInventory;
    final int totalItemsForSale = this.exchange.getForSaleItemsFor(Minecraft.getMinecraft().player.getUniqueID()).map(List::size).orElse(0);
    this.offerContainer = new UIExchangeOfferContainer(this, getPaddedWidth(form), getPaddedHeight(form) - 20, TextFormatting.WHITE + I18n.format("almura.feature.exchange.text.inventory"), TextFormatting.WHITE + I18n.format("almura.feature.exchange.text.unlisted_items"), mainInventory.size(), this.limit, totalItemsForSale);
    this.offerContainer.register(this);
    // Populate offer container
    final List<VanillaStack> inventoryOffers = new ArrayList<>();
    mainInventory.stream().filter(i -> !i.isEmpty() && i.getItem() != null).forEach(i -> inventoryOffers.add(new BasicVanillaStack(i)));
    this.offerContainer.setItems(this.pendingItems, BasicDualListContainer.SideType.RIGHT);
    this.offerContainer.setItems(inventoryOffers, BasicDualListContainer.SideType.LEFT);
    form.add(this.offerContainer, buttonOk, buttonCancel);
    addToScreen(form);
}
Also used : UIButton(net.malisis.core.client.gui.component.interaction.UIButton) VanillaStack(com.almuradev.almura.shared.item.VanillaStack) ClientExchangeManager(com.almuradev.almura.feature.exchange.client.ClientExchangeManager) InventoryAction(com.almuradev.almura.feature.exchange.InventoryAction) TextFormatting(net.minecraft.util.text.TextFormatting) UIButtonBuilder(net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder) UIExchangeOfferContainer(com.almuradev.almura.feature.exchange.client.gui.component.UIExchangeOfferContainer) BasicVanillaStack(com.almuradev.almura.shared.item.BasicVanillaStack) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) BasicForm(net.malisis.core.client.gui.component.container.BasicForm) I18n(net.minecraft.client.resources.I18n) Inject(javax.inject.Inject) ItemStack(net.minecraft.item.ItemStack) List(java.util.List) Minecraft(net.minecraft.client.Minecraft) Side(net.minecraftforge.fml.relauncher.Side) Anchor(net.malisis.core.client.gui.Anchor) BasicDualListContainer(net.malisis.core.client.gui.component.container.BasicDualListContainer) Subscribe(com.google.common.eventbus.Subscribe) BasicScreen(net.malisis.core.client.gui.BasicScreen) NonNullList(net.minecraft.util.NonNullList) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Exchange(com.almuradev.almura.feature.exchange.Exchange) BasicForm(net.malisis.core.client.gui.component.container.BasicForm) UIButtonBuilder(net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder) UIExchangeOfferContainer(com.almuradev.almura.feature.exchange.client.gui.component.UIExchangeOfferContainer) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) BasicVanillaStack(com.almuradev.almura.shared.item.BasicVanillaStack) VanillaStack(com.almuradev.almura.shared.item.VanillaStack) BasicVanillaStack(com.almuradev.almura.shared.item.BasicVanillaStack)

Example 14 with BasicForm

use of net.malisis.core.client.gui.component.container.BasicForm in project Almura by AlmuraDev.

the class ExchangeBuyQuantityScreen method construct.

@Override
public void construct() {
    this.guiscreenBackground = false;
    this.form = new BasicForm(this, 130, 90, I18n.format("almura.feature.exchange.title.enter_a_quantity"));
    // Fixes issue overlapping draws from parent
    this.form.setZIndex(10);
    this.form.setBackgroundAlpha(255);
    this.quantityLabel = new UILabel(this, I18n.format("almura.feature.common.text.quantity") + ":");
    this.quantityLabel.setFontOptions(FontColors.WHITE_FO);
    this.quantityLabel.setPosition(0, 2);
    this.quantityTextBox = new BasicTextBox(this, "1");
    this.quantityTextBox.setAcceptsReturn(false);
    this.quantityTextBox.setOnEnter(tb -> this.buy());
    this.quantityTextBox.setSize(45, 0);
    this.quantityTextBox.setPosition(0, 0, Anchor.TOP | Anchor.RIGHT);
    this.quantityTextBox.setFilter(s -> s = String.valueOf(MathUtil.squashi(Integer.valueOf(s.replaceAll("[^\\d]", "")), 1, toBuyItem.getQuantity())));
    this.quantityTextBox.setPosition(0, 0);
    this.quantityTextBox.register(this);
    this.perItemLabel = new UILabel(this, "Per:");
    this.perItemLabel.setPosition(0, BasicScreen.getPaddedY(this.quantityTextBox, 8));
    this.perItemLabel.setFontOptions(FontColors.WHITE_FO);
    this.perItemValueLabel = new UILabel(this, "");
    this.perItemValueLabel.setPosition(0, this.perItemLabel.getY(), Anchor.TOP | Anchor.RIGHT);
    this.perItemValueLabel.setFontOptions(FontColors.WHITE_FO);
    this.totalLabel = new UILabel(this, I18n.format("almura.feature.common.text.total") + ":");
    this.totalLabel.setPosition(0, BasicScreen.getPaddedY(this.perItemLabel, 4));
    this.totalLabel.setFontOptions(FontColors.WHITE_FO);
    this.totalValueLabel = new UILabel(this, "");
    this.totalValueLabel.setPosition(0, this.totalLabel.getY(), Anchor.TOP | Anchor.RIGHT);
    this.totalValueLabel.setFontOptions(FontColors.WHITE_FO);
    this.buttonBuy = new UIButtonBuilder(this).text(I18n.format("almura.feature.common.button.buy")).width(40).position(-2, -2).anchor(Anchor.RIGHT | Anchor.BOTTOM).onClick(this::buy).build("button.buy");
    this.buttonCancel = new UIButtonBuilder(this).text(I18n.format("almura.button.cancel")).width(40).position(BasicScreen.getPaddedX(this.buttonBuy, 2, Anchor.RIGHT), -2).anchor(Anchor.RIGHT | Anchor.BOTTOM).onClick(this::close).build("button.cancel");
    this.form.add(this.quantityLabel, this.quantityTextBox, this.perItemLabel, this.perItemValueLabel, this.totalLabel, this.totalValueLabel, this.buttonCancel, this.buttonBuy);
    this.updateControls(this.quantityTextBox.getText());
    this.addToScreen(this.form);
    this.quantityTextBox.focus();
    this.quantityTextBox.selectAll();
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) BasicForm(net.malisis.core.client.gui.component.container.BasicForm) UIButtonBuilder(net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder) BasicTextBox(net.malisis.core.client.gui.component.interaction.BasicTextBox)

Example 15 with BasicForm

use of net.malisis.core.client.gui.component.container.BasicForm in project Almura by AlmuraDev.

the class FeatureScreen method construct.

@Override
public void construct() {
    guiscreenBackground = false;
    Keyboard.enableRepeatEvents(true);
    // Main Panel
    final BasicForm form = new BasicForm(this, 150, 220, "Almura Features");
    if (!isAdmin) {
        form.setSize(form.getWidth(), 150);
    }
    // Guide button
    guideButton = new UIButtonBuilder(this).width(100).anchor(Anchor.TOP | Anchor.CENTER).text("Guide").position(0, 4).onClick(() -> guideManager.requestGuideGUI()).build("button.guide");
    // Claims button
    claimButton = new UIButtonBuilder(this).width(100).anchor(Anchor.TOP | Anchor.CENTER).position(0, guideButton.getY() + 18).text("Claim Management").onClick(() -> claimManager.requestClaimGUI()).build("button.claim");
    // Nickname button
    nicknameButton = new UIButtonBuilder(this).width(100).anchor(Anchor.TOP | Anchor.CENTER).text("Nicknames").position(0, claimButton.getY() + 18).onClick(() -> nickManager.requestNicknameGUI()).build("button.nickname");
    // Manage Titles button
    titleButton = new UIButtonBuilder(this).width(100).anchor(Anchor.TOP | Anchor.CENTER).text("Titles").position(0, nicknameButton.getY() + 18).onClick(() -> titleManager.requestManageTitlesGui()).build("button.title.manage");
    // Accessories button
    accessoriesButton = new UIButtonBuilder(this).width(100).anchor(Anchor.TOP | Anchor.CENTER).position(0, titleButton.getY() + 18).text("Accessories").enabled(isAdmin).onClick(() -> {
    }).build("button.accessories");
    // Accessories button
    membershipButton = new UIButtonBuilder(this).width(100).anchor(Anchor.TOP | Anchor.CENTER).position(0, accessoriesButton.getY() + 18).text("Memberships").onClick(() -> membershipManager.requestMembershipGUI()).build("button.memberships");
    final UISeparator functionsSeparator = new UISeparator(this);
    functionsSeparator.setSize(form.getWidth(), 1);
    functionsSeparator.setPosition(0, membershipButton.getY() + 22, Anchor.TOP | Anchor.CENTER);
    functionsSeparator.setVisible(isAdmin);
    final UILabel adminLabel = new UILabel(this, "Administrator");
    adminLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build());
    adminLabel.setPosition(0, functionsSeparator.getY() + 4, Anchor.TOP | Anchor.CENTER);
    adminLabel.setVisible(isAdmin);
    final UISeparator functionsSeparator2 = new UISeparator(this);
    functionsSeparator2.setSize(form.getWidth(), 1);
    functionsSeparator2.setPosition(0, membershipButton.getY() + 37, Anchor.TOP | Anchor.CENTER);
    functionsSeparator2.setVisible(isAdmin);
    // Manage Exchange button
    manageExchangeButton = new UIButtonBuilder(this).width(125).anchor(Anchor.TOP | Anchor.CENTER).position(0, functionsSeparator2.getY() + 10).visible(isAdmin).text("Manage Exchanges").onClick(() -> exchangeManager.requestExchangeManageGui()).build("button.exchange.manage");
    // Server Shop Configuration GUI button
    manageStoreButton = new UIButtonBuilder(this).width(125).anchor(Anchor.TOP | Anchor.CENTER).position(0, manageExchangeButton.getY() + 18).visible(isAdmin).text("Manage Stores").onClick(() -> storeManager.requestStoreManage()).build("button.stores.manage");
    // Close button
    final UIButton buttonClose = new UIButtonBuilder(this).width(40).anchor(Anchor.BOTTOM | Anchor.RIGHT).text(I18n.format("almura.button.close")).onClick(this::close).build("button.close");
    form.add(guideButton, manageExchangeButton, titleButton, nicknameButton, functionsSeparator, adminLabel, functionsSeparator2, accessoriesButton, membershipButton, manageStoreButton, claimButton, buttonClose);
    addToScreen(form);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) BasicForm(net.malisis.core.client.gui.component.container.BasicForm) UIButtonBuilder(net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) UISeparator(net.malisis.core.client.gui.component.decoration.UISeparator)

Aggregations

BasicForm (net.malisis.core.client.gui.component.container.BasicForm)25 UIButtonBuilder (net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder)25 UILabel (net.malisis.core.client.gui.component.decoration.UILabel)23 UIButton (net.malisis.core.client.gui.component.interaction.UIButton)17 UISeparator (net.malisis.core.client.gui.component.decoration.UISeparator)11 BasicTextBox (net.malisis.core.client.gui.component.interaction.BasicTextBox)10 UIImage (net.malisis.core.client.gui.component.decoration.UIImage)6 BasicContainer (net.malisis.core.client.gui.component.container.BasicContainer)4 UICheckBox (net.malisis.core.client.gui.component.interaction.UICheckBox)4 UITextField (net.malisis.core.client.gui.component.interaction.UITextField)4 GuiTexture (net.malisis.core.client.gui.GuiTexture)3 BasicLine (net.malisis.core.client.gui.component.decoration.BasicLine)3 ItemStack (net.minecraft.item.ItemStack)3 Subscribe (com.google.common.eventbus.Subscribe)2 DecimalFormat (java.text.DecimalFormat)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Inject (javax.inject.Inject)2 Anchor (net.malisis.core.client.gui.Anchor)2