v2.0.0: max games in progress are now tied to hero class count

This commit is contained in:
Evan Debenham
2023-02-13 16:48:00 -05:00
parent 3e63023f5b
commit c2b3312e11
2 changed files with 8 additions and 4 deletions

View File

@@ -36,7 +36,7 @@ import java.util.HashMap;
public class GamesInProgress {
public static final int MAX_SLOTS = 4;
public static final int MAX_SLOTS = HeroClass.values().length;
//null means we have loaded info and it is empty, no entry means unknown.
private static HashMap<Integer, Info> slotStates = new HashMap<>();

View File

@@ -78,12 +78,16 @@ public class StartScene extends PixelScene {
ArrayList<GamesInProgress.Info> games = GamesInProgress.checkAll();
int slotGap = landscape() ? 5 : 10;
int slotCount = Math.min(GamesInProgress.MAX_SLOTS, games.size()+1);
int slotGap = 10 - slotCount;
int slotsHeight = slotCount*SLOT_HEIGHT + (slotCount-1)* slotGap;
while (slotsHeight > (h-title.bottom()-2)){
slotGap--;
slotsHeight -= slotCount-1;
}
float yPos = (h - slotsHeight)/2f;
if (landscape()) yPos += 8;
float yPos = (h - slotsHeight + title.bottom() + 2)/2f;
for (GamesInProgress.Info game : games) {
SaveSlotButton existingGame = new SaveSlotButton();