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