1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-05 10:23:20 +08:00

Add missing revert default value handling for SeedingEditorScreen

This commit is contained in:
CloneWith 2024-10-05 16:07:45 +08:00
parent 5c7ceedd06
commit 2787d74169
No known key found for this signature in database
GPG Key ID: F4FC0D1E91D7FFD5

View File

@ -34,10 +34,16 @@ namespace osu.Game.Tournament.Screens.Editors
{ {
public SeedingResult Model { get; } public SeedingResult Model { get; }
[Resolved]
private TournamentGameBase? game { get; set; }
public SeedingResultRow(TournamentTeam team, SeedingResult round) public SeedingResultRow(TournamentTeam team, SeedingResult round)
{ {
Model = round; Model = round;
Model.Mod.Default = Model.Mod.Value;
Model.Seed.Default = Model.Seed.Value;
Masking = true; Masking = true;
CornerRadius = 10; CornerRadius = 10;
@ -104,6 +110,18 @@ namespace osu.Game.Tournament.Screens.Editors
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
} }
[BackgroundDependencyLoader]
private void load()
{
game?.IsSaveTriggered.BindValueChanged(state =>
{
if (!state.NewValue) return;
Model.Mod.Default = Model.Mod.Value;
Model.Seed.Default = Model.Seed.Value;
});
}
public partial class SeedingBeatmapEditor : CompositeDrawable public partial class SeedingBeatmapEditor : CompositeDrawable
{ {
private readonly SeedingResult round; private readonly SeedingResult round;
@ -137,6 +155,9 @@ namespace osu.Game.Tournament.Screens.Editors
private readonly SeedingResult result; private readonly SeedingResult result;
public SeedingBeatmap Model { get; } public SeedingBeatmap Model { get; }
[Resolved]
private TournamentGameBase? game { get; set; }
[Resolved] [Resolved]
protected IAPIProvider API { get; private set; } = null!; protected IAPIProvider API { get; private set; } = null!;
@ -252,8 +273,19 @@ namespace osu.Game.Tournament.Screens.Editors
API.Queue(req); API.Queue(req);
}, true); }, true);
score.Value = Model.Score.ToString(); Model.Seed.Default = Model.Seed.Value;
score.Default = score.Value = Model.Score.ToString();
score.BindValueChanged(str => long.TryParse(str.NewValue, out Model.Score)); score.BindValueChanged(str => long.TryParse(str.NewValue, out Model.Score));
game?.IsSaveTriggered.BindValueChanged(state =>
{
if (!state.NewValue) return;
beatmapId.Default = beatmapId.Value;
Model.Seed.Default = Model.Seed.Value;
score.Default = score.Value;
});
} }
private void updatePanel() private void updatePanel()