-
Notifications
You must be signed in to change notification settings - Fork 0
/
RecordsScreen.java
64 lines (51 loc) · 1.97 KB
/
RecordsScreen.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class RecordsScreen extends World
{
private RecordsManager recordsManager;
/**
* Constructor for objects of class RecordsScreen.
*
*/
public RecordsScreen(World mainScreen)
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
recordsManager = new RecordsManager();
printBillboard();
ReturnButton returnButton = new ReturnButton(0);
addObject(returnButton, 100, 330);
}
public void printBillboard(){
int score;
int digit;
int x, y = 110;
List<GameRecord> records = recordsManager.getList();
Iterator<GameRecord> recordsIterator = records.iterator();
RecordsLogo recordLogo = new RecordsLogo();
recordLogo.resize();
addObject(recordLogo, 100, 180);
while(recordsIterator.hasNext() == true){
GameRecord record = (GameRecord)recordsIterator.next();
x = 230;
String scoreString = String.valueOf(record.getScore());
for(int counter = 0; counter < scoreString.length(); counter ++){
Character character = new Character();
character.changeImage(String.valueOf(scoreString.charAt(counter)));
addObject(character, x, y);
x+=40;
}
x+=45;
String name = record.getPlayerName();
for(int counter = 0; counter < name.length(); counter ++){
Character character = new Character();
character.changeImage(String.valueOf(name.charAt(counter)));
addObject(character, x, y);
x+=40;
}
y += 50;
}
}
}