use of riskyken.armourersWorkshop.client.gui.controls.GuiIconButton in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibraryPanelSearchResults method initGui.
@Override
public void initGui() {
super.initGui();
String guiName = ((GuiGlobalLibrary) parent).getGuiName();
buttonList.clear();
skinPanelResults.init(x + 5, y + 24, width - 10, height - 52);
skinPanelResults.setIconSize(iconScale);
skinPanelResults.setPanelPadding(0);
skinPanelResults.setShowName(true);
iconButtonSmall = new GuiIconButton(parent, 0, x + width - 21 * 3, y + 5, 16, 16, GuiHelper.getLocalizedControlName(guiName, "searchResults.small"), BUTTON_TEXTURES);
iconButtonSmall.setIconLocation(51, 0, 16, 16);
iconButtonMedium = new GuiIconButton(parent, 0, x + width - 21 * 2, y + 5, 16, 16, GuiHelper.getLocalizedControlName(guiName, "searchResults.medium"), BUTTON_TEXTURES);
iconButtonMedium.setIconLocation(51, 17, 16, 16);
iconButtonLarge = new GuiIconButton(parent, 0, x + width - 21, y + 5, 16, 16, GuiHelper.getLocalizedControlName(guiName, "searchResults.large"), BUTTON_TEXTURES);
iconButtonLarge.setIconLocation(51, 34, 16, 16);
buttonList.add(iconButtonSmall);
buttonList.add(iconButtonMedium);
buttonList.add(iconButtonLarge);
buttonList.add(skinPanelResults);
buttonList.add(new GuiButtonExt(1, x + 5, y + height - 25, 80, 20, "<<"));
buttonList.add(new GuiButtonExt(2, x + width - 85, y + height - 25, 80, 20, ">>"));
}
use of riskyken.armourersWorkshop.client.gui.controls.GuiIconButton in project Armourers-Workshop by RiskyKen.
the class GuiSkinLibrary method initGui.
@Override
public void initGui() {
ScaledResolution reso = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
this.xSize = reso.getScaledWidth();
this.ySize = reso.getScaledHeight();
super.initGui();
String guiName = armourLibrary.getInventoryName();
int slotSize = 18;
if (ModAddonManager.addonNEI.isVisible()) {
neiBump = 18;
} else {
neiBump = 0;
}
// Move player inventory slots.
for (int x = 0; x < 9; x++) {
Slot slot = (Slot) inventorySlots.inventorySlots.get(x);
slot.yDisplayPosition = this.height + 1 - PADDING - slotSize - neiBump;
}
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
Slot slot = (Slot) inventorySlots.inventorySlots.get(x + y * 9 + 9);
slot.yDisplayPosition = this.height + 1 - INVENTORY_HEIGHT - PADDING + y * slotSize - neiBump;
}
}
// Move library inventory slots.
Slot slot = (Slot) inventorySlots.inventorySlots.get(36);
slot.yDisplayPosition = this.height + 2 - INVENTORY_HEIGHT - PADDING * 3 - slotSize - neiBump;
slot.xDisplayPosition = PADDING + 1;
slot = (Slot) inventorySlots.inventorySlots.get(37);
slot.yDisplayPosition = this.height + 2 - INVENTORY_HEIGHT - PADDING * 3 - slotSize - neiBump;
slot.xDisplayPosition = PADDING + INVENTORY_WIDTH - slotSize - 3;
buttonList.clear();
fileSwitchlocal = new GuiIconButton(this, -1, PADDING, TITLE_HEIGHT + PADDING, 50, 30, GuiHelper.getLocalizedControlName(guiName, "rollover.localFiles"), texture);
fileSwitchRemotePublic = new GuiIconButton(this, -1, PADDING + 51 + PADDING, TITLE_HEIGHT + PADDING, 50, 30, GuiHelper.getLocalizedControlName(guiName, "rollover.remotePublicFiles"), texture);
fileSwitchRemotePrivate = new GuiIconButton(this, -1, PADDING + 102 + PADDING * 2, TITLE_HEIGHT + PADDING, 50, 30, GuiHelper.getLocalizedControlName(guiName, "rollover.remotePrivateFiles"), texture);
fileSwitchlocal.setIconLocation(0, 0, 50, 30);
fileSwitchRemotePublic.setIconLocation(0, 31, 50, 30);
fileSwitchRemotePrivate.setIconLocation(0, 62, 50, 30);
openFolderButton = new GuiIconButton(this, 4, PADDING, guiTop + 80, 24, 24, GuiHelper.getLocalizedControlName(guiName, "rollover.openLibraryFolder"), texture);
openFolderButton.setIconLocation(0, 93, 24, 24);
buttonList.add(openFolderButton);
reloadButton = new GuiIconButton(this, -1, PADDING * 2 + 20, guiTop + 80, 24, 24, GuiHelper.getLocalizedControlName(guiName, "rollover.refresh"), texture);
reloadButton.setIconLocation(75, 93, 24, 24);
buttonList.add(reloadButton);
deleteButton = new GuiIconButton(this, -1, PADDING * 3 + 40, guiTop + 80, 24, 24, GuiHelper.getLocalizedControlName(guiName, "rollover.deleteSkin"), texture);
deleteButton.setIconLocation(0, 118, 24, 24);
buttonList.add(deleteButton);
newFolderButton = new GuiIconButton(this, -1, PADDING * 4 + 60, guiTop + 80, 24, 24, GuiHelper.getLocalizedControlName(guiName, "rollover.newFolder"), texture);
newFolderButton.setIconLocation(75, 118, 24, 24);
buttonList.add(newFolderButton);
int listWidth = this.width - INVENTORY_WIDTH - PADDING * 5;
int listHeight = this.height - TITLE_HEIGHT - 14 - PADDING * 3;
int typeSwitchWidth = 80;
listWidth = MathHelper.clamp_int(listWidth, 0, 200);
fileList = new GuiList(INVENTORY_WIDTH + PADDING * 2, TITLE_HEIGHT + 14 + PADDING * 2, listWidth, listHeight, 14);
if (mc.isSingleplayer()) {
fileSwitchRemotePublic.enabled = false;
fileSwitchRemotePrivate.enabled = false;
fileSwitchRemotePublic.setDisableText(GuiHelper.getLocalizedControlName(guiName, "rollover.notOnServer"));
fileSwitchRemotePrivate.setDisableText(GuiHelper.getLocalizedControlName(guiName, "rollover.notOnServer"));
setFileSwitchType(LibraryFileType.LOCAL);
} else {
setFileSwitchType(LibraryFileType.SERVER_PUBLIC);
}
buttonList.add(fileSwitchlocal);
buttonList.add(fileSwitchRemotePublic);
buttonList.add(fileSwitchRemotePrivate);
loadSaveButton = new GuiButtonExt(BUTTON_ID_LOAD_SAVE, PADDING * 2 + 18, this.height - INVENTORY_HEIGHT - PADDING * 2 - 2 - 20 - neiBump, 108, 20, "----LS--->");
buttonList.add(loadSaveButton);
filenameTextbox = new GuiLabeledTextField(fontRendererObj, PADDING, TITLE_HEIGHT + 30 + PADDING * 2, INVENTORY_WIDTH, 12);
filenameTextbox.setMaxStringLength(100);
filenameTextbox.setEmptyLabel(GuiHelper.getLocalizedControlName(guiName, "label.enterFileName"));
searchTextbox = new GuiLabeledTextField(fontRendererObj, INVENTORY_WIDTH + PADDING * 2, TITLE_HEIGHT + 1 + PADDING, listWidth - typeSwitchWidth - PADDING + 10, 12);
searchTextbox.setMaxStringLength(100);
searchTextbox.setEmptyLabel(GuiHelper.getLocalizedControlName(guiName, "label.typeToSearch"));
searchTextbox.setText(lastSearchText);
scrollbar = new GuiScrollbar(2, INVENTORY_WIDTH + 10 + listWidth, TITLE_HEIGHT + 14 + PADDING * 2, 10, listHeight, "", false);
scrollbar.setValue(scrollAmount);
buttonList.add(scrollbar);
dropDownList = new GuiDropDownList(5, INVENTORY_WIDTH + PADDING * 5 + listWidth - typeSwitchWidth - PADDING, TITLE_HEIGHT + PADDING, typeSwitchWidth, "", null);
ArrayList<ISkinType> skinTypes = SkinTypeRegistry.INSTANCE.getRegisteredSkinTypes();
dropDownList.addListItem("*");
dropDownList.setListSelectedIndex(0);
int addCount = 0;
for (int i = 0; i < skinTypes.size(); i++) {
ISkinType skinType = skinTypes.get(i);
if (!skinType.isHidden()) {
dropDownList.addListItem(SkinTypeRegistry.INSTANCE.getLocalizedSkinTypeName(skinType), skinType.getRegistryName(), true);
addCount++;
if (skinType == lastSkinType) {
dropDownList.setListSelectedIndex(addCount);
}
}
}
buttonList.add(dropDownList);
checkBoxTrack = new GuiCheckBox(-1, PADDING, this.height - INVENTORY_HEIGHT - PADDING * 5 - 2 - 20 - neiBump, GuiHelper.getLocalizedControlName(guiName, "trackFile"), trackFile);
checkBoxTrack.setTextColour(0xCCCCCC);
buttonList.add(checkBoxTrack);
}
use of riskyken.armourersWorkshop.client.gui.controls.GuiIconButton in project Armourers-Workshop by RiskyKen.
the class GuiSkinLibrary method drawScreen.
@Override
public void drawScreen(int mouseX, int mouseY, float partialTickTime) {
int oldMouseX = mouseX;
int oldMouseY = mouseY;
if (isDialogOpen()) {
mouseX = mouseY = 0;
}
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
super.drawScreen(mouseX, mouseY, partialTickTime);
GL11.glPopAttrib();
ILibraryManager libraryManager = ArmourersWorkshop.proxy.libraryManager;
ArrayList<LibraryFile> files = libraryManager.getServerPublicFileList().getFileList();
loadSaveButton.enabled = true;
if (isLoading()) {
loadSaveButton.displayString = GuiHelper.getLocalizedControlName(armourLibrary.getInventoryName(), "load");
if (fileList.getSelectedListEntry() == null || ((GuiFileListItem) fileList.getSelectedListEntry()).getFile().directory) {
loadSaveButton.displayString = "";
loadSaveButton.enabled = false;
}
} else {
loadSaveButton.displayString = GuiHelper.getLocalizedControlName(armourLibrary.getInventoryName(), "save");
}
if (!((Slot) inventorySlots.inventorySlots.get(36)).getHasStack() & !armourLibrary.isCreativeLibrary()) {
loadSaveButton.displayString = "";
loadSaveButton.enabled = false;
}
if (fileSwitchType == LibraryFileType.LOCAL) {
files = libraryManager.getClientPublicFileList().getFileList();
if (!mc.isIntegratedServerRunning()) {
loadSaveButton.enabled = false;
if (isLoading()) {
loadSaveButton.enabled = ConfigHandler.allowClientsToUploadSkins;
} else {
loadSaveButton.enabled = ConfigHandler.allowClientsToDownloadSkins;
}
}
} else {
loadSaveButton.enabled = true;
}
if (fileSwitchType == LibraryFileType.SERVER_PRIVATE) {
files = libraryManager.getServerPrivateFileList(mc.thePlayer).getFileList();
}
String typeFilter = dropDownList.getListSelectedItem().tag;
ISkinType skinTypeFilter = SkinTypeRegistry.INSTANCE.getSkinTypeFromRegistryName(typeFilter);
lastSkinType = skinTypeFilter;
lastSearchText = searchTextbox.getText();
IGuiListItem selectedItem = fileList.getSelectedListEntry();
if (selectedItem != null) {
// deleteButton.enabled = !((GuiFileListItem)selectedItem).getFile().readOnly;
} else {
// deleteButton.enabled = false;
}
fileList.setSelectedIndex(-1);
fileList.clearList();
if (!(currentFolder.equals("/") | currentFolder.equals(getPrivateRoot(player)))) {
fileList.addListItem(new GuiFileListItem(new LibraryFile("../", "", null, true)));
if (selectedItem != null && ((GuiFileListItem) selectedItem).getFile().fileName.equals("../")) {
fileList.setSelectedIndex(0);
}
}
if (files != null) {
for (int i = 0; i < files.size(); i++) {
LibraryFile file = files.get(i);
if (skinTypeFilter == null | skinTypeFilter == file.skinType) {
if (file.filePath.equals(currentFolder)) {
if (!searchTextbox.getText().equals("")) {
if (file.fileName.toLowerCase().contains(searchTextbox.getText().toLowerCase())) {
fileList.addListItem(new GuiFileListItem(file));
if (selectedItem != null && ((GuiFileListItem) selectedItem).getFile() == file) {
fileList.setSelectedIndex(fileList.getSize() - 1);
}
}
} else {
fileList.addListItem(new GuiFileListItem(file));
if (selectedItem != null && ((GuiFileListItem) selectedItem).getFile() == file) {
fileList.setSelectedIndex(fileList.getSize() - 1);
}
}
}
}
}
}
scrollAmount = scrollbar.getValue();
fileList.setScrollPercentage(scrollbar.getPercentageValue());
for (int i = 0; i < buttonList.size(); i++) {
GuiButton button = (GuiButton) buttonList.get(i);
if (button instanceof GuiIconButton) {
((GuiIconButton) button).drawRollover(mc, mouseX, mouseY);
}
}
if (showModelPreviews()) {
GuiFileListItem item = (GuiFileListItem) fileList.getSelectedListEntry();
if (item != null && !item.getFile().isDirectory()) {
SkinIdentifier identifier = new SkinIdentifier(0, new LibraryFile(item.getFile().getFullName()), 0, null);
Skin skin = ClientSkinCache.INSTANCE.getSkin(identifier, true);
if (skin != null) {
SkinPointer skinPointer = new SkinPointer(identifier);
int listRight = this.width - INVENTORY_WIDTH - PADDING * 5;
listRight = MathHelper.clamp_int(listRight, 0, 200);
listRight += INVENTORY_WIDTH + PADDING * 2 + 10;
int listTop = TITLE_HEIGHT + 14 + PADDING * 2;
int xSize = (this.width - listRight - PADDING) / 2;
int ySize = (this.height - listTop - PADDING) / 2;
float x = listRight + xSize;
float y = listTop + ySize;
float scale = 1F;
scale = 1 * Math.min(xSize, ySize);
ScaledResolution scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
int startX = listRight + PADDING;
int startY = listTop + PADDING;
int tarW = (int) (x + xSize);
int tarH = (int) (y + ySize);
drawRect(startX, startY, tarW, tarH, 0x77777777);
if (scale > 8) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y, 500.0F);
GL11.glScalef(10, 10, -10);
GL11.glRotatef(30, 1, 0, 0);
GL11.glRotatef(45, 0, 1, 0);
float rotation = (float) ((double) System.currentTimeMillis() / 10 % 360);
GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GL11.glEnable(GL11.GL_NORMALIZE);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
ModRenderHelper.enableAlphaBlend();
SkinItemRenderHelper.renderSkinAsItem(skin, skinPointer, true, false, tarW - startX, tarH - startY);
GL11.glPopAttrib();
GL11.glPopMatrix();
}
}
}
}
GL11.glColor4f(1, 1, 1, 1);
if (isDialogOpen()) {
this.dialog.draw(oldMouseX, oldMouseY, partialTickTime);
}
}
use of riskyken.armourersWorkshop.client.gui.controls.GuiIconButton in project Armourers-Workshop by RiskyKen.
the class GuiGlobalLibraryPanelSkinInfo method initGui.
@Override
public void initGui() {
super.initGui();
buttonList.clear();
int panelCenter = this.x + this.width / 2;
buttonBack = new GuiButtonExt(0, panelCenter + 25, this.y + this.height - 25, 80, 20, GuiHelper.getLocalizedControlName(guiName, "back"));
buttonDownload = new GuiButtonExt(0, panelCenter - 105, this.y + this.height - 25, 80, 20, GuiHelper.getLocalizedControlName(guiName, "downloadSkin"));
buttonUserSkins = new GuiButtonExt(0, x + 6, y + 6, 26, 26, "");
buttonEditSkin = new GuiButtonExt(0, x + 6, this.y + this.height - 25, 80, 20, GuiHelper.getLocalizedControlName(guiName, "editSkin"));
buttonLikeSkin = new GuiIconButton(parent, 0, x + 200, this.y + 10, 20, 20, GuiHelper.getLocalizedControlName(guiName, "like"), BUTTON_TEXTURES);
buttonLikeSkin.setIconLocation(102, 0, 16, 16);
buttonUnlikeSkin = new GuiIconButton(parent, 0, x + 200, this.y + 10, 20, 20, GuiHelper.getLocalizedControlName(guiName, "unlike"), BUTTON_TEXTURES);
buttonUnlikeSkin.setIconLocation(102, 17, 16, 16);
updateLikeButtons();
buttonList.add(buttonBack);
buttonList.add(buttonDownload);
buttonList.add(buttonUserSkins);
buttonList.add(buttonEditSkin);
buttonList.add(buttonLikeSkin);
buttonList.add(buttonUnlikeSkin);
}
Aggregations