|
1 package org.hedgewars.hedgeroid.Datastructures; |
|
2 |
|
3 import org.hedgewars.hedgeroid.R; |
|
4 |
|
5 import android.content.res.Resources; |
|
6 |
|
7 public final class RoomlistRoom { |
|
8 public static final String MAP_REGULAR = "+rnd+"; |
|
9 public static final String MAP_MAZE = "+maze+"; |
|
10 public static final String MAP_DRAWN = "+drawn+"; |
|
11 |
|
12 public final String name, map, scheme, weapons, owner; |
|
13 public final int playerCount, teamCount; |
|
14 public final boolean inProgress; |
|
15 |
|
16 public RoomlistRoom(String name, String map, String scheme, String weapons, |
|
17 String owner, int playerCount, int teamCount, boolean inProgress) { |
|
18 this.name = name; |
|
19 this.map = map; |
|
20 this.scheme = scheme; |
|
21 this.weapons = weapons; |
|
22 this.owner = owner; |
|
23 this.playerCount = playerCount; |
|
24 this.teamCount = teamCount; |
|
25 this.inProgress = inProgress; |
|
26 } |
|
27 |
|
28 public static String formatMapName(Resources res, String map) { |
|
29 if(map.charAt(0)=='+') { |
|
30 if(map.equals(MAP_REGULAR)) { |
|
31 return res.getString(R.string.map_regular); |
|
32 } else if(map.equals(MAP_MAZE)) { |
|
33 return res.getString(R.string.map_maze); |
|
34 } else if(map.equals(MAP_DRAWN)) { |
|
35 return res.getString(R.string.map_drawn); |
|
36 } |
|
37 } |
|
38 return map; |
|
39 } |
|
40 |
|
41 public String formatMapName(Resources res) { |
|
42 return formatMapName(res, map); |
|
43 } |
|
44 |
|
45 @Override |
|
46 public String toString() { |
|
47 return "RoomlistRoom [name=" + name + ", map=" + map + ", scheme=" |
|
48 + scheme + ", weapons=" + weapons + ", owner=" + owner |
|
49 + ", playerCount=" + playerCount + ", teamCount=" + teamCount |
|
50 + ", inProgress=" + inProgress + "]"; |
|
51 } |
|
52 } |