mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-03 05:53:15 +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.append((prec.score, prec.name_full, prec))
|
||||||
player_entries.sort(reverse=True, key=lambda x: x[0])
|
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_height = 300.0
|
||||||
ts_h_offs = -390.0
|
ts_h_offs = -390.0
|
||||||
tval = 6.4
|
tval = 6.4
|
||||||
@ -372,39 +375,40 @@ class TeamSeriesVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
|||||||
v_offs = 0.0
|
v_offs = 0.0
|
||||||
tdelay += len(player_entries) * 8 * t_incr
|
tdelay += len(player_entries) * 8 * t_incr
|
||||||
for _score, name, prec in player_entries:
|
for _score, name, prec in player_entries:
|
||||||
tdelay -= 4 * t_incr
|
if prec.player.in_game:
|
||||||
v_offs -= 40
|
tdelay -= 4 * t_incr
|
||||||
Text(
|
v_offs -= 40
|
||||||
(
|
Text(
|
||||||
str(prec.team.customdata['score'])
|
(
|
||||||
if self._is_ffa
|
str(prec.team.customdata['score'])
|
||||||
else str(prec.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),
|
color=(0.5, 0.5, 0.5, 1.0),
|
||||||
h_align=Text.HAlign.RIGHT,
|
position=(ts_h_offs + 230, ts_height / 2 + v_offs),
|
||||||
transition=Text.Transition.IN_RIGHT,
|
h_align=Text.HAlign.RIGHT,
|
||||||
transition_delay=tdelay,
|
transition=Text.Transition.IN_RIGHT,
|
||||||
).autoretain()
|
transition_delay=tdelay,
|
||||||
tdelay -= 4 * t_incr
|
).autoretain()
|
||||||
|
tdelay -= 4 * t_incr
|
||||||
|
|
||||||
Image(
|
Image(
|
||||||
prec.get_icon(),
|
prec.get_icon(),
|
||||||
position=(ts_h_offs - 72, ts_height / 2 + v_offs + 15),
|
position=(ts_h_offs - 72, ts_height / 2 + v_offs + 15),
|
||||||
scale=(30, 30),
|
scale=(30, 30),
|
||||||
transition=Image.Transition.IN_LEFT,
|
transition=Image.Transition.IN_LEFT,
|
||||||
transition_delay=tdelay,
|
transition_delay=tdelay,
|
||||||
).autoretain()
|
).autoretain()
|
||||||
Text(
|
Text(
|
||||||
bs.Lstr(value=name),
|
bs.Lstr(value=name),
|
||||||
position=(ts_h_offs - 50, ts_height / 2 + v_offs + 15),
|
position=(ts_h_offs - 50, ts_height / 2 + v_offs + 15),
|
||||||
h_align=Text.HAlign.LEFT,
|
h_align=Text.HAlign.LEFT,
|
||||||
v_align=Text.VAlign.CENTER,
|
v_align=Text.VAlign.CENTER,
|
||||||
maxwidth=180,
|
maxwidth=180,
|
||||||
color=bs.safecolor(prec.team.color + (1,)),
|
color=bs.safecolor(prec.team.color + (1,)),
|
||||||
transition=Text.Transition.IN_RIGHT,
|
transition=Text.Transition.IN_RIGHT,
|
||||||
transition_delay=tdelay,
|
transition_delay=tdelay,
|
||||||
).autoretain()
|
).autoretain()
|
||||||
|
|
||||||
bs.timer(15.0, bs.WeakCall(self._show_tips))
|
bs.timer(15.0, bs.WeakCall(self._show_tips))
|
||||||
|
|
||||||
@ -435,23 +439,32 @@ class TeamSeriesVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
|
|||||||
else:
|
else:
|
||||||
offs_v = -80.0
|
offs_v = -80.0
|
||||||
if len(team.players) == 1:
|
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(
|
i = Image(
|
||||||
team.players[0].get_icon(),
|
icon,
|
||||||
position=(0, 143),
|
position=(0, 143),
|
||||||
scale=(100, 100),
|
scale=(100, 100),
|
||||||
).autoretain()
|
).autoretain()
|
||||||
assert i.node
|
assert i.node
|
||||||
bs.animate(i.node, 'opacity', {0.0: 0.0, 0.25: 1.0})
|
bs.animate(i.node, 'opacity', {0.0: 0.0, 0.25: 1.0})
|
||||||
ZoomText(
|
|
||||||
bs.Lstr(
|
ZoomText(
|
||||||
value=team.players[0].getname(full=True, icon=False)
|
bs.Lstr(value=player_name),
|
||||||
),
|
position=(0, 97 + offs_v + (60 if icon is None else 0)),
|
||||||
position=(0, 97 + offs_v),
|
color=team.color,
|
||||||
color=team.color,
|
scale=1.15,
|
||||||
scale=1.15,
|
jitter=1.0,
|
||||||
jitter=1.0,
|
maxwidth=250,
|
||||||
maxwidth=250,
|
).autoretain()
|
||||||
).autoretain()
|
|
||||||
|
|
||||||
s_extra = 1.0 if self._is_ffa else 1.0
|
s_extra = 1.0 if self._is_ffa else 1.0
|
||||||
|
|
||||||
|
|||||||
@ -415,6 +415,7 @@ class Scoreboard:
|
|||||||
team: bs.Team,
|
team: bs.Team,
|
||||||
score: float,
|
score: float,
|
||||||
max_score: float | None = None,
|
max_score: float | None = None,
|
||||||
|
*,
|
||||||
countdown: bool = False,
|
countdown: bool = False,
|
||||||
flash: bool = True,
|
flash: bool = True,
|
||||||
show_value: bool = True,
|
show_value: bool = True,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user