Search in sources :

Example 1 with UIBackgroundContainer

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

the class ServerMenu method construct.

@Override
public void construct() {
    // Create the form
    final UIBackgroundContainer form = new UIBackgroundContainer(this, "", 225, 225);
    // form.setTitle(TextFormatting.WHITE + "Multiplayer");
    form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
    // Create the logo
    logoImage = new UIImage(this, new GuiTexture(GuiConfig.Location.ALMURA_LOGO), null);
    logoImage.setSize(60, 99);
    logoImage.setPosition(0, 0, Anchor.TOP | Anchor.CENTER);
    liveServerOnline = new UILabel(this, TextFormatting.YELLOW + "Updating...");
    liveServerOnline.setPosition(0, getPaddedY(logoImage, padding) + 7, Anchor.TOP | Anchor.CENTER);
    liveServerTitle = new UILabel(this, TextFormatting.WHITE + "Public Server : ");
    liveServerTitle.setPosition(-liveServerTitle.getWidth() / 2 + padding, liveServerOnline.getY(), Anchor.TOP | Anchor.CENTER);
    // Create the live Almura button
    almuraLiveButton = new UIButton(this, "Join ");
    almuraLiveButton.setSize(40, 16);
    almuraLiveButton.setName("button.server.almura.live");
    almuraLiveButton.setPosition(liveServerTitle.getWidth() / 2 + padding, getPaddedY(logoImage, padding) + 3, Anchor.TOP | Anchor.CENTER);
    almuraLiveButton.setVisible(false);
    almuraLiveButton.register(this);
    livePlayersOnline = new UILabel(this, TextFormatting.DARK_BLUE + "(0/50)");
    livePlayersOnline.setPosition(0, liveServerOnline.getY(), Anchor.TOP | Anchor.CENTER);
    livePlayersOnline.setVisible(false);
    devServerOnline = new UILabel(this, TextFormatting.YELLOW + "Updating...");
    devServerOnline.setPosition(0, getPaddedY(almuraLiveButton, padding) + 8, Anchor.TOP | Anchor.CENTER);
    devServerTitle = new UILabel(this, TextFormatting.WHITE + "Dev Server : ");
    devServerTitle.setPosition(26, devServerTitle.getY(), Anchor.TOP | Anchor.CENTER);
    // Create the beta Almura button
    almuraDevButton = new UIButton(this, "Join ");
    almuraDevButton.setSize(40, 16);
    almuraDevButton.setName("button.server.almura.dev");
    almuraDevButton.setPosition(devServerOnline.getX() + devServerOnline.getWidth() + 5, getPaddedY(almuraLiveButton, padding) + 3, Anchor.TOP | Anchor.LEFT);
    almuraDevButton.setVisible(false);
    almuraDevButton.register(this);
    devPlayersOnline = new UILabel(this, TextFormatting.DARK_BLUE + "(0/50)");
    devPlayersOnline.setPosition(0, getPaddedY(almuraLiveButton, padding) + 8, Anchor.TOP | Anchor.CENTER);
    devPlayersOnline.setVisible(false);
    centerAlign();
    // Create the join another server button
    UIButton anotherButton = new UIButton(this, "Other Multiplayer");
    anotherButton.setPosition(0, getPaddedY(almuraDevButton, padding) + 13, Anchor.TOP | Anchor.CENTER);
    anotherButton.setSize(GuiConfig.Button.WIDTH_LONG, GuiConfig.Button.HEIGHT);
    anotherButton.setName("button.server.another");
    anotherButton.register(this);
    // Create the back button
    UIButton backButton = new UIButton(this, "Back");
    backButton.setPosition(0, getPaddedY(anotherButton, padding) + 3, Anchor.TOP | Anchor.CENTER);
    backButton.setSize(GuiConfig.Button.WIDTH_LONG, GuiConfig.Button.HEIGHT);
    backButton.setName("button.back");
    backButton.register(this);
    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.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.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.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());
    form.add(logoImage, liveServerTitle, liveServerOnline, almuraLiveButton, devServerTitle, devServerOnline, almuraDevButton, devPlayersOnline, livePlayersOnline, anotherButton, backButton);
    form.setColor(Integer.MIN_VALUE);
    form.setBackgroundAlpha(0);
    addToScreen(form, forumsButton, issuesButton, shopButton, trademarkLabel, copyrightLabel);
}
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)

Example 2 with UIBackgroundContainer

