-
Notifications
You must be signed in to change notification settings - Fork 1
/
scoreboard.pde
84 lines (72 loc) · 1.92 KB
/
scoreboard.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
74
75
76
77
78
79
80
81
82
83
84
import processing.data.JSONObject;
import javax.swing.*;
import java.util.*;
void setup(){
setDefaults();
surface.setTitle(lang.getString("title"));
background(31,31,31); //background needs to be set before saved match check to colorize background before popup shows
if(checkSavedMatch()) {
setSavedMatch();
playersLabel[1] = " ("+gamesWin[1]+")";
playersLabel[2] = " ("+gamesWin[2]+")";
}
getButtons();
}
void settings() {
size(800,500);
}
void draw(){
setViewDefaults();
if(gameStarted()) {
checkSideChange();
gamePaused = false;
if(gameFinish() && !matchFinish()) {
noLoop();
createGameFinishView();
}
if(matchFinish()) {
noLoop();
createMatchFinishView();
}
createScoreboardView();
}
else {
createSelectionPageView();
}
}
void mousePressed() {
if(mouseButton == LEFT) {
Set keys = buttons.keys();
for (Object key : keys) {
String id = key.toString();
if(buttonClick(id)) {
JSONObject button = buttons.getJSONObject(id);
switch(button.getString("action")) {
case "set_game_type":
setGameType(button.getInt("value"));
break;
case "set_rule_type":
setRuleType(button.getInt("value"));
break;
case "start_game":
startGame();
break;
case "next_game":
nextGame();
break;
case "add_point":
points("add", button.getInt("value"));
break;
case "remove_point":
points("remove", button.getInt("value"));
break;
case "close_match":
closeMatch();
break;
default:
println("no action found (id: "+id+")");
}
}
}
}
}