Fixed teams score screen stats

This commit is contained in:
Eric Froemling 2020-05-06 22:30:54 -07:00
parent d260acebd7
commit b69657a08e
2 changed files with 24 additions and 27 deletions

View File

@ -4132,16 +4132,16 @@
"assets/build/windows/x64/python.exe": "https://files.ballistica.net/cache/ba1/25/a7/dc87c1be41605eb6fefd0145144c",
"assets/build/windows/x64/python37.dll": "https://files.ballistica.net/cache/ba1/b9/e4/d912f56e42e9991bcbb4c804cfcb",
"assets/build/windows/x64/pythonw.exe": "https://files.ballistica.net/cache/ba1/6c/bb/b6f52c306aa4e88061510e96cefe",
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f0/ef/569ac122fe194e20df8c3a26aee4",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/04/16/1b4586525558774d1aa383134c7d",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/36/7b/9d3ff3eb01c1ccd0a4adb33040c6",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/15/da/21937ea5bc0a82d7a10d47629106",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/48/9c/125d4a1a19f3efd3a7f1210c98a2",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/97/74/6aa7281383a9e01b4a3c8606745a",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ec/6f/e69be2f20c6f4235b9927d2abae7",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/34/57/89052f667637901812e8105bbf90",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/6a/2d/f1c65e0d3d9c3b26b3901d2a7885",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/ea/35/0fb15f2897fa4ecb815c4f51cef4",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/95/f8/f5143b9052d3e0e22bf265841317",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/01/8d/0168cf158bfe41da57395b09f44d"
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5a/39/65d7a21f427d1f8c9b4716363d77",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e3/07/dd3a30df3e60bcb19314b7c11f64",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ba/2e/986f46803c0a058dd3eace081150",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/60/f8/b1790f0b8142264a04bd3d9c9e08",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c0/f7/d8f95c83471c134f7cf5a058828c",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/60/49/570898c369fd388970bd086c0f76",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c1/bf/43f1c52e319823ad6cea21a2c14c",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/52/90/4ad2ec0f1f81f87a6cc4971c5b8e",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/ac/a0/24b940d7c28d09285bef72bd8ccb",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/19/09/616270667d7e2356e417afa68533",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/bb/39/090582c57d942ad0eaf93abcf692",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/9b/74/0720f21b36250917496d50893e6e"
}

View File

@ -29,7 +29,6 @@ from ba.internal import ScoreScreenActivity
if TYPE_CHECKING:
from typing import Any, Dict, Optional, Union
from ba import PlayerRecord
class MultiTeamScoreScreenActivity(ScoreScreenActivity):
@ -80,16 +79,15 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
# pylint: disable=too-many-statements
from bastd.actor.text import Text
from bastd.actor.image import Image
from ba import FreeForAllSession
ts_v_offset = 150.0 + y_offset
ts_h_offs = 80.0 + x_offset
tdelay = delay
spacing = 40
is_free_for_all = isinstance(self.session, FreeForAllSession)
is_free_for_all = isinstance(self.session, ba.FreeForAllSession)
def _get_prec_score(p_rec: PlayerRecord) -> int:
def _get_prec_score(p_rec: ba.PlayerRecord) -> int:
if is_free_for_all and results is not None:
assert isinstance(results, ba.TeamGameResults)
val = results.get_team_score(p_rec.team)
@ -97,7 +95,7 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
return val
return p_rec.accumscore
def _get_prec_score_str(p_rec: PlayerRecord) -> Union[str, ba.Lstr]:
def _get_prec_score_str(p_rec: ba.PlayerRecord) -> Union[str, ba.Lstr]:
if is_free_for_all and results is not None:
assert isinstance(results, ba.TeamGameResults)
val = results.get_team_score_str(p_rec.team)
@ -116,7 +114,7 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
valid_players = list(self.stats.get_records().items())
def _get_player_score_set_entry(
player: ba.Player) -> Optional[PlayerRecord]:
player: ba.Player) -> Optional[ba.PlayerRecord]:
for p_rec in valid_players:
# PyCharm incorrectly thinks valid_players is a List[str]
# noinspection PyUnresolvedReferences
@ -134,16 +132,15 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
if player_entry is not None:
player_records.append(player_entry)
else:
print('FIXME; CODE PATH NEEDS FIXING')
player_records = []
# player_records = [[
# _get_prec_score(p), name, p
# ] for name, p in list(self.stats.get_records().items())]
# player_records.sort(
# reverse=(results is None
# or not results.get_lower_is_better()))
# # just want living player entries
# player_records = [p[2] for p in player_records if p[2]]
player_records_scores = [
(_get_prec_score(p), name, p)
for name, p in list(self.stats.get_records().items())
]
player_records_scores.sort(reverse=True)
# Just want living player entries.
player_records = [p[2] for p in player_records_scores if p[2]]
v_offs = -140.0 + spacing * len(player_records) * 0.5