Search in sources :

Example 1 with EntryWrapper

use of amerifrance.guideapi.wrapper.EntryWrapper in project Guide-API by TeamAmeriFrance.

the class GuiCategory method drawScreen.

@Override
public void drawScreen(int mouseX, int mouseY, float renderPartialTicks) {
    Minecraft.getMinecraft().getTextureManager().bindTexture(pageTexture);
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
    Minecraft.getMinecraft().getTextureManager().bindTexture(outlineTexture);
    drawTexturedModalRectWithColor(guiLeft, guiTop, 0, 0, xSize, ySize, book.getColor());
    entryPage = MathHelper.clamp(entryPage, 0, entryWrapperMap.size() - 1);
    for (EntryWrapper wrapper : this.entryWrapperMap.get(entryPage)) {
        if (wrapper.canPlayerSee()) {
            wrapper.draw(mouseX, mouseY, this);
            wrapper.drawExtras(mouseX, mouseY, this);
        }
        if (wrapper.isMouseOnWrapper(mouseX, mouseY) && wrapper.canPlayerSee()) {
            wrapper.onHoverOver(mouseX, mouseY);
        }
    }
    drawCenteredString(fontRenderer, String.format("%d/%d", entryPage + 1, entryWrapperMap.asMap().size()), guiLeft + xSize / 2, guiTop + 5 * ySize / 6, 0);
    drawCenteredStringWithShadow(fontRenderer, category.getLocalizedName(), guiLeft + xSize / 2, guiTop - 10, Color.WHITE.getRGB());
    buttonPrev.visible = entryPage != 0;
    buttonNext.visible = entryPage != entryWrapperMap.asMap().size() - 1 && !entryWrapperMap.asMap().isEmpty();
    super.drawScreen(mouseX, mouseY, renderPartialTicks);
}
Also used : EntryWrapper(amerifrance.guideapi.wrapper.EntryWrapper)

Example 2 with EntryWrapper

use of amerifrance.guideapi.wrapper.EntryWrapper in project Guide-API by TeamAmeriFrance.

the class GuiCategory method initGui.

@Override
public void initGui() {
    super.initGui();
    this.buttonList.clear();
    this.entryWrapperMap.clear();
    guiLeft = (this.width - this.xSize) / 2;
    guiTop = (this.height - this.ySize) / 2;
    this.buttonList.add(buttonBack = new ButtonBack(0, guiLeft + xSize / 6, guiTop, this));
    this.buttonList.add(buttonNext = new ButtonNext(1, guiLeft + 4 * xSize / 6, guiTop + 5 * ySize / 6, this));
    this.buttonList.add(buttonPrev = new ButtonPrev(2, guiLeft + xSize / 5, guiTop + 5 * ySize / 6, this));
    int eX = guiLeft + 37;
    int eY = guiTop + 15;
    int i = 0;
    int pageNumber = 0;
    List<EntryAbstract> entries = Lists.newArrayList(category.entries.values());
    for (EntryAbstract entry : entries) {
        entry.onInit(book, category, this, player, bookStack);
        entryWrapperMap.put(pageNumber, new EntryWrapper(this, book, category, entry, eX, eY, 4 * xSize / 6, 10, player, this.fontRenderer, bookStack));
        eY += 13;
        i++;
        if (i >= 11) {
            i = 0;
            eY = guiTop + 15;
            pageNumber++;
        }
    }
}
Also used : ButtonBack(amerifrance.guideapi.button.ButtonBack) EntryAbstract(amerifrance.guideapi.api.impl.abstraction.EntryAbstract) EntryWrapper(amerifrance.guideapi.wrapper.EntryWrapper) ButtonPrev(amerifrance.guideapi.button.ButtonPrev) ButtonNext(amerifrance.guideapi.button.ButtonNext)

Aggregations

EntryWrapper (amerifrance.guideapi.wrapper.EntryWrapper)2 EntryAbstract (amerifrance.guideapi.api.impl.abstraction.EntryAbstract)1 ButtonBack (amerifrance.guideapi.button.ButtonBack)1 ButtonNext (amerifrance.guideapi.button.ButtonNext)1 ButtonPrev (amerifrance.guideapi.button.ButtonPrev)1