mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Support displaying tournaments
Make display of credits number consistent
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -19625,6 +19625,7 @@ forge-gui/src/main/java/forge/properties/ForgeConstants.java -text
|
|||||||
forge-gui/src/main/java/forge/properties/ForgePreferences.java svneol=native#text/plain
|
forge-gui/src/main/java/forge/properties/ForgePreferences.java svneol=native#text/plain
|
||||||
forge-gui/src/main/java/forge/properties/package-info.java svneol=native#text/plain
|
forge-gui/src/main/java/forge/properties/package-info.java svneol=native#text/plain
|
||||||
forge-gui/src/main/java/forge/quest/BoosterUtils.java svneol=native#text/plain
|
forge-gui/src/main/java/forge/quest/BoosterUtils.java svneol=native#text/plain
|
||||||
|
forge-gui/src/main/java/forge/quest/IQuestEvent.java -text
|
||||||
forge-gui/src/main/java/forge/quest/IQuestRewardCard.java -text
|
forge-gui/src/main/java/forge/quest/IQuestRewardCard.java -text
|
||||||
forge-gui/src/main/java/forge/quest/IQuestTournamentView.java -text
|
forge-gui/src/main/java/forge/quest/IQuestTournamentView.java -text
|
||||||
forge-gui/src/main/java/forge/quest/IVQuestStats.java -text
|
forge-gui/src/main/java/forge/quest/IVQuestStats.java -text
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import forge.itemmanager.views.ItemTableColumn;
|
|||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.quest.QuestController;
|
import forge.quest.QuestController;
|
||||||
import forge.quest.QuestSpellShop;
|
import forge.quest.QuestSpellShop;
|
||||||
|
import forge.quest.QuestUtil;
|
||||||
import forge.screens.deckeditor.views.*;
|
import forge.screens.deckeditor.views.*;
|
||||||
import forge.screens.home.quest.CSubmenuQuestDecks;
|
import forge.screens.home.quest.CSubmenuQuestDecks;
|
||||||
import forge.screens.match.controllers.CDetailPicture;
|
import forge.screens.match.controllers.CDetailPicture;
|
||||||
@@ -179,7 +180,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateCreditsLabel() {
|
private void updateCreditsLabel() {
|
||||||
this.creditsLabel.setText("Credits: " + this.questData.getAssets().getCredits());
|
this.creditsLabel.setText("Credits: " + QuestUtil.formatCredits(this.questData.getAssets().getCredits()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -3,14 +3,11 @@ package forge.screens.home.quest;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.text.DecimalFormat;
|
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.model.FModel;
|
|
||||||
import forge.quest.QuestEventDraft;
|
import forge.quest.QuestEventDraft;
|
||||||
import forge.quest.QuestUtil;
|
import forge.quest.QuestUtil;
|
||||||
import forge.toolbox.FRadioButton;
|
import forge.toolbox.FRadioButton;
|
||||||
@@ -19,9 +16,7 @@ import forge.toolbox.FSkin.SkinColor;
|
|||||||
import forge.toolbox.FTextArea;
|
import forge.toolbox.FTextArea;
|
||||||
|
|
||||||
public class PnlDraftEvent extends JPanel {
|
public class PnlDraftEvent extends JPanel {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7348489421342846451L;
|
private static final long serialVersionUID = 7348489421342846451L;
|
||||||
private static final DecimalFormat NUMBER_FORMATTER = new DecimalFormat("#,###");
|
|
||||||
|
|
||||||
private final Color clr2 = new Color(255, 255, 0, 0);
|
private final Color clr2 = new Color(255, 255, 0, 0);
|
||||||
private final SkinColor clr3 = FSkin.getColor(FSkin.Colors.CLR_THEME2).alphaColor(200);
|
private final SkinColor clr3 = FSkin.getColor(FSkin.Colors.CLR_THEME2).alphaColor(200);
|
||||||
@@ -29,7 +24,6 @@ public class PnlDraftEvent extends JPanel {
|
|||||||
private final FRadioButton radButton;
|
private final FRadioButton radButton;
|
||||||
|
|
||||||
public PnlDraftEvent(final QuestEventDraft event) {
|
public PnlDraftEvent(final QuestEventDraft event) {
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
radButton = new FRadioButton(event.getTitle());
|
radButton = new FRadioButton(event.getTitle());
|
||||||
@@ -39,18 +33,10 @@ public class PnlDraftEvent extends JPanel {
|
|||||||
final FTextArea eventBoosters = new FTextArea();
|
final FTextArea eventBoosters = new FTextArea();
|
||||||
final FTextArea eventFee = new FTextArea();
|
final FTextArea eventFee = new FTextArea();
|
||||||
|
|
||||||
String boosterList = "";
|
eventBoosters.setText(event.getBoosterList());
|
||||||
for (int i = 0; i < event.getBoosterConfiguration().length; i++) {
|
|
||||||
boosterList += FModel.getMagicDb().getEditions().get(event.getBoosterConfiguration()[i]).getName();
|
|
||||||
if (i != event.getBoosterConfiguration().length - 1) {
|
|
||||||
boosterList += " | ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
eventBoosters.setText(boosterList);
|
|
||||||
eventBoosters.setFont(FSkin.getFont(12));
|
eventBoosters.setFont(FSkin.getFont(12));
|
||||||
|
|
||||||
eventFee.setText(NUMBER_FORMATTER.format(event.getEntryFee()) + " Credit Entry Fee");
|
eventFee.setText(QuestUtil.formatCredits(event.getEntryFee()) + " Credit Entry Fee");
|
||||||
eventFee.setFont(FSkin.getFont(12));
|
eventFee.setFont(FSkin.getFont(12));
|
||||||
|
|
||||||
radButton.addChangeListener(new ChangeListener() {
|
radButton.addChangeListener(new ChangeListener() {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public enum VSubmenuQuestDraft implements IVSubmenu<CSubmenuQuestDraft>, IQuestT
|
|||||||
|
|
||||||
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.8f)
|
.iconScaleFactor(0.75f)
|
||||||
.fontSize(14).build();
|
.fontSize(14).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,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package forge.screens.home.quest;
|
|||||||
|
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.quest.QuestController;
|
import forge.quest.QuestController;
|
||||||
|
import forge.quest.QuestUtil;
|
||||||
import forge.quest.bazaar.IQuestBazaarItem;
|
import forge.quest.bazaar.IQuestBazaarItem;
|
||||||
import forge.quest.bazaar.QuestStallDefinition;
|
import forge.quest.bazaar.QuestStallDefinition;
|
||||||
import forge.quest.data.QuestAssets;
|
import forge.quest.data.QuestAssets;
|
||||||
@@ -146,7 +147,7 @@ public class ViewStall extends JPanel {
|
|||||||
final QuestAssets qS = qData.getAssets();
|
final QuestAssets qS = qData.getAssets();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Credits: ");
|
sb.append("Credits: ");
|
||||||
sb.append(qS.getCredits());
|
sb.append(QuestUtil.formatCredits(qS.getCredits()));
|
||||||
sb.append(" Life: ");
|
sb.append(" Life: ");
|
||||||
sb.append(qS.getLife(qData.getMode()));
|
sb.append(qS.getLife(qData.getMode()));
|
||||||
sb.append(" Level: ");
|
sb.append(" Level: ");
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class QuestBazaarScreen extends TabPageScreen<QuestBazaarScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final QuestAssets qS = qData.getAssets();
|
final QuestAssets qS = qData.getAssets();
|
||||||
lblCredits.setText("Credits: " + qS.getCredits());
|
lblCredits.setText("Credits: " + QuestUtil.formatCredits(qS.getCredits()));
|
||||||
lblLife.setText("Life: " + qS.getLife(qData.getMode()));
|
lblLife.setText("Life: " + qS.getLife(qData.getMode()));
|
||||||
|
|
||||||
final List<IQuestBazaarItem> items = qData.getBazaar().getItems(qData, stallDef.getName());
|
final List<IQuestBazaarItem> items = qData.getBazaar().getItems(qData, stallDef.getName());
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import forge.assets.FSkinColor;
|
|||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
import forge.assets.ImageCache;
|
import forge.assets.ImageCache;
|
||||||
import forge.quest.QuestEvent;
|
import forge.quest.IQuestEvent;
|
||||||
import forge.quest.QuestUtil;
|
|
||||||
import forge.screens.settings.SettingsScreen;
|
import forge.screens.settings.SettingsScreen;
|
||||||
import forge.toolbox.FDisplayObject;
|
import forge.toolbox.FDisplayObject;
|
||||||
import forge.toolbox.FEvent;
|
import forge.toolbox.FEvent;
|
||||||
@@ -36,20 +35,20 @@ class QuestEventPanel extends FDisplayObject {
|
|||||||
private static final float RADIO_BUTTON_RADIUS = Utils.AVG_FINGER_WIDTH / 4;
|
private static final float RADIO_BUTTON_RADIUS = Utils.AVG_FINGER_WIDTH / 4;
|
||||||
private static final float MIN_HEIGHT = 2 * Utils.AVG_FINGER_HEIGHT;
|
private static final float MIN_HEIGHT = 2 * Utils.AVG_FINGER_HEIGHT;
|
||||||
|
|
||||||
private final QuestEvent event;
|
private final IQuestEvent event;
|
||||||
private final FImage img;
|
private final FImage img;
|
||||||
private Container container;
|
private Container container;
|
||||||
|
|
||||||
public QuestEventPanel(final QuestEvent e0, final Container container0) {
|
public QuestEventPanel(final IQuestEvent e0, final Container container0) {
|
||||||
event = e0;
|
event = e0;
|
||||||
img = ImageCache.getIcon(e0);
|
img = event.hasImage() ? ImageCache.getIcon(e0) : null;
|
||||||
container = container0;
|
container = container0;
|
||||||
if (container.selectedPanel == null) {
|
if (container.selectedPanel == null) {
|
||||||
setSelected(true); //select first panel in container by default
|
setSelected(true); //select first panel in container by default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public QuestEvent getEvent() {
|
public IQuestEvent getEvent() {
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +63,7 @@ class QuestEventPanel extends FDisplayObject {
|
|||||||
}
|
}
|
||||||
else if (selected0) {
|
else if (selected0) {
|
||||||
container.selectedPanel = this;
|
container.selectedPanel = this;
|
||||||
QuestUtil.setEvent(event);
|
event.select();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,9 +82,11 @@ class QuestEventPanel extends FDisplayObject {
|
|||||||
float h = getHeight();
|
float h = getHeight();
|
||||||
g.fillGradientRect(GRADIENT_LEFT_COLOR, GRADIENT_RIGHT_COLOR, false, 0, 0, w, h);
|
g.fillGradientRect(GRADIENT_LEFT_COLOR, GRADIENT_RIGHT_COLOR, false, 0, 0, w, h);
|
||||||
|
|
||||||
//draw icon
|
|
||||||
float x = PADDING;
|
float x = PADDING;
|
||||||
float y = PADDING;
|
float y = PADDING;
|
||||||
|
|
||||||
|
//draw image if needed
|
||||||
|
if (img != null) {
|
||||||
float imageSize = h - 2 * PADDING;
|
float imageSize = h - 2 * PADDING;
|
||||||
float maxImageSize = w / 3;
|
float maxImageSize = w / 3;
|
||||||
if (imageSize > maxImageSize) { //ensure image doesn't take up too much space
|
if (imageSize > maxImageSize) { //ensure image doesn't take up too much space
|
||||||
@@ -94,11 +95,14 @@ class QuestEventPanel extends FDisplayObject {
|
|||||||
}
|
}
|
||||||
g.drawImage(img, x, y, imageSize, imageSize);
|
g.drawImage(img, x, y, imageSize, imageSize);
|
||||||
|
|
||||||
//draw title
|
//shift title to the right of and slightly below the top of the icon
|
||||||
x += imageSize + 2 * PADDING;
|
x += imageSize + 2 * PADDING;
|
||||||
y = 2 * PADDING;
|
y = 2 * PADDING;
|
||||||
|
}
|
||||||
|
|
||||||
|
//draw title
|
||||||
w -= x + 2 * (RADIO_BUTTON_RADIUS + PADDING);
|
w -= x + 2 * (RADIO_BUTTON_RADIUS + PADDING);
|
||||||
String title = event.getTitle() + " (" + event.getDifficulty().getTitle() + ")";
|
String title = event.getFullTitle();
|
||||||
g.drawText(title, TITLE_FONT, TITLE_COLOR, x, y, w, h, false, HAlignment.LEFT, false);
|
g.drawText(title, TITLE_FONT, TITLE_COLOR, x, y, w, h, false, HAlignment.LEFT, false);
|
||||||
|
|
||||||
//draw description
|
//draw description
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class QuestSpellShopScreen extends TabPageScreen<QuestSpellShopScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateCreditsLabel() {
|
public void updateCreditsLabel() {
|
||||||
String credits = "Credits: " + FModel.getQuest().getAssets().getCredits();
|
String credits = "Credits: " + QuestUtil.formatCredits(FModel.getQuest().getAssets().getCredits());
|
||||||
spellShopPage.lblCredits.setText(credits);
|
spellShopPage.lblCredits.setText(credits);
|
||||||
inventoryPage.lblCredits.setText(credits);
|
inventoryPage.lblCredits.setText(credits);
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ public class QuestSpellShopScreen extends TabPageScreen<QuestSpellShopScreen> {
|
|||||||
|
|
||||||
private static abstract class SpellShopBasePage extends TabPage<QuestSpellShopScreen> {
|
private static abstract class SpellShopBasePage extends TabPage<QuestSpellShopScreen> {
|
||||||
protected final SpellShopManager itemManager;
|
protected final SpellShopManager itemManager;
|
||||||
protected FLabel lblCredits = new FLabel.Builder().icon(FSkinImage.QUEST_COINSTACK).iconScaleFactor(1f).font(FSkinFont.get(16)).build();
|
protected FLabel lblCredits = new FLabel.Builder().icon(FSkinImage.QUEST_COINSTACK).iconScaleFactor(0.75f).font(FSkinFont.get(16)).build();
|
||||||
|
|
||||||
protected SpellShopBasePage(String caption0, FImage icon0, boolean isShop0) {
|
protected SpellShopBasePage(String caption0, FImage icon0, boolean isShop0) {
|
||||||
super(caption0, icon0);
|
super(caption0, icon0);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import forge.util.Utils;
|
|||||||
|
|
||||||
public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestTournamentView {
|
public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestTournamentView {
|
||||||
private final FLabel lblCredits = add(new FLabel.Builder().icon(FSkinImage.QUEST_COINSTACK)
|
private final FLabel lblCredits = add(new FLabel.Builder().icon(FSkinImage.QUEST_COINSTACK)
|
||||||
.iconScaleFactor(1f).font(FSkinFont.get(16)).build());
|
.iconScaleFactor(0.75f).font(FSkinFont.get(16)).build());
|
||||||
|
|
||||||
private final FLabel lblTokens = add(new FLabel.Builder()
|
private final FLabel lblTokens = add(new FLabel.Builder()
|
||||||
.align(HAlignment.RIGHT).font(FSkinFont.get(16)).build());
|
.align(HAlignment.RIGHT).font(FSkinFont.get(16)).build());
|
||||||
@@ -115,13 +115,18 @@ public class QuestTournamentsScreen extends QuestLaunchScreen implements IQuestT
|
|||||||
@Override
|
@Override
|
||||||
public void updateEventList(QuestEventDraftContainer events) {
|
public void updateEventList(QuestEventDraftContainer events) {
|
||||||
pnlTournaments.clear();
|
pnlTournaments.clear();
|
||||||
if (events == null) { return; }
|
|
||||||
|
|
||||||
/*for (QuestEventDraft event : events) {
|
if (events != null) {
|
||||||
|
for (QuestEventDraft event : events) {
|
||||||
pnlTournaments.add(new QuestEventPanel(event, pnlTournaments));
|
pnlTournaments.add(new QuestEventPanel(event, pnlTournaments));
|
||||||
}*/
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pnlTournaments.revalidate();
|
pnlTournaments.revalidate();
|
||||||
|
|
||||||
|
boolean hasTournaments = pnlTournaments.getChildCount() > 0;
|
||||||
|
pnlTournaments.setVisible(hasTournaments);
|
||||||
|
lblNoTournaments.setVisible(!hasTournaments);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
10
forge-gui/src/main/java/forge/quest/IQuestEvent.java
Normal file
10
forge-gui/src/main/java/forge/quest/IQuestEvent.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package forge.quest;
|
||||||
|
|
||||||
|
import forge.game.player.IHasIcon;
|
||||||
|
|
||||||
|
public interface IQuestEvent extends IHasIcon {
|
||||||
|
String getFullTitle();
|
||||||
|
String getDescription();
|
||||||
|
void select();
|
||||||
|
boolean hasImage();
|
||||||
|
}
|
||||||
@@ -20,7 +20,6 @@ package forge.quest;
|
|||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.game.player.IHasIcon;
|
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -35,7 +34,7 @@ import java.util.List;
|
|||||||
* MODEL - A basic event instance in Quest mode. Can be extended for use in
|
* MODEL - A basic event instance in Quest mode. Can be extended for use in
|
||||||
* unique event types: battles, quests, and others.
|
* unique event types: battles, quests, and others.
|
||||||
*/
|
*/
|
||||||
public abstract class QuestEvent implements IHasIcon {
|
public abstract class QuestEvent implements IQuestEvent {
|
||||||
// Default vals if none provided in the event file.
|
// Default vals if none provided in the event file.
|
||||||
private Deck eventDeck = null;
|
private Deck eventDeck = null;
|
||||||
private String title = "Mystery Event";
|
private String title = "Mystery Event";
|
||||||
@@ -53,7 +52,7 @@ public abstract class QuestEvent implements IHasIcon {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public final String getTitle() {
|
public final String getTitle() {
|
||||||
return this.title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,57 +63,57 @@ public abstract class QuestEvent implements IHasIcon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final QuestEventDifficulty getDifficulty() {
|
public final QuestEventDifficulty getDifficulty() {
|
||||||
return this.difficulty;
|
return difficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getDescription() {
|
public final String getDescription() {
|
||||||
return this.description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Deck getEventDeck() {
|
public final Deck getEventDeck() {
|
||||||
return this.eventDeck;
|
return eventDeck;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String getIconImageKey() {
|
public final String getIconImageKey() {
|
||||||
return this.imageKey;
|
return imageKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getName() {
|
public final String getName() {
|
||||||
return this.name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getProfile() {
|
public final String getProfile() {
|
||||||
return this.profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProfile(final String profi) {
|
public void setProfile(final String profile0) {
|
||||||
this.profile = profi;
|
profile = profile0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(final String name0) {
|
public void setName(final String name0) {
|
||||||
this.name = name0;
|
name = name0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(final String title0) {
|
public void setTitle(final String title0) {
|
||||||
this.title = title0;
|
title = title0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDifficulty(final QuestEventDifficulty difficulty0) {
|
public void setDifficulty(final QuestEventDifficulty difficulty0) {
|
||||||
this.difficulty = difficulty0;
|
difficulty = difficulty0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(final String description0) {
|
public void setDescription(final String description0) {
|
||||||
this.description = description0;
|
description = description0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEventDeck(final Deck eventDeck0) {
|
public void setEventDeck(final Deck eventDeck0) {
|
||||||
this.eventDeck = eventDeck0;
|
eventDeck = eventDeck0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIconImageKey(final String s0) {
|
public void setIconImageKey(final String s0) {
|
||||||
this.imageKey = s0;
|
imageKey = s0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final List<InventoryItem> getCardRewardList() {
|
public final List<InventoryItem> getCardRewardList() {
|
||||||
@@ -122,13 +121,13 @@ public abstract class QuestEvent implements IHasIcon {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (cardRewardList == null) {
|
if (cardRewardList == null) {
|
||||||
this.cardRewardList = new ArrayList<InventoryItem>(BoosterUtils.generateCardRewardList(cardReward));
|
cardRewardList = new ArrayList<InventoryItem>(BoosterUtils.generateCardRewardList(cardReward));
|
||||||
}
|
}
|
||||||
return this.cardRewardList;
|
return cardRewardList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCardReward(final String cardReward0) {
|
public void setCardReward(final String cardReward0) {
|
||||||
this.cardReward = cardReward0;
|
cardReward = cardReward0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getHumanExtraCards() {
|
public List<String> getHumanExtraCards() {
|
||||||
@@ -138,4 +137,19 @@ public abstract class QuestEvent implements IHasIcon {
|
|||||||
public List<String> getAiExtraCards() {
|
public List<String> getAiExtraCards() {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String getFullTitle() {
|
||||||
|
return title + " (" + difficulty.getTitle() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void select() {
|
||||||
|
QuestUtil.setEvent(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasImage() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import java.util.*;
|
|||||||
* MODEL - A basic event instance in Quest mode. Can be extended for use in
|
* MODEL - A basic event instance in Quest mode. Can be extended for use in
|
||||||
* unique event types: battles, quests, and others.
|
* unique event types: battles, quests, and others.
|
||||||
*/
|
*/
|
||||||
public class QuestEventDraft {
|
public class QuestEventDraft implements IQuestEvent {
|
||||||
|
|
||||||
public static class QuestDraftPrizes {
|
public static class QuestDraftPrizes {
|
||||||
|
|
||||||
@@ -1097,4 +1097,45 @@ public class QuestEventDraft {
|
|||||||
|
|
||||||
return bracket;
|
return bracket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String getFullTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBoosterList() {
|
||||||
|
String boosterList = "";
|
||||||
|
String[] boosterArray = boosterConfiguration.split("/");
|
||||||
|
for (int i = 0; i < boosterArray.length; i++) {
|
||||||
|
boosterList += FModel.getMagicDb().getEditions().get(boosterArray[i]).getName();
|
||||||
|
if (i != boosterArray.length - 1) {
|
||||||
|
boosterList += " | ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return boosterList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return getBoosterList() + "\n" + QuestUtil.formatCredits(entryFee) + " Credit Entry Fee";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void select() {
|
||||||
|
QuestUtil.setDraftEvent(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIconImageKey() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIconImageKey(String iconImageKey) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasImage() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class QuestTournamentController {
|
|||||||
final QuestEventDraft.QuestDraftPrizes prizes = draft.collectPrizes();
|
final QuestEventDraft.QuestDraftPrizes prizes = draft.collectPrizes();
|
||||||
|
|
||||||
if (prizes.hasCredits()) {
|
if (prizes.hasCredits()) {
|
||||||
SOptionPane.showMessageDialog("For placing " + placement + ", you have been awarded " + prizes.credits + " credits!", "Credits Awarded", FSkinProp.ICO_QUEST_GOLD);
|
SOptionPane.showMessageDialog("For placing " + placement + ", you have been awarded " + QuestUtil.formatCredits(prizes.credits) + " credits!", "Credits Awarded", FSkinProp.ICO_QUEST_GOLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prizes.hasIndividualCards()) {
|
if (prizes.hasIndividualCards()) {
|
||||||
@@ -230,7 +230,7 @@ public class QuestTournamentController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateSelectTournament() {
|
private void updateSelectTournament() {
|
||||||
view.getLblCredits().setText("Credits: " + FModel.getQuest().getAssets().getCredits());
|
view.getLblCredits().setText("Credits: " + QuestUtil.formatCredits(FModel.getQuest().getAssets().getCredits()));
|
||||||
|
|
||||||
final QuestAchievements achievements = FModel.getQuest().getAchievements();
|
final QuestAchievements achievements = FModel.getQuest().getAchievements();
|
||||||
achievements.generateDrafts();
|
achievements.generateDrafts();
|
||||||
@@ -390,11 +390,11 @@ public class QuestTournamentController {
|
|||||||
|
|
||||||
final long creditsAvailable = FModel.getQuest().getAssets().getCredits();
|
final long creditsAvailable = FModel.getQuest().getAssets().getCredits();
|
||||||
if (draftEvent.canEnter()) {
|
if (draftEvent.canEnter()) {
|
||||||
SOptionPane.showMessageDialog("You need " + (draftEvent.getEntryFee() - creditsAvailable) + " more credits to enter this tournament.", "Not Enough Credits", SOptionPane.WARNING_ICON);
|
SOptionPane.showMessageDialog("You need " + QuestUtil.formatCredits(draftEvent.getEntryFee() - creditsAvailable) + " more credits to enter this tournament.", "Not Enough Credits", SOptionPane.WARNING_ICON);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean okayToEnter = SOptionPane.showOptionDialog("This tournament costs " + draftEvent.getEntryFee() + " credits to enter.\nAre you sure you wish to enter?", "Enter Draft Tournament?", FSkinProp.ICO_QUEST_GOLD, ImmutableList.of("Yes", "No"), 1) == 0;
|
final boolean okayToEnter = SOptionPane.showOptionDialog("This tournament costs " + QuestUtil.formatCredits(draftEvent.getEntryFee()) + " credits to enter.\nAre you sure you wish to enter?", "Enter Draft Tournament?", FSkinProp.ICO_QUEST_GOLD, ImmutableList.of("Yes", "No"), 1) == 0;
|
||||||
|
|
||||||
if (!okayToEnter) {
|
if (!okayToEnter) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import forge.util.gui.SOptionPane;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -62,6 +63,10 @@ import java.util.List;
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class QuestUtil {
|
public class QuestUtil {
|
||||||
|
private static final DecimalFormat CREDITS_FORMATTER = new DecimalFormat("#,###");
|
||||||
|
public static String formatCredits(long credits) {
|
||||||
|
return CREDITS_FORMATTER.format(credits);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -368,7 +373,7 @@ public class QuestUtil {
|
|||||||
view0.getLblLife().setVisible(true);
|
view0.getLblLife().setVisible(true);
|
||||||
|
|
||||||
// Stats panel
|
// Stats panel
|
||||||
view0.getLblCredits().setText("Credits: " + qS.getCredits());
|
view0.getLblCredits().setText("Credits: " + QuestUtil.formatCredits(qS.getCredits()));
|
||||||
view0.getLblLife().setText("Life: " + qS.getLife(qCtrl.getMode()));
|
view0.getLblLife().setText("Life: " + qS.getLife(qCtrl.getMode()));
|
||||||
view0.getLblWins().setText("Wins: " + qA.getWin());
|
view0.getLblWins().setText("Wins: " + qA.getWin());
|
||||||
view0.getLblLosses().setText("Losses: " + qA.getLost());
|
view0.getLblLosses().setText("Losses: " + qA.getLost());
|
||||||
|
|||||||
Reference in New Issue
Block a user