Search in sources :

Example 1 with GuiSpellImageButton

use of am2.guis.controls.GuiSpellImageButton in project ArsMagica2 by Mithion.

the class GuiCompendiumIndex method initGui.

@Override
public void initGui() {
    super.initGui();
    int idCount = 0;
    idCount = initTabs(idCount);
    for (CompendiumEntryType category : categories) {
        idCount = initButtonsForCategory(category.getCategoryName(), idCount, category.equals(activeCategory));
    }
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    nextPage = new GuiButtonCompendiumNext(idCount++, l + 320, i1 + 13, true);
    prevPage = new GuiButtonCompendiumNext(idCount++, l + 33, i1 + 13, false);
    backToIndex = new GuiButtonCompendiumTab(idCount++, l - 10, i1 + 20, StatCollector.translateToLocal("am2.gui.back"), "back", null);
    backToIndex.setActive(true);
    backToIndex.visible = false;
    updateButton = new GuiSpellImageButton(idCount++, l - 5, i1 + 10, ArcaneCompendium.instance.isModUpdateAvailable() ? AMGuiIcons.warning : AMGuiIcons.checkmark, 0, 0);
    updateButton.setDimensions(10, 10);
    updateButton.setPopupText(ArcaneCompendium.instance.isModUpdateAvailable() ? StatCollector.translateToLocal("am2.tooltip.updateAvailable") : StatCollector.translateToLocal("am2.tooltip.upToDate"));
    this.buttonList.add(nextPage);
    this.buttonList.add(prevPage);
    this.buttonList.add(backToIndex);
    if (AMCore.config.allowVersionChecks())
        this.buttonList.add(updateButton);
    switchCategoryAndPage();
    if (this.currentParentEntry != null && this.currentParentEntry.hasSubItems()) {
        for (Object btn : this.buttonList) {
            if (btn instanceof GuiButtonCompendiumTab) {
                ((GuiButtonCompendiumTab) btn).visible = false;
            }
        }
        backToIndex.visible = true;
    }
    if (page < getNumPages()) {
        nextPage.visible = true;
    } else {
        nextPage.visible = false;
    }
    if (this.page > 0) {
        prevPage.visible = true;
    } else {
        prevPage.visible = false;
    }
}
Also used : GuiButtonCompendiumNext(am2.guis.controls.GuiButtonCompendiumNext) GuiSpellImageButton(am2.guis.controls.GuiSpellImageButton) GuiButtonCompendiumTab(am2.guis.controls.GuiButtonCompendiumTab)

Example 2 with GuiSpellImageButton

use of am2.guis.controls.GuiSpellImageButton in project ArsMagica2 by Mithion.

the class GuiSpellCustomization method initGui.

@Override
public void initGui() {
    super.initGui();
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    if (AMCore.config.suggestSpellNames())
        spellName = new GuiTextField(fontRendererObj, l + 8, i1 + 8, xSize - 36, 16);
    else
        spellName = new GuiTextField(fontRendererObj, l + 8, i1 + 8, xSize - 16, 16);
    String suggestion = ((ContainerSpellCustomization) this.inventorySlots).getInitialSuggestedName();
    spellName.setText(suggestion);
    if (!suggestion.equals("")) {
        curName = suggestion;
        ((ContainerSpellCustomization) this.inventorySlots).setNameAndIndex(curName, curIndex);
    }
    btnPrev = new GuiButtonVariableDims(0, l + 8, i1 + 26, StatCollector.translateToLocal("am2.gui.prev")).setDimensions(48, 20);
    btnNext = new GuiButtonVariableDims(1, l + xSize - 56, i1 + 26, StatCollector.translateToLocal("am2.gui.next")).setDimensions(48, 20);
    btnRandomName = new GuiButtonVariableDims(2, l + xSize - 24, i1 + 5, "???");
    btnRandomName.setDimensions(20, 20);
    this.buttonList.add(btnPrev);
    this.buttonList.add(btnNext);
    if (AMCore.config.suggestSpellNames())
        this.buttonList.add(btnRandomName);
    int IIcon_start_x = l + 12;
    int IIcon_start_y = i1 + 50;
    int btnX = IIcon_start_x;
    int btnY = IIcon_start_y;
    int id = 3;
    int IIconCount = 0;
    int curPage = 0;
    for (IIcon icon : SpellTextureHelper.instance.getAllIcons()) {
        GuiSpellImageButton spellButton = new GuiSpellImageButton(id++, btnX, btnY, icon, IIconCount++, curPage);
        if (curPage != 0) {
            spellButton.visible = false;
        }
        this.buttonList.add(spellButton);
        btnX += 14;
        if (btnX > (l + xSize) - 15) {
            btnX = IIcon_start_x;
            btnY += 14;
            if (btnY > (i1 + ySize - 10)) {
                btnY = IIcon_start_y;
                curPage++;
            }
        }
    }
    this.numPages = curPage;
}
Also used : IIcon(net.minecraft.util.IIcon) GuiSpellImageButton(am2.guis.controls.GuiSpellImageButton) GuiTextField(net.minecraft.client.gui.GuiTextField) ContainerSpellCustomization(am2.containers.ContainerSpellCustomization) GuiButtonVariableDims(am2.guis.controls.GuiButtonVariableDims)

Aggregations

GuiSpellImageButton (am2.guis.controls.GuiSpellImageButton)2 ContainerSpellCustomization (am2.containers.ContainerSpellCustomization)1 GuiButtonCompendiumNext (am2.guis.controls.GuiButtonCompendiumNext)1 GuiButtonCompendiumTab (am2.guis.controls.GuiButtonCompendiumTab)1 GuiButtonVariableDims (am2.guis.controls.GuiButtonVariableDims)1 GuiTextField (net.minecraft.client.gui.GuiTextField)1 IIcon (net.minecraft.util.IIcon)1