mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Render wins to unlock commanders
This commit is contained in:
@@ -18,6 +18,8 @@ import forge.model.FModel;
|
||||
import forge.planarconquest.ConquestCommander;
|
||||
import forge.planarconquest.ConquestData;
|
||||
import forge.planarconquest.ConquestPlane.Region;
|
||||
import forge.planarconquest.ConquestPlaneData;
|
||||
import forge.planarconquest.ConquestPreferences.CQPref;
|
||||
import forge.screens.FScreen;
|
||||
import forge.toolbox.FCardPanel;
|
||||
import forge.toolbox.FContainer;
|
||||
@@ -37,7 +39,9 @@ public class ConquestMapScreen extends FScreen {
|
||||
private static final float LINE_THICKNESS = Utils.scale(1);
|
||||
private static final float ARROW_ICON_THICKNESS = Utils.scale(3);
|
||||
private static final float REGION_SLIDER_HEIGHT = Math.round(Utils.AVG_FINGER_HEIGHT * 0.7f);
|
||||
private static final FSkinFont FONT = FSkinFont.get(15);
|
||||
private static final FSkinFont REGION_NAME_FONT = FSkinFont.get(15);
|
||||
private static final FSkinFont UNLOCK_WINS_FONT = FSkinFont.get(20);
|
||||
private static final float COMMANDER_ROW_HEIGHT = 2 * Utils.AVG_FINGER_HEIGHT;
|
||||
|
||||
private final RegionDisplay regionDisplay = add(new RegionDisplay());
|
||||
private final CommanderRow commanderRow = add(new CommanderRow());
|
||||
@@ -63,7 +67,7 @@ public class ConquestMapScreen extends FScreen {
|
||||
float y = startY;
|
||||
regionDisplay.setBounds(0, y, width, width / CardRenderer.CARD_ART_RATIO + REGION_SLIDER_HEIGHT);
|
||||
y += regionDisplay.getHeight() + PADDING;
|
||||
commanderRow.setBounds(0, y, width, 2 * Utils.AVG_FINGER_HEIGHT);
|
||||
commanderRow.setBounds(0, y, width, COMMANDER_ROW_HEIGHT);
|
||||
}
|
||||
|
||||
private class RegionDisplay extends FContainer {
|
||||
@@ -148,7 +152,7 @@ public class ConquestMapScreen extends FScreen {
|
||||
if (model != null) {
|
||||
Region region = model.getCurrentRegion();
|
||||
g.drawImage((FImage)region.getArt(), 0, 0, w, y);
|
||||
textRenderer.drawText(g, region.getName(), FONT, FORE_COLOR, REGION_SLIDER_HEIGHT, y, w - 2 * REGION_SLIDER_HEIGHT, REGION_SLIDER_HEIGHT, y, REGION_SLIDER_HEIGHT, false, HAlignment.CENTER, true);
|
||||
textRenderer.drawText(g, region.getName(), REGION_NAME_FONT, FORE_COLOR, REGION_SLIDER_HEIGHT, y, w - 2 * REGION_SLIDER_HEIGHT, REGION_SLIDER_HEIGHT, y, REGION_SLIDER_HEIGHT, false, HAlignment.CENTER, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,8 +212,9 @@ public class ConquestMapScreen extends FScreen {
|
||||
float h = getHeight();
|
||||
g.drawRect(LINE_THICKNESS, BORDER_COLOR, -LINE_THICKNESS, -LINE_THICKNESS, w + 2 * LINE_THICKNESS, h + 2 * LINE_THICKNESS);
|
||||
|
||||
ConquestPlaneData planeData = model.getCurrentPlaneData();
|
||||
if (card == null) {
|
||||
List<ConquestCommander> commanders = model.getCurrentPlaneData().getCommanders();
|
||||
List<ConquestCommander> commanders = planeData.getCommanders();
|
||||
if (index < commanders.size()) {
|
||||
card = Card.getCardForUi(commanders.get(index).getCard()).getView();
|
||||
}
|
||||
@@ -217,6 +222,15 @@ public class ConquestMapScreen extends FScreen {
|
||||
if (card != null) {
|
||||
CardRenderer.drawCardWithOverlays(g, card, 0, 0, w, h, CardStackPosition.Top);
|
||||
}
|
||||
else {
|
||||
int winsToUnlock = index * FModel.getConquestPreferences().getPrefInt(CQPref.WINS_TO_UNLOCK_COMMANDER);
|
||||
if (planeData.getWins() < winsToUnlock) {
|
||||
g.drawText(String.valueOf(winsToUnlock), UNLOCK_WINS_FONT, FORE_COLOR, 0, 0, w, h, false, HAlignment.CENTER, true);
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,8 @@ import forge.planarconquest.ConquestPlane.Region;
|
||||
import forge.properties.ForgeConstants;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public final class ConquestData {
|
||||
/** Holds the latest version of the Conquest Data. */
|
||||
@@ -124,7 +122,8 @@ public final class ConquestData {
|
||||
public void addWin() {
|
||||
wins++;
|
||||
winStreakCurrent++;
|
||||
|
||||
getCurrentPlaneData().addWin();
|
||||
|
||||
if (winStreakCurrent > winStreakBest) {
|
||||
winStreakBest = winStreakCurrent;
|
||||
}
|
||||
@@ -133,6 +132,7 @@ public final class ConquestData {
|
||||
public void addLoss() {
|
||||
losses++;
|
||||
winStreakCurrent = 0;
|
||||
getCurrentPlaneData().addLoss();
|
||||
}
|
||||
|
||||
public int getWins() {
|
||||
|
||||
@@ -6,7 +6,25 @@ import java.util.List;
|
||||
public class ConquestPlaneData {
|
||||
private final List<ConquestCommander> commanders = new ArrayList<ConquestCommander>();
|
||||
|
||||
private int wins, losses;
|
||||
|
||||
public List<ConquestCommander> getCommanders() {
|
||||
return commanders;
|
||||
}
|
||||
|
||||
public void addWin() {
|
||||
wins++;
|
||||
}
|
||||
|
||||
public void addLoss() {
|
||||
losses++;
|
||||
}
|
||||
|
||||
public int getWins() {
|
||||
return wins;
|
||||
}
|
||||
|
||||
public int getLosses() {
|
||||
return losses;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ public class ConquestPreferences extends PreferencesStore<ConquestPreferences.CQ
|
||||
* Preference identifiers, and their default values.
|
||||
*/
|
||||
public static enum CQPref {
|
||||
CURRENT_CONQUEST("DEFAULT");
|
||||
CURRENT_CONQUEST("DEFAULT"),
|
||||
WINS_TO_UNLOCK_COMMANDER("10");
|
||||
|
||||
private final String strDefaultVal;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user