1
|
|
|
package de.kleiner3.lasertag.client.hud; |
2
|
|
|
|
3
|
|
|
import de.kleiner3.lasertag.lasertaggame.teammanagement.TeamConfigManager; |
4
|
|
|
import de.kleiner3.lasertag.lasertaggame.teammanagement.TeamDto; |
5
|
|
|
import de.kleiner3.lasertag.common.types.Tuple; |
6
|
|
|
|
7
|
|
|
import java.util.HashMap; |
8
|
|
|
import java.util.LinkedList; |
9
|
|
|
import java.util.concurrent.ScheduledExecutorService; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class to hold all lasertag HUD data |
13
|
|
|
* |
14
|
|
|
* @author Étienne Muser |
15
|
|
|
*/ |
16
|
|
|
public class LasertagHudRenderConfig { |
17
|
|
|
public boolean shouldRenderNameTags = true; |
18
|
|
|
/** |
19
|
|
|
* The time in seconds that has already elapsed |
20
|
|
|
*/ |
21
|
|
|
public long gameTime = 0; |
22
|
|
|
public ScheduledExecutorService gameTimer; |
23
|
|
|
public final Object gameTimerLock = new Object(); |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Simplified team map to map players and their score to their teams |
27
|
|
|
*/ |
28
|
|
|
public HashMap<String, LinkedList<Tuple<String, Integer>>> teamMap = new HashMap<>(); |
29
|
|
|
|
30
|
|
|
public double progress = 0.0; |
31
|
|
|
|
32
|
|
|
public int startingIn = -1; |
33
|
|
|
|
34
|
|
|
// The logical size of the window |
35
|
|
|
public int width; |
36
|
|
|
public int wMid; |
37
|
|
|
public int height; |
38
|
|
|
public int hMid; |
39
|
|
|
|
40
|
|
|
// Constants |
41
|
|
|
public static final int progressBarWidth = 100; |
42
|
|
|
public static final int numTeams = TeamConfigManager.teamConfig.size(); |
43
|
|
|
public static final int boxColor = 0x88000000; |
44
|
|
|
public static final int startY = 10; |
45
|
|
|
public static final int boxHeight = 65; |
46
|
|
|
public static final int boxWidth = 85; |
47
|
|
|
public static final int margin = 20; |
48
|
|
|
public static final int textPadding = 1; |
49
|
|
|
public static final int textHeight = 9; |
50
|
|
|
|
51
|
|
|
LasertagHudRenderConfig() { |
52
|
|
|
for (TeamDto t : TeamConfigManager.teamConfig.values()) { |
53
|
|
|
teamMap.put(t.name(), new LinkedList<>()); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|