use of riskyken.armourersWorkshop.client.gui.globallibrary.GuiGlobalLibrary in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibraryPanelUpload method update.
@Override
public void update() {
super.update();
buttonUpload.enabled = false;
if (!StringUtils.isNullOrEmpty(textName.getText())) {
SlotHidable slot = ((GuiGlobalLibrary) parent).getInputSlot();
if (SkinNBTHelper.stackHasSkinData(slot.getStack())) {
buttonUpload.enabled = true;
}
}
if (taskSkinUpload != null && taskSkinUpload.isDone()) {
try {
JsonObject json = taskSkinUpload.get();
taskSkinUpload = null;
if (json != null) {
if (json.has("valid") & json.has("action")) {
String action = json.get("action").getAsString();
boolean valid = json.get("valid").getAsBoolean();
if (valid & action.equals("skin-upload")) {
((GuiGlobalLibrary) parent).panelHome.updateSkinPanels();
((GuiGlobalLibrary) parent).switchScreen(Screen.HOME);
}
} else {
if (json.has("reason")) {
String reason = json.get("reason").getAsString();
error = reason;
}
}
} else {
// TODO handle upload failure
}
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
}
use of riskyken.armourersWorkshop.client.gui.globallibrary.GuiGlobalLibrary 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);
}
use of riskyken.armourersWorkshop.client.gui.globallibrary.GuiGlobalLibrary in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibraryPanelHeader method draw.
@Override
public void draw(int mouseX, int mouseY, float partialTickTime) {
if (!visible) {
return;
}
drawGradientRect(this.x, this.y, this.x + this.width, this.y + height, 0xC0101010, 0xD0101010);
super.draw(mouseX, mouseY, partialTickTime);
// TODO look in YggdrasilMinecraftSessionService
String username = "player";
GameProfile gameProfile = mc.thePlayer.getGameProfile();
if (gameProfile != null) {
username = gameProfile.getName();
GuiHelper.drawPlayerHead(x + 4, y + 4, 16, username);
this.fontRenderer.drawString(" - " + username, this.x + 24, this.y + (height / 2) - fontRenderer.FONT_HEIGHT / 2, 0xAAFFAA);
} else {
this.fontRenderer.drawString("Not logged in.", this.x + 90, this.y + (height / 2) - fontRenderer.FONT_HEIGHT / 2, 0xFFAAAA);
}
String titleText = ((GuiGlobalLibrary) parent).tileEntity.getBlockType().getLocalizedName();
drawCenteredString(fontRenderer, titleText, x + (width / 2), this.y + (height / 2) - fontRenderer.FONT_HEIGHT / 2, 0xFFEEEEEE);
}
use of riskyken.armourersWorkshop.client.gui.globallibrary.GuiGlobalLibrary in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibraryPanelHome method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) {
if (button == buttonShowAll) {
((GuiGlobalLibrary) parent).panelSearchResults.clearResults();
((GuiGlobalLibrary) parent).switchScreen(Screen.SEARCH);
((GuiGlobalLibrary) parent).panelSearchResults.doSearch("");
}
if (button == skinPanelRecentlyUploaded | button == skinPanelMostDownloaded | button == skinPanelMostLiked) {
SkinIcon skinIcon = ((GuiControlSkinPanel) button).getLastPressedSkinIcon();
if (skinIcon != null) {
((GuiGlobalLibrary) parent).panelSkinInfo.displaySkinInfo(skinIcon.getSkinJson(), Screen.HOME);
}
}
}
use of riskyken.armourersWorkshop.client.gui.globallibrary.GuiGlobalLibrary in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibraryPanelSearchBox method initGui.
@Override
public void initGui() {
super.initGui();
String guiName = ((GuiGlobalLibrary) parent).getGuiName();
buttonList.clear();
searchTextbox = new GuiLabeledTextField(fontRenderer, x + 5, y + 5, width - 10 - 85, 12);
searchTextbox.setEmptyLabel(GuiHelper.getLocalizedControlName(guiName, "searchBox.typeToSearch"));
buttonList.add(new GuiButtonExt(0, x + width - 85, y + 3, 80, 16, GuiHelper.getLocalizedControlName(guiName, "searchBox.search")));
}
Aggregations