use of net.malisis.core.client.gui.component.container.UIBackgroundContainer 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 3 with UIBackgroundContainer

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

the class UIMessageBox method construct.

private void construct(MalisisGui gui) {
    setTopPadding(topPadding);
    setBottomPadding(bottomPadding);
    if (!this.message.isEmpty()) {
        final UILabel messageLabel = new UILabel(gui, this.message, true);
        messageLabel.setSize(UIComponent.INHERITED, UIComponent.INHERITED);
        final UISlimScrollbar scrollbar = new UISlimScrollbar(gui, messageLabel, UIScrollBar.Type.VERTICAL);
        scrollbar.setAutoHide(true);
        add(messageLabel.setAnchor(Anchor.CENTER | Anchor.MIDDLE));
    }
    final UIBackgroundContainer buttonContainer = new UIBackgroundContainer(gui);
    final List<UIButton> buttons = new ArrayList<>();
    switch(this.messageBoxButtons) {
        case OK:
            buttons.add(buildButton(gui, "button.ok"));
            break;
        case OK_CANCEL:
            buttons.add(buildButton(gui, "button.ok"));
            buttons.add(buildButton(gui, "button.cancel"));
            break;
        case YES_NO:
            buttons.add(buildButton(gui, "button.yes"));
            buttons.add(buildButton(gui, "button.no"));
            break;
        case YES_NO_CANCEL:
            buttons.add(buildButton(gui, "button.yes"));
            buttons.add(buildButton(gui, "button.no"));
            buttons.add(buildButton(gui, "button.cancel"));
            break;
        case CLOSE:
            buttons.add(buildButton(gui, "button.close"));
    }
    int width = 0;
    int x = 0;
    for (UIButton button : buttons) {
        buttonContainer.add(button.setPosition(x, 0));
        x += button.getWidth() + buttonPadding;
        width += button.getWidth();
    }
    width += buttonPadding * (buttons.size() - 1);
    buttonContainer.setSize(width, GuiConfig.Button.HEIGHT);
    buttonContainer.setPosition(0, 5, Anchor.BOTTOM | Anchor.RIGHT);
    buttonContainer.setBackgroundAlpha(0);
    add(buttonContainer);
}
Also used : UILabel(net.malisis.core.client.gui.component.decoration.UILabel) UISlimScrollbar(net.malisis.core.client.gui.component.control.UISlimScrollbar) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) ArrayList(java.util.ArrayList) UIBackgroundContainer(net.malisis.core.client.gui.component.container.UIBackgroundContainer)

Example 4 with UIBackgroundContainer

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

the class PanoramicMainMenu method construct.

