Search in sources :

Example 1 with UIButtonBuilder

use of net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder in project Almura by AlmuraDev.

the class SimpleOptionsMenu method construct.

@SuppressWarnings({ "unchecked" })
@Override
public void construct() {
    this.saveAndLoad();
    final GeneralCategory general = configAdapter.get().general;
    final UILabel titleLabel = new UILabel(this, I18n.format("almura.menu_button.options"));
    titleLabel.setFontOptions(FontColors.WHITE_FO);
    titleLabel.setPosition(0, 20, Anchor.TOP | Anchor.CENTER);
    this.addToScreen(titleLabel);
    final UIBackgroundContainer optionsContainer = new UIBackgroundContainer(this, 335, 200);
    optionsContainer.setBackgroundAlpha(0);
    optionsContainer.setPosition(0, getPaddedY(titleLabel, CONTROL_PADDING), Anchor.TOP | Anchor.CENTER);
    /*
         * LEFT COLUMN
         */
    this.buttonOptimized = new UIButtonBuilder(this).text("Load Optimized Defaults").size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("button.optimized");
    this.updatePosition(this.buttonOptimized, Anchor.LEFT);
    this.buttonHudType = new UIButtonBuilder(this).text("HUD: " + general.hud.substring(0, 1).toUpperCase() + general.hud.substring(1)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("button.hudType");
    this.updatePosition(this.buttonHudType, Anchor.LEFT);
    // TODO: Add builder for checkbox component
    final boolean displayWorldCompassWidget = general.displayWorldCompassWidget;
    final UICheckBox checkboxWorldCompassWidget = new UICheckBox(this);
    checkboxWorldCompassWidget.setText(TextFormatting.WHITE + "Display World Compass Widget");
    checkboxWorldCompassWidget.setChecked(displayWorldCompassWidget);
    checkboxWorldCompassWidget.setName("checkbox.world_compass_widget");
    checkboxWorldCompassWidget.register(this);
    this.updatePosition(checkboxWorldCompassWidget, Anchor.LEFT);
    final boolean displayLocationWidget = general.displayLocationWidget;
    final UICheckBox checkboxLocationWidget = new UICheckBox(this);
    checkboxLocationWidget.setText(TextFormatting.WHITE + "Display Location Widget");
    checkboxLocationWidget.setChecked(displayLocationWidget);
    checkboxLocationWidget.setName("checkbox.location_widget");
    checkboxLocationWidget.register(this);
    this.updatePosition(checkboxLocationWidget, Anchor.LEFT);
    final boolean displayNumericHUDValues = general.displayNumericHUDValues;
    final UICheckBox checkboxNumericHUDValues = new UICheckBox(this);
    checkboxNumericHUDValues.setText(TextFormatting.WHITE + "Display Numeric HUD Values");
    checkboxNumericHUDValues.setChecked(displayNumericHUDValues);
    checkboxNumericHUDValues.setName("checkbox.numeric_hud_values");
    checkboxNumericHUDValues.register(this);
    this.updatePosition(checkboxNumericHUDValues, Anchor.LEFT);
    final boolean displayNames = general.displayNames;
    final UICheckBox checkboxDisplayNames = new UICheckBox(this);
    checkboxDisplayNames.setText(TextFormatting.WHITE + "Display Entity Names");
    checkboxDisplayNames.setChecked(displayNames);
    checkboxDisplayNames.setName("checkbox.display_names");
    checkboxDisplayNames.register(this);
    this.updatePosition(checkboxDisplayNames, Anchor.LEFT);
    final boolean displayHealthbars = general.displayHealthbars;
    final UICheckBox checkboxDisplayHealthbars = new UICheckBox(this);
    checkboxDisplayHealthbars.setText(TextFormatting.WHITE + "Display Entity Healthbars");
    checkboxDisplayHealthbars.setChecked(displayHealthbars);
    checkboxDisplayHealthbars.setName("checkbox.display_healthbars");
    checkboxDisplayHealthbars.register(this);
    this.updatePosition(checkboxDisplayHealthbars, Anchor.LEFT);
    final boolean disableOffhandTorchPlacement = general.disableOffhandTorchPlacement;
    final UICheckBox checkboxDisableOffhandTorchPlacement = new UICheckBox(this);
    checkboxDisableOffhandTorchPlacement.setText(TextFormatting.WHITE + "Disable Offhand Torch Placement");
    checkboxDisableOffhandTorchPlacement.setChecked(disableOffhandTorchPlacement);
    checkboxDisableOffhandTorchPlacement.setName("checkbox.disable_offhand_torch_placement");
    checkboxDisableOffhandTorchPlacement.register(this);
    this.updatePosition(checkboxDisableOffhandTorchPlacement, Anchor.LEFT);
    final boolean displayGuideOnLogin = general.displayGuideOnLogin;
    final UICheckBox checkboxDisplayGuideOnLogin = new UICheckBox(this);
    checkboxDisplayGuideOnLogin.setText(TextFormatting.WHITE + "Display Guide upon Login");
    checkboxDisplayGuideOnLogin.setChecked(displayGuideOnLogin);
    checkboxDisplayGuideOnLogin.setName("checkbox.display_guide_on_login");
    checkboxDisplayGuideOnLogin.register(this);
    this.updatePosition(checkboxDisplayGuideOnLogin, Anchor.LEFT);
    // Reset for new column
    this.lastComponent = null;
    /*
         * RIGHT COLUMN
         */
    final boolean isOrigin = general.hud.equalsIgnoreCase(HUDType.ORIGIN);
    this.sliderOriginHudOpacity = new UISliderBuilder(this, Converter.<Float, Integer>from(f -> (int) (f * 255), i -> (float) i / 255)).text("HUD Opacity: %d").value(general.originHudOpacity).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).enabled(isOrigin).build("slider.originHudOpacity");
    this.sliderOriginHudOpacity.setAlpha(isOrigin ? 255 : 128);
    this.updatePosition(this.sliderOriginHudOpacity, Anchor.RIGHT);
    final UISlider<OptionsConverter.Options> sliderChestDistance = new UISliderBuilder(this, OPTIONS_CONVERTER).text("Chest Distance: %s").value(Arrays.stream(OptionsConverter.Options.values()).filter(o -> o.value == general.chestRenderDistance).findFirst().orElse(OptionsConverter.Options.DEFAULT)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("slider.chestRenderDistance");
    this.updatePosition(sliderChestDistance, Anchor.RIGHT);
    final UISlider<OptionsConverter.Options> sliderSignTextDistance = new UISliderBuilder(this, OPTIONS_CONVERTER).text("Sign Text Distance: %s").value(Arrays.stream(OptionsConverter.Options.values()).filter(o -> o.value == general.signTextRenderDistance).findFirst().orElse(OptionsConverter.Options.DEFAULT)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("slider.signTextRenderDistance");
    this.updatePosition(sliderSignTextDistance, Anchor.RIGHT);
    final UISlider<OptionsConverter.Options> sliderItemFrameDistance = new UISliderBuilder(this, OPTIONS_CONVERTER).text("Item Frame Distance: %s").value(Arrays.stream(OptionsConverter.Options.values()).filter(o -> o.value == general.itemFrameRenderDistance).findFirst().orElse(OptionsConverter.Options.DEFAULT)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("slider.itemFrameRenderDistance");
    this.updatePosition(sliderItemFrameDistance, Anchor.RIGHT);
    final UISlider<OptionsConverter.Options> sliderPlayerNameRenderDistance = new UISliderBuilder(this, OPTIONS_CONVERTER).text("Player Name Distance: %s").value(Arrays.stream(OptionsConverter.Options.values()).filter(o -> o.value == general.playerNameRenderDistance).findFirst().orElse(OptionsConverter.Options.DEFAULT)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("slider.playerNameRenderDistance");
    this.updatePosition(sliderPlayerNameRenderDistance, Anchor.RIGHT);
    final UISlider<OptionsConverter.Options> sliderEnemyNameRenderDistance = new UISliderBuilder(this, OPTIONS_CONVERTER).text("Enemy Name Distance: %s").value(Arrays.stream(OptionsConverter.Options.values()).filter(o -> o.value == general.enemyNameRenderDistance).findFirst().orElse(OptionsConverter.Options.DEFAULT)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("slider.enemyNameRenderDistance");
    this.updatePosition(sliderEnemyNameRenderDistance, Anchor.RIGHT);
    final UISlider<OptionsConverter.Options> sliderAnimalNameRenderDistance = new UISliderBuilder(this, OPTIONS_CONVERTER).text("Animal Name Distance: %s").value(Arrays.stream(OptionsConverter.Options.values()).filter(o -> o.value == general.animalNameRenderDistance).findFirst().orElse(OptionsConverter.Options.DEFAULT)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("slider.animalNameRenderDistance");
    this.updatePosition(sliderAnimalNameRenderDistance, Anchor.RIGHT);
    final UIButton buttonDone = new UIButtonBuilder(this).text(I18n.format("gui.done")).size(200, CONTROL_HEIGHT).position(0, this.lastComponent == null ? 10 : getPaddedY(this.lastComponent, 10)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.done");
    optionsContainer.add(this.buttonOptimized, this.buttonHudType, this.sliderOriginHudOpacity, checkboxWorldCompassWidget, checkboxLocationWidget, checkboxNumericHUDValues, checkboxDisplayNames, checkboxDisplayHealthbars, checkboxDisableOffhandTorchPlacement, checkboxDisplayGuideOnLogin, sliderChestDistance, sliderSignTextDistance, sliderItemFrameDistance, sliderPlayerNameRenderDistance, sliderEnemyNameRenderDistance, sliderAnimalNameRenderDistance, buttonDone);
    addToScreen(optionsContainer);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) GuiOptions(net.minecraft.client.gui.GuiOptions) GeneralCategory(com.almuradev.almura.core.client.config.category.GeneralCategory) UISliderBuilder(net.malisis.core.client.gui.component.interaction.slider.builder.UISliderBuilder) UIButtonBuilder(net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) UICheckBox(net.malisis.core.client.gui.component.interaction.UICheckBox) UIBackgroundContainer(net.malisis.core.client.gui.component.container.UIBackgroundContainer)

Example 2 with UIButtonBuilder

use of net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder in project Almura by AlmuraDev.

the class MultiplayerScreen method construct.

@Override
public void construct() {
    this.renderer.setDefaultTexture(GuiConfig.SpriteSheet.ALMURA);
    // Container to cover the screen (fixes issues with stuck button highlighting)
    final BasicContainer<?> screenContainer = new BasicContainer(this);
    screenContainer.setBackgroundAlpha(0);
    // Primary content
    final BasicContainer<?> contentContainer = new BasicContainer(this, UIConstants.Button.WIDTH_LONG, 206);
    contentContainer.setPosition(0, -10, Anchor.MIDDLE | Anchor.CENTER);
    contentContainer.setBackgroundAlpha(0);
    // Create logo
    final UIImage logoImage = new UIImage(this, new GuiTexture(GuiConfig.Location.ALMURA_LOGO), null);
    logoImage.setSize(60, 99);
    logoImage.setPosition(0, 0, Anchor.TOP | Anchor.CENTER);
    // Container for server entries
    this.serverList = new BasicList<>(this, UIConstants.Button.WIDTH_LONG - 2, 26);
    this.serverList.setPosition(0, BasicScreen.getPaddedY(logoImage, 10), Anchor.TOP | Anchor.CENTER);
    this.serverList.setColor(0x000000);
    this.serverList.setBackgroundAlpha(185);
    this.serverList.setItemComponentSpacing(1);
    this.serverList.setBorder(0xFFFFFF, 1, 185);
    this.serverList.setPadding(2);
    this.serverList.setItemComponentFactory(ServerEntryItemComponent::new);
    this.serverList.setSelectConsumer(i -> this.updateButtons());
    this.serverList.setItems(serverEntries);
    this.serverList.createItemComponents();
    // Join button
    this.joinButton = new UIButtonBuilder(this).text(I18n.format("almura.menu_button.join")).enabled(false).width(UIConstants.Button.WIDTH_LONG).height(UIConstants.Button.HEIGHT).position(0, BasicScreen.getPaddedY(this.serverList, 2)).anchor(Anchor.TOP | Anchor.LEFT).onClick(this::join).build("button.join");
    // Back button
    this.backButton = new UIButtonBuilder(this).text(I18n.format("gui.back")).width(UIConstants.Button.WIDTH_SHORT).height(UIConstants.Button.HEIGHT).position(0, BasicScreen.getPaddedY(this.joinButton, 2)).anchor(Anchor.TOP | Anchor.LEFT).onClick(this::close).build("button.back");
    // Other button
    this.otherButton = new UIButtonBuilder(this).text(I18n.format("almura.menu_button.other")).width(UIConstants.Button.WIDTH_SHORT).height(UIConstants.Button.HEIGHT).position(0, BasicScreen.getPaddedY(this.joinButton, 2)).anchor(Anchor.TOP | Anchor.RIGHT).onClick(() -> Minecraft.getMinecraft().displayGuiScreen(new GuiMultiplayer(this))).build("button.other");
    // Add everything to the bowl
    contentContainer.add(logoImage, this.serverList, this.joinButton, backButton, otherButton);
    screenContainer.add(contentContainer);
    // Bake that cake
    this.addToScreen(screenContainer);
    // Select the first entry
    this.serverList.setSelectedItem(serverEntries.stream().findFirst().orElse(null));
    updateButtons();
}
Also used : GuiTexture(net.malisis.core.client.gui.GuiTexture) UIButtonBuilder(net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder) BasicContainer(net.malisis.core.client.gui.component.container.BasicContainer) UIImage(net.malisis.core.client.gui.component.decoration.UIImage) GuiMultiplayer(net.minecraft.client.gui.GuiMultiplayer)

Example 3 with UIButtonBuilder

use of net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder in project Almura by AlmuraDev.

the class SimpleAboutMenu method construct.

@SuppressWarnings({ "unchecked" })
@Override
public void construct() {
    super.construct();
    this.list = new BasicList<>(this, 125, UIComponent.INHERITED);
    this.list.setPosition(4, 0);
    this.list.setItemComponentSpacing(4);
    this.list.setCanDeselect(false);
    final List<AboutItemData> elementDataList = Lists.newArrayList();
    // Static entry
    elementDataList.add(new AboutItemData(this.list, new UIImage(this, new GuiTexture(GuiConfig.Location.ALMURA_MAN), null), 5, 0, 23, 32, 8, AboutConfig.TITLE, AboutConfig.STORY));
    // Dynamic entry
    AboutConfig.ENTRIES.forEach(entry -> {
        Text titles = Text.EMPTY;
        for (final String title : entry.titles) {
            titles = titles.toBuilder().append(Text.of("  • ", I18n.format(title)), Text.NEW_LINE).build();
        }
        elementDataList.add(new AboutItemData(this.list, new UIImage(this, new GuiRemoteTexture(GuiConfig.Location.GENERIC_AVATAR, new ResourceLocation(Almura.ID, "textures/gui/skins/avatars/" + entry.uniqueId + ".png"), String.format(GuiConfig.Url.SKINS, entry.uniqueId, 32), 32, 32), null), 2, 0, 32, 32, 4, Text.of(entry.color, I18n.format(entry.name)), Text.of(TextColors.WHITE, I18n.format(entry.description), Text.NEW_LINE, Text.NEW_LINE, TextStyles.BOLD, I18n.format("almura.menu.about.titles"), TextStyles.RESET, TextColors.RESET, Text.NEW_LINE, titles)));
    });
    final UIButton doneButton = new UIButtonBuilder(this).text(I18n.format("gui.done")).size(98, 20).position(0, -15, 1).anchor(Anchor.BOTTOM | Anchor.CENTER).listener(this).build("button.done");
    this.textField = new UITextField(this, "", true);
    this.textField.setPosition(BasicScreen.getPaddedX(this.list, 4), 0);
    this.textField.setEditable(false);
    this.textField.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(false).build());
    this.list.setItemComponentFactory(AboutItemComponent::new);
    this.list.setItems(elementDataList);
    this.list.setSelectConsumer(i -> this.textField.setText(TextSerializers.LEGACY_FORMATTING_CODE.serialize(i.getContent())));
    this.list.setSelectedItem(elementDataList.get(0));
    this.getContainer().add(this.list, this.textField);
    // SpongeForge
    final UILabel spongeForgeVersionLabel = new UILabel(this, TextFormatting.WHITE + "SpongeForge: " + ((Optional<String>) Sponge.getPlatform().asMap().get("ImplementationVersion")).orElse("dev"));
    spongeForgeVersionLabel.setPosition(4, -24, Anchor.LEFT | Anchor.BOTTOM);
    // Forge
    final PluginContainer forgeContainer = Sponge.getPluginManager().getPlugin("Forge").orElseThrow(NullPointerException::new);
    final UILabel forgeVersionLabel = new UILabel(this, TextFormatting.WHITE + "Forge: " + forgeContainer.getVersion().orElse("dev"));
    forgeVersionLabel.setPosition(4, -14, Anchor.LEFT | Anchor.BOTTOM);
    addToScreen(forgeVersionLabel);
    // Almura
    final PluginContainer almuraContainer = Sponge.getPluginManager().getPlugin("almura").orElseThrow(NullPointerException::new);
    final UILabel almuraVersionLabel = new UILabel(this, TextFormatting.WHITE + "Almura 3.1 - " + Almura.buildNumber);
    almuraVersionLabel.setPosition(4, -4, Anchor.LEFT | Anchor.BOTTOM);
    addToScreen(almuraVersionLabel);
    addToScreen(doneButton);
    addToScreen(spongeForgeVersionLabel);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) PluginContainer(org.spongepowered.api.plugin.PluginContainer) Optional(java.util.Optional) Text(org.spongepowered.api.text.Text) UITextField(net.malisis.core.client.gui.component.interaction.UITextField) GuiRemoteTexture(com.almuradev.almura.shared.client.texture.GuiRemoteTexture) GuiTexture(net.malisis.core.client.gui.GuiTexture) UIButtonBuilder(net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder) ResourceLocation(net.minecraft.util.ResourceLocation) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) UIImage(net.malisis.core.client.gui.component.decoration.UIImage)

Example 4 with UIButtonBuilder

use of net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder in project Almura by AlmuraDev.

the class NicknameGUI method construct.

@SuppressWarnings("unchecked")
@Override
public void construct() {
    this.guiscreenBackground = false;
    Keyboard.enableRepeatEvents(true);
    // Master Panel
    this.form = new BasicForm(this, 400, 225, "");
    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 UILabel titleLabel = new UILabel(this, "Nicknames");
    titleLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build());
    titleLabel.setPosition(0, -15, Anchor.CENTER | Anchor.TOP);
    // Player Render Area
    final BasicForm playerArea = new BasicForm(this, 175, 185, "");
    playerArea.setPosition(0, 0, Anchor.RIGHT | Anchor.MIDDLE);
    playerArea.setMovable(false);
    playerArea.setClosable(false);
    playerArea.setBorder(FontColors.WHITE, 1, 185);
    playerArea.setBackgroundAlpha(215);
    playerArea.setBottomPadding(3);
    playerArea.setRightPadding(3);
    playerArea.setTopPadding(3);
    playerArea.setLeftPadding(3);
    // Nickname List Area
    final BasicForm listArea = new BasicForm(this, 217, 85, "");
    listArea.setPosition(0, 0, Anchor.LEFT | Anchor.TOP);
    listArea.setMovable(false);
    listArea.setClosable(false);
    listArea.setBorder(FontColors.WHITE, 1, 185);
    listArea.setBackgroundAlpha(215);
    listArea.setBottomPadding(3);
    listArea.setRightPadding(3);
    listArea.setTopPadding(3);
    listArea.setLeftPadding(3);
    final UILabel nicknameLabel = new UILabel(this, "Enter desired nickname:");
    nicknameLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build());
    nicknameLabel.setPosition(7, 10, Anchor.LEFT | Anchor.TOP);
    // Nickname Entry Textbox
    this.nicknameTextbox = new UITextField(this, "", false);
    this.nicknameTextbox.setSize(150, 0);
    this.nicknameTextbox.setText(this.originalNickname);
    this.nicknameTextbox.setPosition(7, 23, Anchor.LEFT | Anchor.TOP);
    this.nicknameTextbox.setEditable(true);
    this.nicknameTextbox.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(false).build());
    final UILabel colorLabel = new UILabel(this, "Add colors:");
    colorLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build());
    colorLabel.setPosition(7, 40, Anchor.LEFT | Anchor.TOP);
    // Color Selection dropdown
    this.colorSelector = new UISelect<>(this, 100, Arrays.asList("§1Dark Blue", "§9Blue", "§3Dark Aqua", "§bAqua", "§4Dark Red", "§cRed", "§eYellow", "§6Gold", "§2Dark Green", "§aGreen", "§5Dark Purple", "§dLight Purple", "§fWhite", "§7Gray", "§8Dark Gray", "§0Black,"));
    this.colorSelector.setPosition(7, 50, Anchor.LEFT | Anchor.TOP);
    this.colorSelector.setOptionsWidth(UISelect.SELECT_WIDTH);
    this.colorSelector.setFontOptions(FontOptions.builder().shadow(false).build());
    this.colorSelector.select("§1Dark Blue");
    // Add Color character button
    final UIButton buttonColor = new UIButtonBuilder(this).width(40).position(110, 49, Anchor.LEFT | Anchor.TOP).text(I18n.format("almura.button.add")).listener(this).build("button.color");
    // Reset button
    final UIButton buttonReset = new UIButtonBuilder(this).width(40).position(150, 49, Anchor.LEFT | Anchor.TOP).text(I18n.format("almura.button.reset")).listener(this).build("button.reset");
    // Remove Nickname button
    final UIButton buttonRemove = new UIButtonBuilder(this).width(70).position(105, 65, Anchor.LEFT | Anchor.TOP).text(I18n.format("almura.button.nick.remove")).enabled(this.canChangeNickname).listener(this).build("button.remove");
    final UILabel nicknameRulesLabel = new UILabel(this, "Please follow nickname rules.");
    nicknameRulesLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build());
    nicknameRulesLabel.setPosition(3, -2, Anchor.LEFT | Anchor.BOTTOM);
    // Close button
    final UIButton buttonClose = new UIButtonBuilder(this).width(40).anchor(Anchor.BOTTOM | Anchor.RIGHT).text("almura.button.close").listener(this).build("button.close");
    // Apply button
    final UIButton buttonApply = new UIButtonBuilder(this).width(40).anchor(Anchor.BOTTOM | Anchor.RIGHT).position(-40, 0).text("almura.button.apply").enabled(this.canChangeNickname).listener(this).build("button.apply");
    this.form.add(titleLabel, listArea, playerArea, nicknameLabel, this.nicknameTextbox, nicknameRulesLabel, colorLabel, this.colorSelector, buttonColor, buttonReset, buttonRemove, buttonClose, buttonApply);
    addToScreen(this.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) UITextField(net.malisis.core.client.gui.component.interaction.UITextField)

Example 5 with UIButtonBuilder

use of net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder in project Almura by AlmuraDev.

the class DisconnectedGui method construct.

@Override
public void construct() {
    this.guiscreenBackground = true;
    Keyboard.enableRepeatEvents(true);
    this.form = new BasicForm(this, 350, 140, "Server Status");
    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(59, 59);
    almuraHeader.setPosition(0, 5, Anchor.TOP | Anchor.CENTER);
    this.messageLabel = new UILabel(this, "Disconnected from Server");
    this.messageLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build());
    this.messageLabel.setPosition(0, almuraHeader.getHeight() + 5, Anchor.CENTER | Anchor.TOP);
    final UISeparator belowLabelSeparator = new UISeparator(this);
    belowLabelSeparator.setSize(this.form.getWidth() - 5, 1);
    belowLabelSeparator.setPosition(0, this.messageLabel.getY() + 10, Anchor.CENTER | Anchor.TOP);
    this.form.add(belowLabelSeparator);
    this.reasonBox = new BasicTextBox(this, "Unknown Reason", true);
    this.reasonBox.setAlpha(0);
    this.reasonBox.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(0.7F).build());
    this.reasonBox.setPosition(0, this.messageLabel.getY() + 14, Anchor.CENTER | Anchor.TOP);
    this.reasonBox.setOptions(16238795, 0, 0);
    this.reasonBox.setSize(this.form.getWidth() - 5, 15);
    if (reason.length() > 0) {
        this.reasonBox.setText(reason);
    }
    for (int i = 0; i < 4; i++) {
        if (this.reasonBox.getScrollbar().isEnabled()) {
            this.reasonBox.setSize(this.reasonBox.getWidth(), this.reasonBox.getHeight() + 15);
            this.form.setSize(this.form.getWidth(), this.form.getHeight() + 15);
        }
    }
    this.reasonBox.getScrollbar().autoHide = true;
    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);
    // Close button
    this.buttonClose = new UIButtonBuilder(this).width(40).anchor(Anchor.BOTTOM | Anchor.CENTER).position(0, -1).text("Return to Server Menu").fontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).build()).listener(this).build("button.return");
    this.form.add(almuraHeader, this.messageLabel, this.reasonBox, 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) BasicTextBox(net.malisis.core.client.gui.component.interaction.BasicTextBox)

Aggregations

UIButtonBuilder (net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder)31 UILabel (net.malisis.core.client.gui.component.decoration.UILabel)27 BasicForm (net.malisis.core.client.gui.component.container.BasicForm)25 UIButton (net.malisis.core.client.gui.component.interaction.UIButton)21 UISeparator (net.malisis.core.client.gui.component.decoration.UISeparator)11 UIImage (net.malisis.core.client.gui.component.decoration.UIImage)10 BasicTextBox (net.malisis.core.client.gui.component.interaction.BasicTextBox)10 GuiTexture (net.malisis.core.client.gui.GuiTexture)8 BasicContainer (net.malisis.core.client.gui.component.container.BasicContainer)8 UICheckBox (net.malisis.core.client.gui.component.interaction.UICheckBox)5 UITextField (net.malisis.core.client.gui.component.interaction.UITextField)5 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