1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-05 10:23:20 +08:00
This commit is contained in:
复予 2024-12-03 13:41:45 +08:00 committed by GitHub
commit 26a47be32c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 111 additions and 5 deletions

View File

@ -26,6 +26,9 @@ namespace osu.Game.Tournament.Screens.Editors
public partial class RoundRow : CompositeDrawable, IModelBacked<TournamentRound> public partial class RoundRow : CompositeDrawable, IModelBacked<TournamentRound>
{ {
[Resolved]
private TournamentGameBase? game { get; set; }
public TournamentRound Model { get; } public TournamentRound Model { get; }
[Resolved] [Resolved]
@ -38,6 +41,12 @@ namespace osu.Game.Tournament.Screens.Editors
{ {
Model = round; Model = round;
Model.Name.Default = Model.Name.Value;
Model.Description.Default = Model.Description.Value;
Model.StartDate.Default = Model.StartDate.Value;
Model.BanCount.Default = Model.BanCount.Value;
Model.BestOf.Default = Model.BestOf.Value;
Masking = true; Masking = true;
CornerRadius = 10; CornerRadius = 10;
@ -122,6 +131,22 @@ namespace osu.Game.Tournament.Screens.Editors
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
} }
[BackgroundDependencyLoader]
private void load()
{
// TournamentGameBase won't be loaded so early, probably binding the event here
game?.IsSaveTriggered.BindValueChanged(state =>
{
if (!state.NewValue) return;
Model.Name.Default = Model.Name.Value;
Model.Description.Default = Model.Description.Value;
Model.StartDate.Default = Model.StartDate.Value;
Model.BanCount.Default = Model.BanCount.Value;
Model.BestOf.Default = Model.BestOf.Value;
});
}
public partial class RoundBeatmapEditor : CompositeDrawable public partial class RoundBeatmapEditor : CompositeDrawable
{ {
private readonly TournamentRound round; private readonly TournamentRound round;
@ -154,6 +179,9 @@ namespace osu.Game.Tournament.Screens.Editors
public partial class RoundBeatmapRow : CompositeDrawable public partial class RoundBeatmapRow : CompositeDrawable
{ {
[Resolved]
private TournamentGameBase? game { get; set; }
public RoundBeatmap Model { get; } public RoundBeatmap Model { get; }
[Resolved] [Resolved]
@ -232,7 +260,7 @@ namespace osu.Game.Tournament.Screens.Editors
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
beatmapId.Value = Model.ID; beatmapId.Default = beatmapId.Value = Model.ID;
beatmapId.BindValueChanged(id => beatmapId.BindValueChanged(id =>
{ {
Model.ID = id.NewValue ?? 0; Model.ID = id.NewValue ?? 0;
@ -263,8 +291,16 @@ namespace osu.Game.Tournament.Screens.Editors
API.Queue(req); API.Queue(req);
}, true); }, true);
mods.Value = Model.Mods; mods.Default = mods.Value = Model.Mods;
mods.BindValueChanged(modString => Model.Mods = modString.NewValue); mods.BindValueChanged(modString => Model.Mods = modString.NewValue);
game?.IsSaveTriggered.BindValueChanged(state =>
{
if (!state.NewValue) return;
beatmapId.Default = beatmapId.Value;
mods.Default = mods.Value;
});
} }
private void updatePanel() => Schedule(() => private void updatePanel() => Schedule(() =>

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!;
@ -221,7 +242,7 @@ namespace osu.Game.Tournament.Screens.Editors
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
beatmapId.Value = Model.ID; beatmapId.Default = beatmapId.Value = Model.ID;
beatmapId.BindValueChanged(id => beatmapId.BindValueChanged(id =>
{ {
Model.ID = id.NewValue ?? 0; Model.ID = id.NewValue ?? 0;
@ -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()

View File

@ -71,10 +71,19 @@ namespace osu.Game.Tournament.Screens.Editors
[Resolved] [Resolved]
private LadderInfo ladderInfo { get; set; } = null!; private LadderInfo ladderInfo { get; set; } = null!;
[Resolved]
private TournamentGameBase? game { get; set; }
public TeamRow(TournamentTeam team, TournamentScreen parent) public TeamRow(TournamentTeam team, TournamentScreen parent)
{ {
Model = team; Model = team;
Model.FullName.Default = Model.FullName.Value;
Model.Acronym.Default = Model.Acronym.Value;
Model.FlagName.Default = Model.FlagName.Value;
Model.LastYearPlacing.Default = Model.LastYearPlacing.Value;
Model.Seed.Default = Model.Seed.Value;
Masking = true; Masking = true;
CornerRadius = 10; CornerRadius = 10;
@ -177,6 +186,22 @@ namespace osu.Game.Tournament.Screens.Editors
}; };
} }
[BackgroundDependencyLoader]
private void load()
{
// TournamentGameBase won't be loaded so early, probably binding the event here
game?.IsSaveTriggered.BindValueChanged(state =>
{
if (!state.NewValue) return;
Model.FullName.Default = Model.FullName.Value;
Model.Acronym.Default = Model.Acronym.Value;
Model.FlagName.Default = Model.FlagName.Value;
Model.LastYearPlacing.Default = Model.LastYearPlacing.Value;
Model.Seed.Default = Model.Seed.Value;
});
}
private partial class LastYearPlacementSlider : RoundedSliderBar<int> private partial class LastYearPlacementSlider : RoundedSliderBar<int>
{ {
public override LocalisableString TooltipText => Current.Value == 0 ? "N/A" : base.TooltipText; public override LocalisableString TooltipText => Current.Value == 0 ? "N/A" : base.TooltipText;
@ -283,7 +308,7 @@ namespace osu.Game.Tournament.Screens.Editors
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
playerId.Value = user.OnlineID; playerId.Default = playerId.Value = user.OnlineID;
playerId.BindValueChanged(id => playerId.BindValueChanged(id =>
{ {
user.OnlineID = id.NewValue ?? 0; user.OnlineID = id.NewValue ?? 0;
@ -299,6 +324,13 @@ namespace osu.Game.Tournament.Screens.Editors
game.PopulatePlayer(user, updatePanel, updatePanel); game.PopulatePlayer(user, updatePanel, updatePanel);
}, true); }, true);
game.IsSaveTriggered.BindValueChanged(state =>
{
if (!state.NewValue) return;
playerId.Default = playerId.Value;
});
} }
private void updatePanel() => Scheduler.AddOnce(() => private void updatePanel() => Scheduler.AddOnce(() =>

View File

@ -63,6 +63,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
{ {
LabelText = "Show specific team", LabelText = "Show specific team",
Current = currentTeam, Current = currentTeam,
ShowsDefaultIndicator = false,
} }
} }
} }

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
@ -36,6 +37,8 @@ namespace osu.Game.Tournament
private FileBasedIPC ipc = null!; private FileBasedIPC ipc = null!;
private BeatmapLookupCache beatmapCache = null!; private BeatmapLookupCache beatmapCache = null!;
public BindableBool IsSaveTriggered = new BindableBool(false);
protected Task BracketLoadTask => bracketLoadTaskCompletionSource.Task; protected Task BracketLoadTask => bracketLoadTaskCompletionSource.Task;
private readonly TaskCompletionSource<bool> bracketLoadTaskCompletionSource = new TaskCompletionSource<bool>(); private readonly TaskCompletionSource<bool> bracketLoadTaskCompletionSource = new TaskCompletionSource<bool>();
@ -329,7 +332,9 @@ namespace osu.Game.Tournament
return; return;
} }
IsSaveTriggered.Value = true;
saveChanges(); saveChanges();
IsSaveTriggered.Value = false;
} }
private void saveChanges() private void saveChanges()