v0.2.3: rankings page can now contain up to 10 records (+1 for most recent), looks a bit clumped up atm.

This commit is contained in:
Evan Debenham 2014-12-18 02:24:30 -05:00
parent a3c9dc77a1
commit e4951449f4
2 changed files with 21 additions and 13 deletions

View File

@ -35,7 +35,7 @@ public enum Rankings {
INSTANCE;
public static final int TABLE_SIZE = 6;
public static final int TABLE_SIZE = 11;
public static final String RANKINGS_FILE = "rankings.dat";
public static final String DETAILS_FILE = "game_%d.dat";
@ -70,7 +70,7 @@ public enum Rankings {
lastRecord = records.indexOf( rec );
int size = records.size();
if (size > TABLE_SIZE) {
while (size > TABLE_SIZE) {
Record removedGame;
if (lastRecord == size - 1) {
@ -83,6 +83,8 @@ public enum Rankings {
if (removedGame.gameFile.length() > 0) {
Game.instance.deleteFile( removedGame.gameFile );
}
size = records.size();
}
totalNumber++;

View File

@ -45,7 +45,7 @@ public class RankingsScene extends PixelScene {
private static final String TXT_NO_INFO = "No additional information";
private static final float ROW_HEIGHT = 30;
private static final float ROW_HEIGHT = 20;
private static final float GAP = 4;
private Archs archs;
@ -127,8 +127,8 @@ public class RankingsScene extends PixelScene {
private static final float GAP = 4;
private static final int TEXT_WIN = 0xFFFF88;
private static final int TEXT_LOSE = 0xCCCCCC;
private static final int[] TEXT_WIN = {0xFFFF88, 0xB2B25F};
private static final int[] TEXT_LOSE= {0xDDDDDD, 0x888888};
private static final int FLARE_WIN = 0x888866;
private static final int FLARE_LOSE = 0x666666;
@ -152,19 +152,25 @@ public class RankingsScene extends PixelScene {
addToBack( flare );
}
position.text( Integer.toString( pos+1 ) );
if (pos != Rankings.TABLE_SIZE-1) {
position.text(Integer.toString(pos + 1));
} else
position.text(" ");
position.measure();
desc.text( rec.info );
desc.measure();
int odd = pos % 2;
if (rec.win) {
shield.view( ItemSpriteSheet.AMULET, null );
position.hardlight( TEXT_WIN );
desc.hardlight( TEXT_WIN );
position.hardlight( TEXT_WIN[odd] );
desc.hardlight( TEXT_WIN[odd] );
} else {
position.hardlight( TEXT_LOSE );
desc.hardlight( TEXT_LOSE );
position.hardlight( TEXT_LOSE[odd] );
desc.hardlight( TEXT_LOSE[odd] );
}
classIcon.copy( Icons.get( rec.heroClass ) );
@ -209,7 +215,7 @@ public class RankingsScene extends PixelScene {
desc.x = shield.x + shield.width + GAP;
desc.maxWidth = (int)(classIcon.x - desc.x);
desc.measure();
desc.y = position.y + position.baseLine() - desc.baseLine();
desc.y = align( shield.y + (shield.height - desc.height()) / 2 + 1 );
}
@Override