mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:07:52 +08:00
let MatchIPCInfo .Beatmap be nullable
This commit is contained in:
parent
5898a9986b
commit
5ad80879b7
@ -29,7 +29,7 @@ namespace osu.Game.Tournament.Components
|
||||
[Resolved]
|
||||
private IBindable<RulesetInfo> ruleset { get; set; } = null!;
|
||||
|
||||
public TournamentBeatmap Beatmap
|
||||
public TournamentBeatmap? Beatmap
|
||||
{
|
||||
set
|
||||
{
|
||||
|
@ -87,12 +87,13 @@ namespace osu.Game.Tournament.IPC
|
||||
|
||||
var existing = ladder.CurrentMatch.Value?.Round.Value?.Beatmaps.FirstOrDefault(b => b.ID == beatmapId);
|
||||
|
||||
if (existing?.Beatmap != null)
|
||||
if (existing != null)
|
||||
Beatmap.Value = existing.Beatmap;
|
||||
else
|
||||
{
|
||||
beatmapLookupRequest = new GetBeatmapRequest(new APIBeatmap { OnlineID = beatmapId });
|
||||
beatmapLookupRequest.Success += b => Beatmap.Value = new TournamentBeatmap(b);
|
||||
beatmapLookupRequest.Failure += _ => Beatmap.Value = null;
|
||||
API.Queue(beatmapLookupRequest);
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Tournament.IPC
|
||||
{
|
||||
public partial class MatchIPCInfo : Component
|
||||
{
|
||||
public Bindable<TournamentBeatmap> Beatmap { get; } = new Bindable<TournamentBeatmap>();
|
||||
public Bindable<TournamentBeatmap?> Beatmap { get; } = new Bindable<TournamentBeatmap?>();
|
||||
public Bindable<LegacyMods> Mods { get; } = new Bindable<LegacyMods>();
|
||||
public Bindable<TourneyState> State { get; } = new Bindable<TourneyState>();
|
||||
public Bindable<string> ChatChannel { get; } = new Bindable<string>();
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Tournament.Screens
|
||||
SongBar.Mods = mods.NewValue;
|
||||
}
|
||||
|
||||
private void beatmapChanged(ValueChangedEvent<TournamentBeatmap> beatmap)
|
||||
private void beatmapChanged(ValueChangedEvent<TournamentBeatmap?> beatmap)
|
||||
{
|
||||
SongBar.FadeInFromZero(300, Easing.OutQuint);
|
||||
SongBar.Beatmap = beatmap.NewValue;
|
||||
|
@ -121,13 +121,13 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
splitMapPoolByMods.BindValueChanged(_ => updateDisplay());
|
||||
}
|
||||
|
||||
private void beatmapChanged(ValueChangedEvent<TournamentBeatmap> beatmap)
|
||||
private void beatmapChanged(ValueChangedEvent<TournamentBeatmap?> beatmap)
|
||||
{
|
||||
if (CurrentMatch.Value == null || CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) < 2)
|
||||
return;
|
||||
|
||||
// if bans have already been placed, beatmap changes result in a selection being made autoamtically
|
||||
if (beatmap.NewValue.OnlineID > 0)
|
||||
if (beatmap.NewValue?.OnlineID > 0)
|
||||
addForBeatmap(beatmap.NewValue.OnlineID);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user