Skip to content

Commit

Permalink
Improve ID display on dedicated server and scoreboard
Browse files Browse the repository at this point in the history
Instead of just displaying numbers 1 to 16 in team games, the ID
will now be displayed in team-player format such as 1-4 and 2-2
format. This should make it easier to see which team each player
is on and better matches the data displayed on each player's
screen.
  • Loading branch information
Dees-Troy committed May 3, 2018
1 parent 1cb6e5a commit 8431547
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,28 @@ public View getView(int position, View view, ViewGroup parent) {
playerIDTV.setText(data[position].playerName);
return rowView;
}
playerIDTV.setText("" + position);
switch (Globals.getInstance().mGameMode) {
case Globals.GAME_MODE_FFA:
playerIDTV.setText("" + position);
break;
case Globals.GAME_MODE_2TEAMS:
if (position > Globals.MAX_PLAYER_ID / 2)
playerIDTV.setText("2-" + (position - (Globals.MAX_PLAYER_ID / 2)));
else
playerIDTV.setText("1-" + position);
break;
case Globals.GAME_MODE_4TEAMS:
int playersPerTeam = Globals.MAX_PLAYER_ID / 4;
if (position > playersPerTeam * 3)
playerIDTV.setText("4-" + (position - (playersPerTeam * 3)));
else if (position > playersPerTeam * 2)
playerIDTV.setText("3-" + (position - (playersPerTeam * 2)));
else if (position > playersPerTeam)
playerIDTV.setText("2-" + (position - playersPerTeam));
else
playerIDTV.setText("1-" + position);
break;
}
if (data[position] == null) {
playerNameTV.setText(R.string.player_name_not_connected);
playerPointsTV.setText("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,28 @@ public void getServerSettings() {
Globals.PlayerSettings playerSettings = Globals.getInstance().mPlayerSettings.get(mPlayerID);
if (playerSettings == null)
playerSettings = new Globals.PlayerSettings();
mTitleTV.setText(mContext.getString(R.string.player_settings_id_title, mPlayerID));
switch (Globals.getInstance().mGameMode) {
case Globals.GAME_MODE_FFA:
mTitleTV.setText(mContext.getString(R.string.player_settings_id_title, mPlayerID));
break;
case Globals.GAME_MODE_2TEAMS:
if (mPlayerID > Globals.MAX_PLAYER_ID / 2)
mTitleTV.setText(mContext.getString(R.string.player_settings_team_title, 2, (mPlayerID - (Globals.MAX_PLAYER_ID / 2))));
else
mTitleTV.setText(mContext.getString(R.string.player_settings_team_title, 1, mPlayerID));
break;
case Globals.GAME_MODE_4TEAMS:
int playersPerTeam = Globals.MAX_PLAYER_ID / 4;
if (mPlayerID > playersPerTeam * 3)
mTitleTV.setText(mContext.getString(R.string.player_settings_team_title, 4, (mPlayerID - (playersPerTeam * 3))));
else if (mPlayerID > playersPerTeam * 2)
mTitleTV.setText(mContext.getString(R.string.player_settings_team_title, 3, (mPlayerID - (playersPerTeam * 2))));
else if (mPlayerID > playersPerTeam)
mTitleTV.setText(mContext.getString(R.string.player_settings_team_title, 2, (mPlayerID - playersPerTeam)));
else
mTitleTV.setText(mContext.getString(R.string.player_settings_team_title, 1, mPlayerID));
break;
}
mHealthET.setText("" + playerSettings.health);
mReloadShotsET.setText("" + playerSettings.shots);
mReloadTimeET.setText("" + playerSettings.reloadTime);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@

<string name="player_settings_title">Player Settings</string>
<string name="player_settings_id_title">Player Settings (%1$d)</string>
<string name="player_settings_team_title">Player Settings (%1$d-%2$d)</string>
<string name="player_settings_button">Player Settings</string>
<string name="player_settings_health_title">Health</string>
<string name="player_settings_spawn_time">Respawn Time (Seconds)</string>
Expand Down

0 comments on commit 8431547

Please sign in to comment.