-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStatsView.pde
73 lines (60 loc) · 1.42 KB
/
StatsView.pde
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
65
66
67
68
69
70
71
72
73
class StatsView extends View{
int mySeason = 0;
boolean isActive;
int active;
String characterName;
String[] charList = new String[30];
int myLines;
HashMap seasonMap;
StatsView (float x_, float y_, float w_, float h_, Season season_){
super(x_,y_,w_,h_);
mySeason = season_ == null ? 0 : season_.number;
}
void drawContent(){
fill(255);
rect(0,0,w,h);
fill(0);
text("Season "+mySeason +" Stats:", 0,0);
checkActive();
if(mySeason!=0)
{
seasonMap=data.getSeasonData("S0"+mySeason);
}
else
{
seasonMap=data.getWholeData();
}
for(int i = 0; i < charList.length;i++){
if(charList[i] != null){
text(charList[i] , 20, 20*i);
Character myCharacter = characters.get(charList[i]);
//myLines = myCharacter.totalLines;
if(seasonMap.containsKey(myCharacter.name))
{
myLines=int(seasonMap.get(myCharacter.name).toString());
}
else
{
myLines=0;
}
text("Lines: "+myLines, 200, 20*i);
}
}
for(int i = 0; i < charList.length;i++){
charList[i] =null;
}
}
void checkActive(){
Iterator it2 = characters.iterator();
active = 0;
while (it2.hasNext()){
Character character = (Character)it2.next();
isActive = character.active;
characterName = character.name;
if (isActive) {
active += 1;
charList[active]= characterName;
}
}
}
}