mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-19 21:37:57 +08:00
Fixing a Bug which doesn't display the winner if the player leaves
This commit is contained in:
parent
073013c778
commit
4e5da57b09
@ -75,6 +75,9 @@ class TeamSeriesVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
||||
player_entries.append((prec.score, prec.name_full, prec))
|
||||
player_entries.sort(reverse=True, key=lambda x: x[0])
|
||||
|
||||
self._topscored_player = list(player_entries[0])
|
||||
self._mostscore_player[1] = self._mostscore_player[2].getname()
|
||||
self._topscored_player[2] = self._topscored_player[2].get_icon()
|
||||
ts_height = 300.0
|
||||
ts_h_offs = -390.0
|
||||
tval = 6.4
|
||||
@ -372,39 +375,40 @@ class TeamSeriesVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
||||
v_offs = 0.0
|
||||
tdelay += len(player_entries) * 8 * t_incr
|
||||
for _score, name, prec in player_entries:
|
||||
tdelay -= 4 * t_incr
|
||||
v_offs -= 40
|
||||
Text(
|
||||
(
|
||||
str(prec.team.customdata['score'])
|
||||
if self._is_ffa
|
||||
else str(prec.score)
|
||||
),
|
||||
color=(0.5, 0.5, 0.5, 1.0),
|
||||
position=(ts_h_offs + 230, ts_height / 2 + v_offs),
|
||||
h_align=Text.HAlign.RIGHT,
|
||||
transition=Text.Transition.IN_RIGHT,
|
||||
transition_delay=tdelay,
|
||||
).autoretain()
|
||||
tdelay -= 4 * t_incr
|
||||
if prec.player.in_game:
|
||||
tdelay -= 4 * t_incr
|
||||
v_offs -= 40
|
||||
Text(
|
||||
(
|
||||
str(prec.team.customdata['score'])
|
||||
if self._is_ffa
|
||||
else str(prec.score)
|
||||
),
|
||||
color=(0.5, 0.5, 0.5, 1.0),
|
||||
position=(ts_h_offs + 230, ts_height / 2 + v_offs),
|
||||
h_align=Text.HAlign.RIGHT,
|
||||
transition=Text.Transition.IN_RIGHT,
|
||||
transition_delay=tdelay,
|
||||
).autoretain()
|
||||
tdelay -= 4 * t_incr
|
||||
|
||||
Image(
|
||||
prec.get_icon(),
|
||||
position=(ts_h_offs - 72, ts_height / 2 + v_offs + 15),
|
||||
scale=(30, 30),
|
||||
transition=Image.Transition.IN_LEFT,
|
||||
transition_delay=tdelay,
|
||||
).autoretain()
|
||||
Text(
|
||||
bs.Lstr(value=name),
|
||||
position=(ts_h_offs - 50, ts_height / 2 + v_offs + 15),
|
||||
h_align=Text.HAlign.LEFT,
|
||||
v_align=Text.VAlign.CENTER,
|
||||
maxwidth=180,
|
||||
color=bs.safecolor(prec.team.color + (1,)),
|
||||
transition=Text.Transition.IN_RIGHT,
|
||||
transition_delay=tdelay,
|
||||
).autoretain()
|
||||
Image(
|
||||
prec.get_icon(),
|
||||
position=(ts_h_offs - 72, ts_height / 2 + v_offs + 15),
|
||||
scale=(30, 30),
|
||||
transition=Image.Transition.IN_LEFT,
|
||||
transition_delay=tdelay,
|
||||
).autoretain()
|
||||
Text(
|
||||
bs.Lstr(value=name),
|
||||
position=(ts_h_offs - 50, ts_height / 2 + v_offs + 15),
|
||||
h_align=Text.HAlign.LEFT,
|
||||
v_align=Text.VAlign.CENTER,
|
||||
maxwidth=180,
|
||||
color=bs.safecolor(prec.team.color + (1,)),
|
||||
transition=Text.Transition.IN_RIGHT,
|
||||
transition_delay=tdelay,
|
||||
).autoretain()
|
||||
|
||||
bs.timer(15.0, bs.WeakCall(self._show_tips))
|
||||
|
||||
@ -435,23 +439,32 @@ class TeamSeriesVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
||||
else:
|
||||
offs_v = -80.0
|
||||
if len(team.players) == 1:
|
||||
icon = team.players[0].get_icon()
|
||||
player_name = team.players[0].getname(full=True, icon=False)
|
||||
elif self._topscored_player[0] >= self.session.get_ffa_series_length():
|
||||
icon = self._topscored_player[2]
|
||||
player_name = self._topscored_player[1]
|
||||
else:
|
||||
icon = None
|
||||
player_name = "Player Not Found"
|
||||
|
||||
if icon is not None:
|
||||
i = Image(
|
||||
team.players[0].get_icon(),
|
||||
icon,
|
||||
position=(0, 143),
|
||||
scale=(100, 100),
|
||||
).autoretain()
|
||||
assert i.node
|
||||
bs.animate(i.node, 'opacity', {0.0: 0.0, 0.25: 1.0})
|
||||
ZoomText(
|
||||
bs.Lstr(
|
||||
value=team.players[0].getname(full=True, icon=False)
|
||||
),
|
||||
position=(0, 97 + offs_v),
|
||||
color=team.color,
|
||||
scale=1.15,
|
||||
jitter=1.0,
|
||||
maxwidth=250,
|
||||
).autoretain()
|
||||
|
||||
ZoomText(
|
||||
bs.Lstr(value=player_name),
|
||||
position=(0, 97 + offs_v + (60 if icon is None else 0)),
|
||||
color=team.color,
|
||||
scale=1.15,
|
||||
jitter=1.0,
|
||||
maxwidth=250,
|
||||
).autoretain()
|
||||
|
||||
s_extra = 1.0 if self._is_ffa else 1.0
|
||||
|
||||
|
||||
@ -415,6 +415,7 @@ class Scoreboard:
|
||||
team: bs.Team,
|
||||
score: float,
|
||||
max_score: float | None = None,
|
||||
*,
|
||||
countdown: bool = False,
|
||||
flash: bool = True,
|
||||
show_value: bool = True,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user