Support drawing planeswalker token

This commit is contained in:
drdev
2015-03-13 11:37:29 +00:00
parent 8feaf755dc
commit c809b1757b
2 changed files with 22 additions and 9 deletions

View File

@@ -116,7 +116,10 @@ public class ConquestMapScreen extends FScreen {
} }
} }
int progress = model.getCurrentPlaneData().getProgress();
int regionCount = model.getCurrentPlane().getRegions().size(); int regionCount = model.getCurrentPlane().getRegions().size();
FCollectionView<ConquestOpponent> opponents = region.getOpponents();
int startIndex = (regionCount - index - 1) * opponents.size();
//draw path with opponents //draw path with opponents
float x0, y0, prevX = x + w / 2, prevY = y + h; float x0, y0, prevX = x + w / 2, prevY = y + h;
@@ -127,7 +130,6 @@ public class ConquestMapScreen extends FScreen {
float iconOffsetX = (colWidth - iconSize) / 2; float iconOffsetX = (colWidth - iconSize) / 2;
float iconOffsetY = (rowHeight - iconSize) / 2; float iconOffsetY = (rowHeight - iconSize) / 2;
float lineThickness = iconSize / 4; float lineThickness = iconSize / 4;
FCollectionView<ConquestOpponent> opponents = region.getOpponents();
//draw line path //draw line path
for (int i = 0; i < opponents.size(); i++) { for (int i = 0; i < opponents.size(); i++) {
@@ -156,10 +158,22 @@ public class ConquestMapScreen extends FScreen {
} }
//draw fog of war overlay if region not yet unlocked //draw fog of war overlay if region not yet unlocked
int startIndex = (regionCount - index - 1) * opponents.size(); if (startIndex > progress) {
if (startIndex > model.getCurrentPlaneData().getProgress()) {
g.fillRect(FOG_OF_WAR_COLOR, x, y, w, h); g.fillRect(FOG_OF_WAR_COLOR, x, y, w, h);
} }
else {
//draw planeswalker token above stop
int planeswalkerPosition = progress - startIndex;
if (planeswalkerPosition < opponents.size()) {
GridPosition pos = path[planeswalkerPosition];
x0 = x + colWidth * pos.col + iconOffsetX;
y0 = y + rowHeight * pos.row + iconOffsetY;
FImage token = (FImage)model.getPlaneswalkerToken();
float tokenWidth = iconSize * 2f;
float tokenHeight = tokenWidth * token.getHeight() / token.getWidth();
g.drawImage(token, x0 + (iconSize - tokenWidth) / 2, y0 - tokenHeight, tokenWidth, tokenHeight);
}
}
} }
} }

View File

@@ -17,6 +17,8 @@
*/ */
package forge.planarconquest; package forge.planarconquest;
import forge.achievement.PlaneswalkerAchievements;
import forge.assets.ISkinImage;
import forge.deck.Deck; import forge.deck.Deck;
import forge.item.InventoryItem; import forge.item.InventoryItem;
import forge.item.PaperCard; import forge.item.PaperCard;
@@ -48,11 +50,11 @@ public final class ConquestData {
private int wins, losses; private int wins, losses;
private int winStreakBest = 0; private int winStreakBest = 0;
private int winStreakCurrent = 0; private int winStreakCurrent = 0;
private int day = 1;
private int difficulty; private int difficulty;
private ConquestPlane startingPlane, currentPlane; private ConquestPlane startingPlane, currentPlane;
private int currentRegionIndex; private int currentRegionIndex;
private EnumMap<ConquestPlane, ConquestPlaneData> planeDataMap = new EnumMap<ConquestPlane, ConquestPlaneData>(ConquestPlane.class); private EnumMap<ConquestPlane, ConquestPlaneData> planeDataMap = new EnumMap<ConquestPlane, ConquestPlaneData>(ConquestPlane.class);
private ISkinImage planeswalkerToken = PlaneswalkerAchievements.getTrophyImage("Jace, the Mind Sculptor");
private final HashSet<PaperCard> collection = new HashSet<PaperCard>(); private final HashSet<PaperCard> collection = new HashSet<PaperCard>();
private final HashMap<String, Deck> decks = new HashMap<String, Deck>(); private final HashMap<String, Deck> decks = new HashMap<String, Deck>();
@@ -99,11 +101,8 @@ public final class ConquestData {
return difficulty; return difficulty;
} }
public int getDay() { public ISkinImage getPlaneswalkerToken() {
return day; return planeswalkerToken;
}
public void incrementDay() {
day++;
} }
public ConquestPlane getStartingPlane() { public ConquestPlane getStartingPlane() {