Search in sources :

Example 1 with PlushieUser

use of riskyken.armourersWorkshop.common.library.global.PlushieUser in project Armourers-Workshop by RiskyKen.

the class GuiGlobalLibraryPanelSkinInfo method actionPerformed.

@Override
protected void actionPerformed(GuiButton button) {
    if (button == buttonBack) {
        ((GuiGlobalLibrary) parent).switchScreen(returnScreen);
    }
    if (button == buttonDownload) {
        if (skinJson != null) {
            buttonDownload.enabled = false;
            new DownloadSkin(skinJson);
        }
    }
    if (button == buttonUserSkins) {
        if (skinJson != null && skinJson.has("user_id")) {
            int userId = skinJson.get("user_id").getAsInt();
            PlushieUser plushieUser = GlobalSkinLibraryUtils.getUserInfo(userId);
            if (plushieUser != null) {
                ((GuiGlobalLibrary) parent).panelUserSkins.clearResults();
                ((GuiGlobalLibrary) parent).switchScreen(Screen.USER_SKINS);
                ((GuiGlobalLibrary) parent).panelUserSkins.switchToUser(userId);
            }
        }
    }
    if (button == buttonEditSkin) {
        if (skinJson != null) {
            ((GuiGlobalLibrary) parent).panelSkinEdit.displaySkinInfo(skinJson, returnScreen);
        }
    }
    if (button == buttonLikeSkin) {
        setSkinLike(true);
        buttonLikeSkin.enabled = false;
    }
    if (button == buttonUnlikeSkin) {
        setSkinLike(false);
        buttonUnlikeSkin.enabled = false;
    }
}
Also used : PlushieUser(riskyken.armourersWorkshop.common.library.global.PlushieUser) GuiGlobalLibrary(riskyken.armourersWorkshop.client.gui.globallibrary.GuiGlobalLibrary)

Example 2 with PlushieUser

use of riskyken.armourersWorkshop.common.library.global.PlushieUser in project Armourers-Workshop by RiskyKen.

the class GuiGlobalLibraryPanelSkinInfo method draw.

@Override
public void draw(int mouseX, int mouseY, float partialTickTime) {
    if (!visible) {
        return;
    }
    PlushieUser user = null;
    if (skinJson != null && skinJson.has("user_id")) {
        int userId = skinJson.get("user_id").getAsInt();
        user = GlobalSkinLibraryUtils.getUserInfo(userId);
    }
    drawGradientRect(this.x, this.y, this.x + this.width, this.y + height, 0xC0101010, 0xD0101010);
    Skin skin = null;
    if (skinJson != null && skinJson.has("id")) {
        SkinIdentifier identifier = new SkinIdentifier(0, null, skinJson.get("id").getAsInt(), null);
        skin = ClientSkinCache.INSTANCE.getSkin(identifier);
    }
    super.draw(mouseX, mouseY, partialTickTime);
    drawUserbox(x + 5, y + 5, 185, 30, mouseX, mouseY, partialTickTime);
    drawSkinInfo(skin, x + 5, y + 20 + 20, 185, height - 70, mouseX, mouseY, partialTickTime);
    drawPreviewBox(skin, x + 195, y + 5, width - 200, height - 35, mouseX, mouseY, partialTickTime);
}
Also used : Skin(riskyken.armourersWorkshop.common.skin.data.Skin) PlushieUser(riskyken.armourersWorkshop.common.library.global.PlushieUser) SkinIdentifier(riskyken.armourersWorkshop.common.skin.data.SkinIdentifier)

Example 3 with PlushieUser

use of riskyken.armourersWorkshop.common.library.global.PlushieUser in project Armourers-Workshop by RiskyKen.

the class GuiGlobalLibraryPanelSkinInfo method drawUserbox.

public void drawUserbox(int boxX, int boxY, int boxWidth, int boxHeight, int mouseX, int mouseY, float partialTickTime) {
    drawGradientRect(boxX, boxY, boxX + boxWidth, boxY + boxHeight, 0x22888888, 0x22CCCCCC);
    String fullName = "inventory." + LibModInfo.ID.toLowerCase() + ":" + guiName + ".";
    PlushieUser user = null;
    if (skinJson != null && skinJson.has("user_id")) {
        int userId = skinJson.get("user_id").getAsInt();
        user = GlobalSkinLibraryUtils.getUserInfo(userId);
    }
    if (user != null) {
        drawString(fontRenderer, StatCollector.translateToLocalFormatted(fullName + "uploader", user.getUsername()), boxX + 28, boxY + 5, 0xFFEEEEEE);
        GuiHelper.drawPlayerHead(boxX + 5, boxY + 5, 16, user.getUsername());
    } else {
        GuiHelper.drawPlayerHead(boxX + 5, boxY + 5, 16, null);
    }
}
Also used : PlushieUser(riskyken.armourersWorkshop.common.library.global.PlushieUser)

Example 4 with PlushieUser

use of riskyken.armourersWorkshop.common.library.global.PlushieUser in project Armourers-Workshop by RiskyKen.

the class GuiGlobalLibraryPanelUserSkins method draw.

@Override
public void draw(int mouseX, int mouseY, float partialTickTime) {
    if (!visible) {
        return;
    }
    PlushieUser plushieUser = GlobalSkinLibraryUtils.getUserInfo(userId);
    String username = "unknown";
    if (plushieUser != null) {
        username = plushieUser.getUsername();
    }
    drawGradientRect(this.x, this.y, this.x + this.width, this.y + height, 0xC0101010, 0xD0101010);
    super.draw(mouseX, mouseY, partialTickTime);
    int maxPages = totalPages;
    int totalSkins = totalResults;
    String guiName = ((GuiGlobalLibrary) parent).getGuiName();
    String unlocalizedName = "inventory." + LibModInfo.ID.toLowerCase() + ":" + guiName + "." + "userSkins.results";
    String resultsText = TranslateUtils.translate(unlocalizedName, username, currentPageIndex + 1, maxPages, totalSkins);
    if (jsonCurrentPage == null) {
        resultsText = GuiHelper.getLocalizedControlName(guiName, "searchResults.label.searching");
    }
    fontRenderer.drawString(resultsText, x + 5, y + 6, 0xFFEEEEEE);
}
Also used : PlushieUser(riskyken.armourersWorkshop.common.library.global.PlushieUser) GuiGlobalLibrary(riskyken.armourersWorkshop.client.gui.globallibrary.GuiGlobalLibrary)

Aggregations

PlushieUser (riskyken.armourersWorkshop.common.library.global.PlushieUser)4 GuiGlobalLibrary (riskyken.armourersWorkshop.client.gui.globallibrary.GuiGlobalLibrary)2 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)1 SkinIdentifier (riskyken.armourersWorkshop.common.skin.data.SkinIdentifier)1