-
Notifications
You must be signed in to change notification settings - Fork 0
/
SettingsClass.pde
42 lines (39 loc) · 1.05 KB
/
SettingsClass.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
class Settings {
Table table;
Settings() {
table = loadTable("LifeLineSettings.csv", "header");
try {
for (int i = 0; i < table.getRowCount(); i++) {
TableRow row = table.getRow(i);
idField.get(i).userID = row.getString("NAME");
ipField.get(i).userIP = row.getString("IP");
ping.get(i).variableTimer = row.getInt("TIME");
}
} catch (NullPointerException e) {
table = new Table();
table.addColumn("NAME");
table.addColumn("IP");
for (int i = 0; i < hearts; i++) {
TableRow row = table.addRow();
row.setString("NAME", "");
row.setString("IP", "");
row.setString("TIME", "");
table.setInt(i,"TIME",5);
//ping.get(i).variableTimer = 5;
}
}
}
void get() {
for (int i = 0; i < table.getRowCount(); i++) {
table.setString(i, "NAME", idField.get(i).userID);
table.setString(i, "IP", ipField.get(i).userIP);
table.setString(i, "TIME", str(ping.get(i).variableTimer));
}
saveTable(table, "LifeLineSettings.csv");
}
void keyPressed() {
if (key == ENTER || key == RETURN) {
get();
}
}
}