mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 10:33:22 +08:00
Merge 2787d74169
into be05f2a1c2
This commit is contained in:
commit
202b4a46b2
@ -26,6 +26,9 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
|
||||
public partial class RoundRow : CompositeDrawable, IModelBacked<TournamentRound>
|
||||
{
|
||||
[Resolved]
|
||||
private TournamentGameBase? game { get; set; }
|
||||
|
||||
public TournamentRound Model { get; }
|
||||
|
||||
[Resolved]
|
||||
@ -38,6 +41,12 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
{
|
||||
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;
|
||||
CornerRadius = 10;
|
||||
|
||||
@ -122,6 +131,22 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
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
|
||||
{
|
||||
private readonly TournamentRound round;
|
||||
@ -154,6 +179,9 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
|
||||
public partial class RoundBeatmapRow : CompositeDrawable
|
||||
{
|
||||
[Resolved]
|
||||
private TournamentGameBase? game { get; set; }
|
||||
|
||||
public RoundBeatmap Model { get; }
|
||||
|
||||
[Resolved]
|
||||
@ -232,7 +260,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
beatmapId.Value = Model.ID;
|
||||
beatmapId.Default = beatmapId.Value = Model.ID;
|
||||
beatmapId.BindValueChanged(id =>
|
||||
{
|
||||
Model.ID = id.NewValue ?? 0;
|
||||
@ -263,8 +291,16 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
API.Queue(req);
|
||||
}, true);
|
||||
|
||||
mods.Value = Model.Mods;
|
||||
mods.Default = mods.Value = Model.Mods;
|
||||
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(() =>
|
||||
|
@ -34,10 +34,16 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
{
|
||||
public SeedingResult Model { get; }
|
||||
|
||||
[Resolved]
|
||||
private TournamentGameBase? game { get; set; }
|
||||
|
||||
public SeedingResultRow(TournamentTeam team, SeedingResult round)
|
||||
{
|
||||
Model = round;
|
||||
|
||||
Model.Mod.Default = Model.Mod.Value;
|
||||
Model.Seed.Default = Model.Seed.Value;
|
||||
|
||||
Masking = true;
|
||||
CornerRadius = 10;
|
||||
|
||||
@ -104,6 +110,18 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
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
|
||||
{
|
||||
private readonly SeedingResult round;
|
||||
@ -137,6 +155,9 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
private readonly SeedingResult result;
|
||||
public SeedingBeatmap Model { get; }
|
||||
|
||||
[Resolved]
|
||||
private TournamentGameBase? game { get; set; }
|
||||
|
||||
[Resolved]
|
||||
protected IAPIProvider API { get; private set; } = null!;
|
||||
|
||||
@ -221,7 +242,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
beatmapId.Value = Model.ID;
|
||||
beatmapId.Default = beatmapId.Value = Model.ID;
|
||||
beatmapId.BindValueChanged(id =>
|
||||
{
|
||||
Model.ID = id.NewValue ?? 0;
|
||||
@ -252,8 +273,19 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
API.Queue(req);
|
||||
}, 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));
|
||||
|
||||
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()
|
||||
|
@ -71,10 +71,19 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[Resolved]
|
||||
private LadderInfo ladderInfo { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private TournamentGameBase? game { get; set; }
|
||||
|
||||
public TeamRow(TournamentTeam team, TournamentScreen parent)
|
||||
{
|
||||
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;
|
||||
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>
|
||||
{
|
||||
public override LocalisableString TooltipText => Current.Value == 0 ? "N/A" : base.TooltipText;
|
||||
@ -283,7 +308,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
playerId.Value = user.OnlineID;
|
||||
playerId.Default = playerId.Value = user.OnlineID;
|
||||
playerId.BindValueChanged(id =>
|
||||
{
|
||||
user.OnlineID = id.NewValue ?? 0;
|
||||
@ -299,6 +324,13 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
|
||||
game.PopulatePlayer(user, updatePanel, updatePanel);
|
||||
}, true);
|
||||
|
||||
game.IsSaveTriggered.BindValueChanged(state =>
|
||||
{
|
||||
if (!state.NewValue) return;
|
||||
|
||||
playerId.Default = playerId.Value;
|
||||
});
|
||||
}
|
||||
|
||||
private void updatePanel() => Scheduler.AddOnce(() =>
|
||||
|
@ -63,6 +63,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
{
|
||||
LabelText = "Show specific team",
|
||||
Current = currentTeam,
|
||||
ShowsDefaultIndicator = false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
@ -36,6 +37,8 @@ namespace osu.Game.Tournament
|
||||
private FileBasedIPC ipc = null!;
|
||||
private BeatmapLookupCache beatmapCache = null!;
|
||||
|
||||
public BindableBool IsSaveTriggered = new BindableBool(false);
|
||||
|
||||
protected Task BracketLoadTask => bracketLoadTaskCompletionSource.Task;
|
||||
|
||||
private readonly TaskCompletionSource<bool> bracketLoadTaskCompletionSource = new TaskCompletionSource<bool>();
|
||||
@ -329,7 +332,9 @@ namespace osu.Game.Tournament
|
||||
return;
|
||||
}
|
||||
|
||||
IsSaveTriggered.Value = true;
|
||||
saveChanges();
|
||||
IsSaveTriggered.Value = false;
|
||||
}
|
||||
|
||||
private void saveChanges()
|
||||
|
Loading…
Reference in New Issue
Block a user