fix 第一次进房PK进度指示器不对的问题

This commit is contained in:
huangjian
2021-11-01 17:13:10 +08:00
parent af1018df3d
commit bfb615ecf4

View File

@@ -150,6 +150,17 @@ public class PKBoardView extends RelativeLayout implements View.OnClickListener
if (redTeamInfo != null) {
tvRedTeamScore.setText(FormatUtils.formatPKValue(redTeamInfo.getScore()));
}
if (redTeamInfo != null && blueTeamInfo != null) {
long totalScore = redTeamInfo.getScore() + blueTeamInfo.getScore();
if (totalScore > 0) {
int percent = (int) ((float) redTeamInfo.getScore() / (float) totalScore * 100.0f);
pbScore.setProgress(percent);
} else {
pbScore.setProgress(50);
}
}
} else {
tvPkTimer.setText("未开始");
if (!isTeamHaveMember(PKTeamInfo.TEAM_RED)) {