/** Empty constructor for externalization. */ public PlayerOptions() { waveCounter = new GenericTexture(); waveCounter.setVisible(false); waveCounter.setDrawAlphaChannel(true); waveCounter.setUrl("http://i.imgur.com/fWiJl.png"); waveCounter.setWidth(125); waveCounter.setHeight(125); waveCounter.setAnchor(WidgetAnchor.TOP_RIGHT); waveCounter.shiftXPos(-85); waveCounter.shiftYPos(-35); waveCounter.setPriority(RenderPriority.High); waveCounterWave = new GenericLabel("Wave: 0"); waveCounterWave.setVisible(false); waveCounterWave.setAnchor(WidgetAnchor.TOP_RIGHT); waveCounterWave.setAlign(WidgetAnchor.CENTER_CENTER); waveCounterWave.shiftXPos(-35); waveCounterWave.shiftYPos(37); waveCounterWave.setTextColor(new Color(150, 0, 10)); waveCounterWave.setHeight(10); waveCounterWave.setWidth(10); waveCounterZombies = new GenericLabel("0"); waveCounterZombies.setVisible(false); waveCounterZombies.setAnchor(WidgetAnchor.TOP_RIGHT); waveCounterZombies.setAlign(WidgetAnchor.CENTER_CENTER); waveCounterZombies.shiftXPos(-40); waveCounterZombies.shiftYPos(18); waveCounterZombies.setTextColor(new Color(150, 0, 10)); waveCounterZombies.setScale(2); waveCounterZombies.setHeight(20); waveCounterZombies.setWidth(20); }
private void addBackground() { GenericTexture texture = new GenericTexture(); texture.setUrl( AmbientSpout.callback .getConfig() .getString( "Settings.BackgroundImage", "http://dl.dropbox.com/u/43693599/AmbientSpout.png")); texture.setAnchor(WidgetAnchor.TOP_LEFT); texture.setWidth(427).setHeight(240); texture.setPriority(RenderPriority.High); this.attachWidget(AmbientSpout.callback, texture); }
public static void open( Plugin plugin, SpoutPlayer splayer) { // method used to open the GUI for a player GenericTexture face = new GenericTexture(); int width = splayer.getCurrentScreen().getWidth(); int height = splayer.getCurrentScreen().getHeight(); face.setUrl( "http://landoflegend.net/forums/images/CoderGreen/site_logo.png"); // this must be a png // image face.setWidth(splayer.getCurrentScreen().getWidth() / 8) .setHeight( splayer.getCurrentScreen().getHeight() / 8); // you can manipulate the size of most widgets // face.setAnchor(WidgetAnchor.CENTER_CENTER); // the enum type WidgetAnchor provides a // convenience method for placing widgets face.setX(width / 2 - face.getWidth() / 2); face.setY(height - face.getHeight() - 5); // GenericButton button = new GenericButton("The Drogans?!"); // button.setWidth(80); // button.setHeight(20); // button.setX(width/4); // button.setY(height/2); // button.setAnchor(WidgetAnchor.CENTER_LEFT); GenericListWidget scrollTry = new GenericListWidget(); ListWidgetItem item = new ListWidgetItem("Drogans", "Drogans"); scrollTry.addItem(item); scrollTry.setX(width / 4); scrollTry.setY(height / 2); GenericLabel label = new GenericLabel("Clans - First try"); // label.setAnchor(WidgetAnchor.CENTER_RIGHT); label.setWidth(80); label.setHeight(40); label.setScale(1); label.setX(width / 2 - label.getWidth() / 2); label.setY(20); GenericPopup popup = new GenericPopup(); // create the popup (A popup will "free the mouse") popup.attachWidget(plugin, face); // attach any widgets we want to the popup popup.attachWidget(plugin, scrollTry); popup.attachWidget(plugin, label); // button.set splayer.closeActiveWindow(); splayer.getMainScreen().attachPopupScreen(popup); // attach the popup to the players screen }
public HeroesSelectGUI(HeroesHUD plugin, SpoutPlayer spoutp) { this.plugin = plugin; this.spoutp = spoutp; GenericTexture backgroundMain = new GenericTexture(); int screenWidth = spoutp.getMainScreen().getWidth(); int screenHeight = spoutp.getMainScreen().getHeight(); int x = (screenWidth / 2) - 170; int y = (screenHeight / 2) - 100; // BackgroundMain! backgroundMain.setX(x).setY(y); backgroundMain.setWidth(340).setHeight(200); backgroundMain.setUrl(plugin.HeroesSelectGuiBackgroundMain); backgroundMain.setFixed(false); backgroundMain.setPriority(RenderPriority.Highest); // Button1 Main button1 = new GenericButton(); button1.setText("Primary"); button1 .setWidth(GenericLabel.getStringWidth(button1.getText()) + 5 + 30) .setHeight(GenericLabel.getStringHeight(button1.getText()) + 5); button1.setX(backgroundMain.getX() + 20); button1.setY(backgroundMain.getY() + 65); button1.setDirty(true); button1.setAutoDirty(true); // Button2 Main button2 = new GenericButton(); button2.setText("Profession"); button2 .setWidth(GenericLabel.getStringWidth(button2.getText()) + 5 + 30) .setHeight(GenericLabel.getStringHeight(button2.getText()) + 5); button2.setX(backgroundMain.getX() + 235); button2.setY(backgroundMain.getY() + 65); button2.setDirty(true); button2.setAutoDirty(true); super.attachWidgets(plugin, backgroundMain, button1, button2); super.setAnchor(WidgetAnchor.TOP_LEFT); }
public void openTabScreen() { tabHeader = new GenericTexture("http://i.imgur.com/t8CPF.png"); tabHeader.setDrawAlphaChannel(true); tabHeader.setAnchor(WidgetAnchor.CENTER_CENTER); tabHeader.setWidth(212); tabHeader.setHeight(8); tabHeader.shiftYPos(-100); tabHeader.shiftXPos(tabHeader.getWidth() / -2 + 20); @SuppressWarnings({"unchecked", "rawtypes"}) List<PlayerStats> sortedStats = new ArrayList(ZArena.getInstance().getGameHandler().getPlayerStats().values()); Collections.sort(sortedStats); int index = 0; for (PlayerStats stats : sortedStats) { GenericTexture part = new GenericTexture("http://i.imgur.com/qvrX8.png"); part.setDrawAlphaChannel(true); part.setAnchor(WidgetAnchor.CENTER_CENTER); part.setWidth(255); part.setHeight(15); part.shiftYPos(-90 + index * 15); part.shiftXPos(part.getWidth() / -2); part.setPriority(RenderPriority.Low); tabMain.add(part); Player player = stats.getPlayer(); GenericLabel name = new GenericLabel(player.getName()); name.setAnchor(WidgetAnchor.CENTER_CENTER); name.setAlign(WidgetAnchor.TOP_CENTER); name.setHeight(11); name.setWidth(10); name.shiftYPos(-86 + index * 15); name.shiftXPos(-75); GenericLabel kills = new GenericLabel(stats.getKills() + ""); kills.setAnchor(WidgetAnchor.CENTER_CENTER); kills.setAlign(WidgetAnchor.TOP_CENTER); kills.setHeight(11); kills.setWidth(10); kills.shiftYPos(-86 + index * 15); GenericLabel money = new GenericLabel("$" + stats.getMoney()); money.setAnchor(WidgetAnchor.CENTER_CENTER); money.setAlign(WidgetAnchor.TOP_CENTER); money.setHeight(11); money.setWidth(10); money.shiftYPos(-86 + index * 15); money.shiftXPos(50); GenericLabel health = new GenericLabel((stats.isAlive()) ? player.getHealth() + "" : "DEAD"); health.setTextColor( (!stats.isAlive()) ? new Color(150, 0, 0) : (player.getHealth() > 15) ? new Color(0, 200, 0) : (player.getHealth() > 10) ? new Color(255, 255, 0) : (player.getHealth() > 5) ? new Color(255, 140, 0) : new Color(200, 0, 0)); health.setAnchor(WidgetAnchor.CENTER_CENTER); health.setAlign(WidgetAnchor.TOP_CENTER); health.setHeight(11); health.setWidth(10); health.shiftYPos(-86 + index * 15); health.shiftXPos(100); tabText.add(name); tabText.add(money); tabText.add(kills); tabText.add(health); index++; } ((SpoutPlayer) Bukkit.getPlayer(player)) .getMainScreen() .attachWidget(ZArena.getInstance(), tabHeader); for (GenericTexture part : tabMain) { ((SpoutPlayer) Bukkit.getPlayer(player)) .getMainScreen() .attachWidget(ZArena.getInstance(), part); } for (GenericLabel text : tabText) { ((SpoutPlayer) Bukkit.getPlayer(player)) .getMainScreen() .attachWidget(ZArena.getInstance(), text); } }
public RecordPlayerGUI(SpoutPlayer player, SpoutBlock block) { this.player = player; this.block = block; GenericTexture border = new GenericTexture("machinegui.png"); border.setX(-88).setY(-83); border.setPriority(RenderPriority.Highest); border.setWidth(176).setHeight(166); border.setFixed(true); border.setAnchor(WidgetAnchor.CENTER_CENTER); recordSlot = new RecordSlot(this); recordSlot.setX(19).setY(-34); recordSlot.setWidth(16).setHeight(16); recordSlot.setPriority(RenderPriority.Normal); recordSlot.setFixed(true); recordSlot.setAnchor(WidgetAnchor.CENTER_CENTER); needleSlot = new NeedleSlot(this); needleSlot.setX(-35).setY(-63); needleSlot.setWidth(16).setHeight(16); needleSlot.setPriority(RenderPriority.Normal); needleSlot.setFixed(true); needleSlot.setAnchor(WidgetAnchor.CENTER_CENTER); // Select button PlayButton playButton = new PlayButton(block); playButton.setX(-60).setY(-35); playButton.setWidth(60).setHeight(20); playButton.setPriority(RenderPriority.Normal); playButton.setFixed(true); playButton.setAnchor(WidgetAnchor.CENTER_CENTER); setTransparent(true); attachWidgets(JukeIt.getInstance(), border, recordSlot, needleSlot, playButton); int xposition = 0; int yposition = 58; // i know theres some kind of cool math equation to do this, but i cant remember how to figure // it out. doin it the cheap way for (int i = 0; i < 36; i++) { PlayerInventorySlot slot = new PlayerInventorySlot(player, i); if (xposition == 9) xposition = 0; if (i > 8) yposition = 0; if (i > 17) yposition = 18; if (i > 26) yposition = 36; slot.setY(1 + yposition); slot.setX(-80 + (xposition * 18)); slot.setWidth(16).setHeight(16); slot.setPriority(RenderPriority.Normal); slot.setFixed(true); slot.setAnchor(WidgetAnchor.CENTER_CENTER); playerSlots[i] = slot; this.attachWidget(JukeIt.getInstance(), playerSlots[i]); xposition++; } updatePlayerSlots(); }