mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 16:32:54 +08:00
Merge pull request #19101 from peppy/fix-gameplay-screen-update-teams
Fix gameplay screen not updating with changes in various editors
This commit is contained in:
commit
b04a4450fe
@ -12,7 +12,8 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
public class TournamentSpriteTextWithBackground : CompositeDrawable
|
||||
{
|
||||
protected readonly TournamentSpriteText Text;
|
||||
public readonly TournamentSpriteText Text;
|
||||
|
||||
protected readonly Box Background;
|
||||
|
||||
public TournamentSpriteTextWithBackground(string text = "")
|
||||
|
@ -1,8 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Bindables;
|
||||
|
||||
@ -13,7 +11,7 @@ namespace osu.Game.Tournament.Models
|
||||
public int ID;
|
||||
|
||||
[JsonProperty("BeatmapInfo")]
|
||||
public TournamentBeatmap Beatmap;
|
||||
public TournamentBeatmap? Beatmap;
|
||||
|
||||
public long Score;
|
||||
|
||||
|
@ -16,6 +16,10 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
{
|
||||
private readonly TeamScore score;
|
||||
|
||||
private readonly TournamentSpriteTextWithBackground teamText;
|
||||
|
||||
private readonly Bindable<string> teamName = new Bindable<string>("???");
|
||||
|
||||
private bool showScore;
|
||||
|
||||
public bool ShowScore
|
||||
@ -93,7 +97,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
}
|
||||
}
|
||||
},
|
||||
new TournamentSpriteTextWithBackground(team?.FullName.Value ?? "???")
|
||||
teamText = new TournamentSpriteTextWithBackground
|
||||
{
|
||||
Scale = new Vector2(0.5f),
|
||||
Origin = anchor,
|
||||
@ -113,6 +117,11 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
|
||||
updateDisplay();
|
||||
FinishTransforms(true);
|
||||
|
||||
if (Team != null)
|
||||
teamName.BindTo(Team.FullName);
|
||||
|
||||
teamName.BindValueChanged(name => teamText.Text.Text = name.NewValue, true);
|
||||
}
|
||||
|
||||
private void updateDisplay()
|
||||
|
@ -42,6 +42,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
currentMatch.BindTo(ladder.CurrentMatch);
|
||||
currentMatch.BindValueChanged(matchChanged);
|
||||
|
||||
currentTeam.BindValueChanged(teamChanged);
|
||||
|
||||
updateMatch();
|
||||
}
|
||||
|
||||
@ -67,7 +69,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
|
||||
// team may change to same team, which means score is not in a good state.
|
||||
// thus we handle this manually.
|
||||
teamChanged(currentTeam.Value);
|
||||
currentTeam.TriggerChange();
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
@ -88,11 +90,11 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
private void teamChanged(TournamentTeam team)
|
||||
private void teamChanged(ValueChangedEvent<TournamentTeam> team)
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
teamDisplay = new TeamDisplay(team, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0),
|
||||
teamDisplay = new TeamDisplay(team.NewValue, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -69,7 +70,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
currentTeam.BindValueChanged(teamChanged, true);
|
||||
}
|
||||
|
||||
private void teamChanged(ValueChangedEvent<TournamentTeam> team)
|
||||
private void teamChanged(ValueChangedEvent<TournamentTeam> team) => Scheduler.AddOnce(() =>
|
||||
{
|
||||
if (team.NewValue == null)
|
||||
{
|
||||
@ -78,7 +79,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
}
|
||||
|
||||
showTeam(team.NewValue);
|
||||
}
|
||||
});
|
||||
|
||||
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
{
|
||||
@ -120,8 +121,14 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
foreach (var seeding in team.SeedingResults)
|
||||
{
|
||||
fill.Add(new ModRow(seeding.Mod.Value, seeding.Seed.Value));
|
||||
|
||||
foreach (var beatmap in seeding.Beatmaps)
|
||||
{
|
||||
if (beatmap.Beatmap == null)
|
||||
continue;
|
||||
|
||||
fill.Add(new BeatmapScoreRow(beatmap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,6 +136,8 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
{
|
||||
public BeatmapScoreRow(SeedingBeatmap beatmap)
|
||||
{
|
||||
Debug.Assert(beatmap.Beatmap != null);
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
@ -157,7 +166,8 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new TournamentSpriteText { Text = beatmap.Score.ToString("#,0"), Colour = TournamentGame.TEXT_COLOUR, Width = 80 },
|
||||
new TournamentSpriteText { Text = "#" + beatmap.Seed.Value.ToString("#,0"), Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular) },
|
||||
new TournamentSpriteText
|
||||
{ Text = "#" + beatmap.Seed.Value.ToString("#,0"), Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular) },
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
||||
|
||||
private bool firstDisplay = true;
|
||||
|
||||
private void update() => Schedule(() =>
|
||||
private void update() => Scheduler.AddOnce(() =>
|
||||
{
|
||||
var match = CurrentMatch.Value;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user