mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Added tournament name to UI.
This commit is contained in:
@@ -1,69 +1,57 @@
|
|||||||
package forge.screens.home.quest;
|
package forge.screens.home.quest;
|
||||||
|
|
||||||
import java.awt.BasicStroke;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Font;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.RenderingHints;
|
|
||||||
import java.awt.geom.Rectangle2D;
|
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.ScrollPaneConstants;
|
|
||||||
import javax.swing.SwingConstants;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import forge.GuiBase;
|
import forge.GuiBase;
|
||||||
import forge.assets.FSkinProp;
|
import forge.assets.FSkinProp;
|
||||||
import forge.gui.framework.DragCell;
|
import forge.gui.framework.DragCell;
|
||||||
import forge.gui.framework.DragTab;
|
import forge.gui.framework.DragTab;
|
||||||
import forge.gui.framework.EDocID;
|
import forge.gui.framework.EDocID;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.screens.home.EMenuGroup;
|
import forge.screens.home.*;
|
||||||
import forge.screens.home.IVSubmenu;
|
|
||||||
import forge.screens.home.LblHeader;
|
|
||||||
import forge.screens.home.StartButton;
|
|
||||||
import forge.screens.home.VHomeUI;
|
|
||||||
import forge.toolbox.FLabel;
|
import forge.toolbox.FLabel;
|
||||||
import forge.toolbox.FScrollPanel;
|
import forge.toolbox.FScrollPanel;
|
||||||
import forge.toolbox.FSkin;
|
import forge.toolbox.FSkin;
|
||||||
import forge.toolbox.FSkin.Colors;
|
import forge.toolbox.FSkin.Colors;
|
||||||
import forge.toolbox.FSkin.SkinColor;
|
import forge.toolbox.FSkin.SkinColor;
|
||||||
import forge.toolbox.FSkin.SkinImage;
|
import forge.toolbox.FSkin.SkinImage;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assembles Swing components of quest draft submenu singleton.
|
* Assembles Swing components of quest draft submenu singleton.
|
||||||
*
|
*
|
||||||
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
|
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"FieldCanBeLocal"})
|
||||||
public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
||||||
|
|
||||||
SINGLETON_INSTANCE;
|
SINGLETON_INSTANCE;
|
||||||
|
|
||||||
protected static enum Mode {
|
protected enum Mode {
|
||||||
EMPTY,
|
EMPTY,
|
||||||
SELECT_TOURNAMENT,
|
SELECT_TOURNAMENT,
|
||||||
PREPARE_DECK,
|
PREPARE_DECK,
|
||||||
TOURNAMENT_ACTIVE
|
TOURNAMENT_ACTIVE
|
||||||
}
|
}
|
||||||
|
|
||||||
private final DragTab tab = new DragTab("Tournaments");
|
private final DragTab tab = new DragTab("Tournaments");
|
||||||
|
|
||||||
private final LblHeader lblTitle = new LblHeader("Quest Mode: Draft Tournament");
|
private final LblHeader lblTitle = new LblHeader("Quest Mode: Draft Tournament");
|
||||||
|
|
||||||
private final FLabel lblCredits = new FLabel.Builder()
|
private final FLabel lblCredits = new FLabel.Builder()
|
||||||
.icon(FSkin.getIcon(FSkinProp.ICO_QUEST_COINSTACK))
|
.icon(FSkin.getIcon(FSkinProp.ICO_QUEST_COINSTACK))
|
||||||
.iconScaleFactor(0.75)
|
.iconScaleFactor(0.75)
|
||||||
.fontSize(13).build();
|
.fontSize(13).build();
|
||||||
|
|
||||||
private final FScrollPanel pnlTournaments = new FScrollPanel(new MigLayout("insets 0, gap 0, wrap, ax center"), true,
|
private final FScrollPanel pnlTournaments = new FScrollPanel(new MigLayout("insets 0, gap 0, wrap, ax center"), true,
|
||||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
|
|
||||||
private final JLabel lblInfo = new FLabel.Builder().text("Select a tournament to join:")
|
private final JLabel lblInfo = new FLabel.Builder().text("Select a tournament to join:")
|
||||||
.fontStyle(Font.BOLD).fontSize(16)
|
.fontStyle(Font.BOLD).fontSize(16)
|
||||||
.fontAlign(SwingConstants.LEFT).build();
|
.fontAlign(SwingConstants.LEFT).build();
|
||||||
|
|
||||||
private final JLabel lblNoDrafts = new FLabel.Builder().text("There are no tournaments available at this time.")
|
private final JLabel lblNoDrafts = new FLabel.Builder().text("There are no tournaments available at this time.")
|
||||||
.fontStyle(Font.PLAIN).fontSize(16)
|
.fontStyle(Font.PLAIN).fontSize(16)
|
||||||
.fontAlign(SwingConstants.LEFT).build();
|
.fontAlign(SwingConstants.LEFT).build();
|
||||||
@@ -82,28 +70,28 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
.fontSize(15).build();
|
.fontSize(15).build();
|
||||||
private final FLabel lblTokens = new FLabel.Builder()
|
private final FLabel lblTokens = new FLabel.Builder()
|
||||||
.fontSize(15).build();
|
.fontSize(15).build();
|
||||||
|
|
||||||
private final StartButton btnStartDraft = new StartButton();
|
private final StartButton btnStartDraft = new StartButton();
|
||||||
private final StartButton btnStartTournament = new StartButton();
|
private final StartButton btnStartTournament = new StartButton();
|
||||||
private final StartButton btnStartMatch = new StartButton();
|
private final StartButton btnStartMatch = new StartButton();
|
||||||
|
|
||||||
private final FLabel btnEditDeck = new FLabel.ButtonBuilder().text("Edit Deck").fontSize(24).build();
|
private final FLabel btnEditDeck = new FLabel.ButtonBuilder().text("Edit Deck").fontSize(24).build();
|
||||||
private final FLabel btnLeaveTournament = new FLabel.ButtonBuilder().text("Leave Tournament").fontSize(12).build();
|
private final FLabel btnLeaveTournament = new FLabel.ButtonBuilder().text("Leave Tournament").fontSize(12).build();
|
||||||
private final FLabel btnSpendToken = new FLabel.ButtonBuilder().text("Spend Token").fontSize(14).build();
|
private final FLabel btnSpendToken = new FLabel.ButtonBuilder().text("Spend Token").fontSize(14).build();
|
||||||
private final FLabel btnStartMatchSmall = new FLabel.ButtonBuilder().text("Start Next Match").fontSize(12).build();
|
private final FLabel btnStartMatchSmall = new FLabel.ButtonBuilder().text("Start Next Match").fontSize(12).build();
|
||||||
|
|
||||||
private final PnlMatchup[] matchups = new PnlMatchup[8];
|
private final PnlMatchup[] matchups = new PnlMatchup[8];
|
||||||
|
|
||||||
private final JPanel pnlDeckImage;
|
private final JPanel pnlDeckImage;
|
||||||
|
|
||||||
private Mode mode = Mode.SELECT_TOURNAMENT;
|
private Mode mode = Mode.SELECT_TOURNAMENT;
|
||||||
|
|
||||||
private DragCell parentCell;
|
private DragCell parentCell;
|
||||||
|
|
||||||
private VSubmenuQuestDraft() {
|
VSubmenuQuestDraft() {
|
||||||
|
|
||||||
SkinImage avatar = FSkin.getAvatars().get(GuiBase.getInterface().getAvatarCount() - 1);
|
SkinImage avatar = FSkin.getAvatars().get(GuiBase.getInterface().getAvatarCount() - 1);
|
||||||
|
|
||||||
matchups[0] = new PnlMatchup(PnlMatchup.LineDirection.DOWN, PnlMatchup.LineSide.RIGHT, PnlMatchup.BoxSize.SMALL);
|
matchups[0] = new PnlMatchup(PnlMatchup.LineDirection.DOWN, PnlMatchup.LineSide.RIGHT, PnlMatchup.BoxSize.SMALL);
|
||||||
matchups[0].setPlayerOne("Undetermined", avatar);
|
matchups[0].setPlayerOne("Undetermined", avatar);
|
||||||
matchups[0].setPlayerTwo("Undetermined", avatar);
|
matchups[0].setPlayerTwo("Undetermined", avatar);
|
||||||
@@ -135,9 +123,9 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
matchups[7] = new PnlMatchup(PnlMatchup.LineDirection.STRAIGHT, PnlMatchup.LineSide.LEFT, PnlMatchup.BoxSize.LARGE_SINGLE, true);
|
matchups[7] = new PnlMatchup(PnlMatchup.LineDirection.STRAIGHT, PnlMatchup.LineSide.LEFT, PnlMatchup.BoxSize.LARGE_SINGLE, true);
|
||||||
matchups[7].setPlayerOne("Undetermined", avatar);
|
matchups[7].setPlayerOne("Undetermined", avatar);
|
||||||
matchups[7].setPlayerTwo("Undetermined", avatar);
|
matchups[7].setPlayerTwo("Undetermined", avatar);
|
||||||
|
|
||||||
pnlDeckImage = new ProportionalPanel(FSkin.getImage(FSkinProp.IMG_QUEST_DRAFT_DECK), 680, 475);
|
pnlDeckImage = new ProportionalPanel(FSkin.getImage(FSkinProp.IMG_QUEST_DRAFT_DECK), 680, 475);
|
||||||
|
|
||||||
final String constraints = "h 30px!, gap 0 0 0 10px";
|
final String constraints = "h 30px!, gap 0 0 0 10px";
|
||||||
pnlStats.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 0"));
|
pnlStats.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 0"));
|
||||||
pnlStats.add(lblPastResults, "h 30px!, gap 0 0 0 25px");
|
pnlStats.add(lblPastResults, "h 30px!, gap 0 0 0 25px");
|
||||||
@@ -148,83 +136,83 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
pnlStats.add(lblTokens, "h 30px!, gap 0 0 50px 10px, ax center");
|
pnlStats.add(lblTokens, "h 30px!, gap 0 0 50px 10px, ax center");
|
||||||
pnlStats.add(btnSpendToken, "w 150px!, h 40px!, ax center");
|
pnlStats.add(btnSpendToken, "w 150px!, h 40px!, ax center");
|
||||||
pnlStats.setOpaque(false);
|
pnlStats.setOpaque(false);
|
||||||
|
|
||||||
btnSpendToken.setToolTipText("Creates a new tournament that can be played immediately.");
|
btnSpendToken.setToolTipText("Creates a new tournament that can be played immediately.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LblHeader getLblTitle() {
|
public LblHeader getLblTitle() {
|
||||||
return lblTitle;
|
return lblTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLabel getLblCredits() {
|
public FLabel getLblCredits() {
|
||||||
return lblCredits;
|
return lblCredits;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FScrollPanel getPnlTournaments() {
|
public FScrollPanel getPnlTournaments() {
|
||||||
return pnlTournaments;
|
return pnlTournaments;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StartButton getBtnStartDraft() {
|
public StartButton getBtnStartDraft() {
|
||||||
return btnStartDraft;
|
return btnStartDraft;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StartButton getBtnStartTournament() {
|
public StartButton getBtnStartTournament() {
|
||||||
return btnStartTournament;
|
return btnStartTournament;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StartButton getBtnStartMatch() {
|
public StartButton getBtnStartMatch() {
|
||||||
return btnStartMatch;
|
return btnStartMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLabel getBtnStartMatchSmall() {
|
public FLabel getBtnStartMatchSmall() {
|
||||||
return btnStartMatchSmall;
|
return btnStartMatchSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLabel getBtnEditDeck() {
|
public FLabel getBtnEditDeck() {
|
||||||
return btnEditDeck;
|
return btnEditDeck;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLabel getBtnLeaveTournament() {
|
public FLabel getBtnLeaveTournament() {
|
||||||
return btnLeaveTournament;
|
return btnLeaveTournament;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PnlMatchup[] getLblsMatchups() {
|
public PnlMatchup[] getLblsMatchups() {
|
||||||
return matchups;
|
return matchups;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JLabel getLblFirst() {
|
public JLabel getLblFirst() {
|
||||||
return lblFirst;
|
return lblFirst;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JLabel getLblSecond() {
|
public JLabel getLblSecond() {
|
||||||
return lblSecond;
|
return lblSecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JLabel getLblThird() {
|
public JLabel getLblThird() {
|
||||||
return lblThird;
|
return lblThird;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JLabel getLblFourth() {
|
public JLabel getLblFourth() {
|
||||||
return lblFourth;
|
return lblFourth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JLabel getLblTokens() {
|
public JLabel getLblTokens() {
|
||||||
return lblTokens;
|
return lblTokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLabel getBtnSpendToken() {
|
public FLabel getBtnSpendToken() {
|
||||||
return btnSpendToken;
|
return btnSpendToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMode(Mode mode) {
|
public void setMode(Mode mode) {
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mode getMode() {
|
public Mode getMode() {
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EDocID getDocumentID() {
|
public EDocID getDocumentID() {
|
||||||
return EDocID.HOME_QUESTDRAFTS;
|
return EDocID.HOME_QUESTDRAFTS;
|
||||||
@@ -267,9 +255,9 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populate() {
|
public void populate() {
|
||||||
|
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().removeAll();
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().removeAll();
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
|
||||||
case SELECT_TOURNAMENT:
|
case SELECT_TOURNAMENT:
|
||||||
@@ -289,14 +277,14 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlTournaments, "w 88% - 200px!, pushy, growy");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlTournaments, "w 88% - 200px!, pushy, growy");
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlStats, "w 185px!, pushy, growy, gap 4% 4% 0 0");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlStats, "w 185px!, pushy, growy, gap 4% 4% 0 0");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().repaintSelf();
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().repaintSelf();
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().revalidate();
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().revalidate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateSelectTournament() {
|
private void populateSelectTournament() {
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().setLayout(new MigLayout("insets 0, gap 0, ax right, wrap 2"));
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().setLayout(new MigLayout("insets 0, gap 0, ax right, wrap 2"));
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblTitle, "w 80%!, h 40px!, gap 0 0 15px 35px, ax right, span 2");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblTitle, "w 80%!, h 40px!, gap 0 0 15px 35px, ax right, span 2");
|
||||||
@@ -306,8 +294,9 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlStats, "w 185px!, pushy, growy, gap 4% 4% 0 0");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(pnlStats, "w 185px!, pushy, growy, gap 4% 4% 0 0");
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(btnStartDraft, "gap 0 6% 30px 30px, ax center, span 2");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(btnStartDraft, "gap 0 6% 30px 30px, ax center, span 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populatePrepareDeck() {
|
private void populatePrepareDeck() {
|
||||||
|
lblTitle.setText("Quest Mode: Draft Tournament - " + FModel.getQuest().getAchievements().getCurrentDraft().getTitle());
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().setLayout(new MigLayout(
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().setLayout(new MigLayout(
|
||||||
"insets 0, gap 0, ax center, wrap",
|
"insets 0, gap 0, ax center, wrap",
|
||||||
"",
|
"",
|
||||||
@@ -322,19 +311,20 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
btnEditDeck.setFontSize(24);
|
btnEditDeck.setFontSize(24);
|
||||||
btnLeaveTournament.setFontSize(12);
|
btnLeaveTournament.setFontSize(12);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateTournamentActive() {
|
private void populateTournamentActive() {
|
||||||
|
|
||||||
|
lblTitle.setText("Quest Mode: Draft Tournament - " + FModel.getQuest().getAchievements().getCurrentDraft().getTitle());
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().setLayout(new MigLayout("insets 0, gap 0, ax center, wrap 1"));
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().setLayout(new MigLayout("insets 0, gap 0, ax center, wrap 1"));
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblTitle, "w 80%!, h 40px!, gap 20% 0 15px 10px, ax right, span 2");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(lblTitle, "w 80%!, h 40px!, gap 20% 0 15px 10px, ax right, span 2");
|
||||||
|
|
||||||
FScrollPanel panel = new FScrollPanel(new MigLayout("insets 0, gap 0, wrap 4, ax center"), true,
|
FScrollPanel panel = new FScrollPanel(new MigLayout("insets 0, gap 0, wrap 4, ax center"), true,
|
||||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||||
|
|
||||||
String constraintsLeft = "w 350px!, h 196px!, gap 0px 0px 0px 0px, ay center";
|
String constraintsLeft = "w 350px!, h 196px!, gap 0px 0px 0px 0px, ay center";
|
||||||
String constraintsMiddle = "w 350px!, h 392px!, gap 0px 0px 0px 0px, ay center";
|
String constraintsMiddle = "w 350px!, h 392px!, gap 0px 0px 0px 0px, ay center";
|
||||||
String constraintsRight = "w 350px!, h 784px!, gap 0px 0px 0px 0px, ay center";
|
String constraintsRight = "w 350px!, h 784px!, gap 0px 0px 0px 0px, ay center";
|
||||||
|
|
||||||
panel.add(matchups[0], constraintsLeft);
|
panel.add(matchups[0], constraintsLeft);
|
||||||
panel.add(matchups[4], constraintsMiddle + ", span 1 2");
|
panel.add(matchups[4], constraintsMiddle + ", span 1 2");
|
||||||
panel.add(matchups[6], constraintsRight + ", span 1 4");
|
panel.add(matchups[6], constraintsRight + ", span 1 4");
|
||||||
@@ -345,138 +335,138 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
panel.add(matchups[3], constraintsLeft);
|
panel.add(matchups[3], constraintsLeft);
|
||||||
|
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(panel, "gap 0 0 0 0, ax center");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(panel, "gap 0 0 0 0, ax center");
|
||||||
|
|
||||||
btnEditDeck.setFontSize(12);
|
btnEditDeck.setFontSize(12);
|
||||||
|
|
||||||
JPanel bottomButtons = new JPanel(new MigLayout("insets 0, gap 0, wrap 2, ax center"));
|
JPanel bottomButtons = new JPanel(new MigLayout("insets 0, gap 0, wrap 2, ax center"));
|
||||||
|
|
||||||
if (FModel.getQuest().getAchievements().getCurrentDraft().playerHasMatchesLeft()) {
|
if (FModel.getQuest().getAchievements().getCurrentDraft().playerHasMatchesLeft()) {
|
||||||
|
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(btnStartMatch, "gap 0 0 0 20px, ax center");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(btnStartMatch, "gap 0 0 0 20px, ax center");
|
||||||
bottomButtons.add(btnEditDeck, "w 135px!, h 25px!, gap 0 25px 10px 10px, ax right");
|
bottomButtons.add(btnEditDeck, "w 135px!, h 25px!, gap 0 25px 10px 10px, ax right");
|
||||||
bottomButtons.add(btnLeaveTournament, "w 135px!, h 25px!, gap 25px 0 10px 10px, ax right");
|
bottomButtons.add(btnLeaveTournament, "w 135px!, h 25px!, gap 25px 0 10px 10px, ax right");
|
||||||
btnLeaveTournament.setFontSize(12);
|
btnLeaveTournament.setFontSize(12);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(btnLeaveTournament, "w 250px!, h 60px!, gap 0 0 20px 20px, ax center");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(btnLeaveTournament, "w 250px!, h 60px!, gap 0 0 20px 20px, ax center");
|
||||||
bottomButtons.add(btnEditDeck, "w 135px!, h 25px!, gap 0 25px 10px 10px, ax right");
|
bottomButtons.add(btnEditDeck, "w 135px!, h 25px!, gap 0 25px 10px 10px, ax right");
|
||||||
bottomButtons.add(btnStartMatchSmall, "w 135px!, h 25px!, gap 25px 0 10px 10px, ax right");
|
bottomButtons.add(btnStartMatchSmall, "w 135px!, h 25px!, gap 25px 0 10px 10px, ax right");
|
||||||
btnLeaveTournament.setFontSize(24);
|
btnLeaveTournament.setFontSize(24);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(bottomButtons, "w 100%!");
|
VHomeUI.SINGLETON_INSTANCE.getPnlDisplay().add(bottomButtons, "w 100%!");
|
||||||
bottomButtons.setOpaque(false);
|
bottomButtons.setOpaque(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ProportionalPanel extends JPanel {
|
private final class ProportionalPanel extends JPanel {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2098643413467094674L;
|
private static final long serialVersionUID = 2098643413467094674L;
|
||||||
|
|
||||||
private final SkinImage image;
|
private final SkinImage image;
|
||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
|
|
||||||
public ProportionalPanel(SkinImage image, int w, int h) {
|
private ProportionalPanel(SkinImage image, int w, int h) {
|
||||||
this.image = image;
|
this.image = image;
|
||||||
this.w = w;
|
this.w = w;
|
||||||
this.h = h;
|
this.h = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dimension getPreferredSize() {
|
public Dimension getPreferredSize() {
|
||||||
return new ProportionalDimension(super.getSize(), w, h);
|
return new ProportionalDimension(super.getSize(), w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paintComponent(final Graphics g) {
|
public void paintComponent(final Graphics g) {
|
||||||
|
|
||||||
Graphics2D g2d = (Graphics2D) g.create();
|
Graphics2D g2d = (Graphics2D) g.create();
|
||||||
|
|
||||||
Dimension srcSize = image.getSizeForPaint(g2d);
|
Dimension srcSize = image.getSizeForPaint(g2d);
|
||||||
int wSrc = srcSize.width;
|
int wSrc = srcSize.width;
|
||||||
int hSrc = srcSize.height;
|
int hSrc = srcSize.height;
|
||||||
|
|
||||||
int wImg = getPreferredSize().width;
|
int wImg = getPreferredSize().width;
|
||||||
int hImg = getPreferredSize().height;
|
int hImg = getPreferredSize().height;
|
||||||
|
|
||||||
int xOffset = (getSize().width - wImg) / 2;
|
int xOffset = (getSize().width - wImg) / 2;
|
||||||
|
|
||||||
RenderingHints hints = new RenderingHints(
|
RenderingHints hints = new RenderingHints(
|
||||||
RenderingHints.KEY_INTERPOLATION,
|
RenderingHints.KEY_INTERPOLATION,
|
||||||
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||||
g2d.setRenderingHints(hints);
|
g2d.setRenderingHints(hints);
|
||||||
|
|
||||||
FSkin.drawImage(g2d, image,
|
FSkin.drawImage(g2d, image,
|
||||||
xOffset, 0, wImg + xOffset, hImg, // Destination
|
xOffset, 0, wImg + xOffset, hImg, // Destination
|
||||||
0, 0, wSrc, hSrc); // Source
|
0, 0, wSrc, hSrc); // Source
|
||||||
|
|
||||||
g2d.dispose();
|
g2d.dispose();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ProportionalDimension extends Dimension {
|
private final class ProportionalDimension extends Dimension {
|
||||||
|
|
||||||
private static final long serialVersionUID = -428811386088062426L;
|
private static final long serialVersionUID = -428811386088062426L;
|
||||||
|
|
||||||
public ProportionalDimension(Dimension d, int w, int h) {
|
private ProportionalDimension(Dimension d, int w, int h) {
|
||||||
|
|
||||||
double containerAspect = (double) d.width / d.height;
|
double containerAspect = (double) d.width / d.height;
|
||||||
double imageAspect = (double) w / h;
|
double imageAspect = (double) w / h;
|
||||||
double scale = 1.0;
|
double scale = 1.0;
|
||||||
|
|
||||||
if (imageAspect < containerAspect) {
|
if (imageAspect < containerAspect) {
|
||||||
scale = (double) d.height / h;
|
scale = (double) d.height / h;
|
||||||
} else if (imageAspect > containerAspect) {
|
} else if (imageAspect > containerAspect) {
|
||||||
scale = (double) d.width / w;
|
scale = (double) d.width / w;
|
||||||
}
|
}
|
||||||
|
|
||||||
height = (int) (((double) h) * scale);
|
height = (int) (((double) h) * scale);
|
||||||
width = (int) (((double) w) * scale);
|
width = (int) (((double) w) * scale);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PnlMatchup extends JPanel {
|
public static class PnlMatchup extends JPanel {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2055607559359905216L;
|
private static final long serialVersionUID = 2055607559359905216L;
|
||||||
|
|
||||||
private static enum LineDirection {
|
private enum LineDirection {
|
||||||
UP, DOWN, STRAIGHT, NONE
|
UP, DOWN, STRAIGHT, NONE
|
||||||
}
|
}
|
||||||
|
|
||||||
private static enum LineSide {
|
private enum LineSide {
|
||||||
LEFT, RIGHT, BOTH
|
LEFT, RIGHT, BOTH
|
||||||
}
|
}
|
||||||
|
|
||||||
private static enum BoxSize {
|
private enum BoxSize {
|
||||||
SMALL, MEDIUM, LARGE, LARGE_SINGLE
|
SMALL, MEDIUM, LARGE, LARGE_SINGLE
|
||||||
}
|
}
|
||||||
|
|
||||||
private final SkinColor clr1 = FSkin.getColor(FSkin.Colors.CLR_THEME2).alphaColor(255);
|
private final SkinColor clr1 = FSkin.getColor(FSkin.Colors.CLR_THEME2).alphaColor(255);
|
||||||
private final SkinColor clr2 = FSkin.getColor(FSkin.Colors.CLR_THEME).alphaColor(100);
|
private final SkinColor clr2 = FSkin.getColor(FSkin.Colors.CLR_THEME).alphaColor(100);
|
||||||
private final SkinColor clr3 = FSkin.getColor(FSkin.Colors.CLR_THEME).alphaColor(100);
|
private final SkinColor clr3 = FSkin.getColor(FSkin.Colors.CLR_THEME).alphaColor(100);
|
||||||
|
|
||||||
private final int wImg = 55;
|
private final int wImg = 55;
|
||||||
private final int hImg = 55;
|
private final int hImg = 55;
|
||||||
|
|
||||||
private SkinImage img1;
|
private SkinImage img1;
|
||||||
private SkinImage img2;
|
private SkinImage img2;
|
||||||
|
|
||||||
private FLabel name1 = new FLabel.Builder().fontSize(14).fontAlign(SwingConstants.LEFT).build();
|
private FLabel name1 = new FLabel.Builder().fontSize(14).fontAlign(SwingConstants.LEFT).build();
|
||||||
private FLabel name2 = new FLabel.Builder().fontSize(14).fontAlign(SwingConstants.LEFT).build();
|
private FLabel name2 = new FLabel.Builder().fontSize(14).fontAlign(SwingConstants.LEFT).build();
|
||||||
|
|
||||||
private LineDirection lineDir;
|
private LineDirection lineDir;
|
||||||
private LineSide lineSide;
|
private LineSide lineSide;
|
||||||
private BoxSize size;
|
private BoxSize size;
|
||||||
|
|
||||||
private boolean singleBox;
|
private boolean singleBox;
|
||||||
|
|
||||||
public PnlMatchup(LineDirection dir, LineSide side, BoxSize size, boolean singleBox) {
|
public PnlMatchup(LineDirection dir, LineSide side, BoxSize size, boolean singleBox) {
|
||||||
this.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
this.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
||||||
if (!singleBox) {
|
if (!singleBox) {
|
||||||
@@ -492,16 +482,16 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
name1.setVerticalAlignment(SwingConstants.BOTTOM);
|
name1.setVerticalAlignment(SwingConstants.BOTTOM);
|
||||||
name2.setVerticalAlignment(SwingConstants.TOP);
|
name2.setVerticalAlignment(SwingConstants.TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PnlMatchup(LineDirection dir, LineSide side, BoxSize size) {
|
public PnlMatchup(LineDirection dir, LineSide side, BoxSize size) {
|
||||||
this(dir, side, size, false);
|
this(dir, side, size, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayerOne(final String name, final SkinImage image) {
|
public void setPlayerOne(final String name, final SkinImage image) {
|
||||||
name1.setText(name);
|
name1.setText(name);
|
||||||
img1 = image;
|
img1 = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayerTwo(final String name, final SkinImage image) {
|
public void setPlayerTwo(final String name, final SkinImage image) {
|
||||||
name2.setText(name);
|
name2.setText(name);
|
||||||
img2 = image;
|
img2 = image;
|
||||||
@@ -509,12 +499,12 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paintComponent(final Graphics g) {
|
public void paintComponent(final Graphics g) {
|
||||||
|
|
||||||
Graphics2D g2d = (Graphics2D) g.create();
|
Graphics2D g2d = (Graphics2D) g.create();
|
||||||
|
|
||||||
int width = getWidth() - 100;
|
int width = getWidth() - 100;
|
||||||
int height = getHeight() - 40;
|
int height = getHeight() - 40;
|
||||||
|
|
||||||
if (size.equals(BoxSize.MEDIUM)) {
|
if (size.equals(BoxSize.MEDIUM)) {
|
||||||
height -= 196;
|
height -= 196;
|
||||||
g2d.translate(0, 98);
|
g2d.translate(0, 98);
|
||||||
@@ -532,9 +522,9 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
if (lineSide.equals(LineSide.LEFT) || lineSide.equals(LineSide.BOTH)) {
|
if (lineSide.equals(LineSide.LEFT) || lineSide.equals(LineSide.BOTH)) {
|
||||||
g2d.drawLine(0, height / 2 + 20, 47, height / 2 + 20);
|
g2d.drawLine(0, height / 2 + 20, 47, height / 2 + 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
g2d.translate(50, 20);
|
g2d.translate(50, 20);
|
||||||
|
|
||||||
if (lineSide.equals(LineSide.RIGHT) || lineSide.equals(LineSide.BOTH)) {
|
if (lineSide.equals(LineSide.RIGHT) || lineSide.equals(LineSide.BOTH)) {
|
||||||
g2d.drawLine(width, height / 2, width + 65, height / 2);
|
g2d.drawLine(width, height / 2, width + 65, height / 2);
|
||||||
if (lineDir.equals(LineDirection.DOWN)) {
|
if (lineDir.equals(LineDirection.DOWN)) {
|
||||||
@@ -545,17 +535,17 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
g2d.drawLine(width, height / 2, width + 45, height / 2);
|
g2d.drawLine(width, height / 2, width + 45, height / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FSkin.setGraphicsGradientPaint(g2d, 0, 0, clr3, 0, height / 2 + 15 , clr2);
|
FSkin.setGraphicsGradientPaint(g2d, 0, 0, clr3, 0, height / 2 + 15 , clr2);
|
||||||
g2d.fillRect(0, 0, width, height / 2);
|
g2d.fillRect(0, 0, width, height / 2);
|
||||||
|
|
||||||
FSkin.setGraphicsGradientPaint(g2d, 0, height / 2 - 15, clr2, 0, height, clr3);
|
FSkin.setGraphicsGradientPaint(g2d, 0, height / 2 - 15, clr2, 0, height, clr3);
|
||||||
g2d.fillRect(0, height / 2, width, height / 2);
|
g2d.fillRect(0, height / 2, width, height / 2);
|
||||||
|
|
||||||
g2d.setColor(clr1.getColor());
|
g2d.setColor(clr1.getColor());
|
||||||
g2d.setStroke(new BasicStroke(4));
|
g2d.setStroke(new BasicStroke(4));
|
||||||
g2d.drawRect(1, 1, width - 2, height - 2);
|
g2d.drawRect(1, 1, width - 2, height - 2);
|
||||||
|
|
||||||
if (!singleBox) {
|
if (!singleBox) {
|
||||||
FSkin.setGraphicsGradientPaint(g2d, 70, height / 2 - 1, clr1.alphaColor(0), width, height / 2 - 1, clr1);
|
FSkin.setGraphicsGradientPaint(g2d, 70, height / 2 - 1, clr1.alphaColor(0), width, height / 2 - 1, clr1);
|
||||||
g2d.setStroke(new BasicStroke(2));
|
g2d.setStroke(new BasicStroke(2));
|
||||||
@@ -572,9 +562,9 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
|
|
||||||
// Padding here
|
// Padding here
|
||||||
g2d.translate(12, 12);
|
g2d.translate(12, 12);
|
||||||
|
|
||||||
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||||
|
|
||||||
Dimension srcSize = img1.getSizeForPaint(g2d);
|
Dimension srcSize = img1.getSizeForPaint(g2d);
|
||||||
int wSrc = srcSize.width;
|
int wSrc = srcSize.width;
|
||||||
int hSrc = srcSize.height;
|
int hSrc = srcSize.height;
|
||||||
@@ -582,7 +572,7 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
FSkin.drawImage(g2d, img1,
|
FSkin.drawImage(g2d, img1,
|
||||||
0, 0, wImg, hImg, // Destination
|
0, 0, wImg, hImg, // Destination
|
||||||
0, 0, wSrc, hSrc); // Source
|
0, 0, wSrc, hSrc); // Source
|
||||||
|
|
||||||
g2d.translate(0, 77);
|
g2d.translate(0, 77);
|
||||||
|
|
||||||
if (!singleBox) {
|
if (!singleBox) {
|
||||||
@@ -592,9 +582,9 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
g2d.dispose();
|
g2d.dispose();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user