@SuppressWarnings("deprecation")
@Override
public void construct() {
    final UIBackgroundContainer contentContainer = new UIBackgroundContainer(this);
    contentContainer.setBackgroundAlpha(0);
    contentContainer.setPosition(0, -10, Anchor.MIDDLE | Anchor.CENTER);
    contentContainer.setSize(UIConstants.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, UIConstants.Button.WIDTH_LONG + PADDING, (UIConstants.Button.HEIGHT * 4) + (PADDING * 3));
    this.buttonContainer.setPosition(0, BasicScreen.getPaddedY(almuraHeader, 10), Anchor.TOP | Anchor.CENTER);
    this.buttonContainer.setBackgroundAlpha(0);
    final UIButton singleplayerButton = new UIButtonBuilder(this).container(this.buttonContainer).text(I18n.format("menu.singleplayer")).size(UIConstants.Button.WIDTH_LONG, UIConstants.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(I18n.format("menu.multiplayer")).size(UIConstants.Button.WIDTH_LONG, UIConstants.Button.HEIGHT).position(0, BasicScreen.getPaddedY(singleplayerButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.multiplayer");
    final UIButton optionsButton = new UIButtonBuilder(this).container(this.buttonContainer).text(I18n.format("options.title")).size(UIConstants.Button.WIDTH_TINY, UIConstants.Button.HEIGHT).position(-68, BasicScreen.getPaddedY(multiplayerButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.options");
    final UIButton modsButton = new UIButtonBuilder(this).container(this.buttonContainer).text(I18n.format("almura.menu_button.mods")).size(UIConstants.Button.WIDTH_TINY, UIConstants.Button.HEIGHT).position(BasicScreen.getPaddedX(optionsButton, PADDING), BasicScreen.getPaddedY(multiplayerButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.mods");
    final UIButton aboutButton = new UIButtonBuilder(this).container(this.buttonContainer).text(I18n.format("almura.menu_button.about")).size(UIConstants.Button.WIDTH_TINY, UIConstants.Button.HEIGHT).position(BasicScreen.getPaddedX(modsButton, PADDING), BasicScreen.getPaddedY(multiplayerButton, PADDING)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.about");
    final UIButton quitButton = new UIButtonBuilder(this).container(this.buttonContainer).text(I18n.format("almura.menu_button.quit")).fontOptions(FontOptions.builder().from(FontColors.RED_FO).shadow(true).build()).hoverFontOptions(FontOptions.builder().color(Color.ofRgb(255, 89, 89).getRgb()).shadow(true).build()).size(UIConstants.Button.WIDTH_LONG, UIConstants.Button.HEIGHT).position(singleplayerButton.getX(), BasicScreen.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(UIConstants.Button.WIDTH_ICON, UIConstants.Button.HEIGHT_ICON).position(-PADDING, -PADDING).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(I18n.format("almura.menu_button.forums")).build("button.forums");
    final UIButton issuesButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.FA_GITHUB).size(UIConstants.Button.WIDTH_ICON, UIConstants.Button.HEIGHT_ICON).position(BasicScreen.getPaddedX(forumsButton, PADDING, Anchor.RIGHT), forumsButton.getY()).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(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(UIConstants.Button.WIDTH_ICON, UIConstants.Button.HEIGHT_ICON).position(BasicScreen.getPaddedX(issuesButton, PADDING, Anchor.RIGHT), issuesButton.getY()).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(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(), BasicScreen.getPaddedY(trademarkLabel, PADDING, Anchor.BOTTOM), trademarkLabel.getAnchor());
    contentContainer.add(almuraHeader, this.buttonContainer);
    // Disable escape key press
    registerKeyListener((keyChar, keyCode) -> keyCode == Keyboard.KEY_ESCAPE);
    final BasicContainer<?> container = new BasicContainer(this, UIComponent.INHERITED, UIComponent.INHERITED);
    container.setBackgroundAlpha(0);
    container.add(contentContainer);
    container.add(trademarkLabel);
    container.add(copyrightLabel);
    container.add(shopButton);
    container.add(forumsButton);
    container.add(issuesButton);
    // Add content to screen
    addToScreen(container);
    // OpenGL Warning
    if (!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.areShadersSupported()) {
        final UILabel glWarning1 = new UILabel(this, TextFormatting.BOLD + "" + TextFormatting.DARK_RED + I18n.format("almura.menu.main.opengl.0"));
        glWarning1.setPosition(2, 2, Anchor.TOP | Anchor.LEFT);
        final UILabel glWarning2 = new UILabel(this, TextFormatting.BOLD + "" + TextFormatting.DARK_RED + I18n.format("almura.menu.main.opengl.1"));
        glWarning2.setPosition(2, BasicScreen.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(net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder) UIButton(net.malisis.core.client.gui.component.interaction.UIButton) BasicContainer(net.malisis.core.client.gui.component.container.BasicContainer) UIImage(net.malisis.core.client.gui.component.decoration.UIImage) UIBackgroundContainer(net.malisis.core.client.gui.component.container.UIBackgroundContainer)

Aggregations

UIBackgroundContainer (net.malisis.core.client.gui.component.container.UIBackgroundContainer)4 UILabel (net.malisis.core.client.gui.component.decoration.UILabel)4 UIButton (net.malisis.core.client.gui.component.interaction.UIButton)4 GuiTexture (net.malisis.core.client.gui.GuiTexture)2 UIImage (net.malisis.core.client.gui.component.decoration.UIImage)2 UIButtonBuilder (net.malisis.core.client.gui.component.interaction.button.builder.UIButtonBuilder)2 GeneralCategory (com.almuradev.almura.core.client.config.category.GeneralCategory)1 UIButtonBuilder (com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder)1 ArrayList (java.util.ArrayList)1 BasicContainer (net.malisis.core.client.gui.component.container.BasicContainer)1 UISlimScrollbar (net.malisis.core.client.gui.component.control.UISlimScrollbar)1 UICheckBox (net.malisis.core.client.gui.component.interaction.UICheckBox)1 UISliderBuilder (net.malisis.core.client.gui.component.interaction.slider.builder.UISliderBuilder)1 GuiOptions (net.minecraft.client.gui.GuiOptions)1