1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

Rename all usages of APIBeatmap to beatmap in tournament namespace

This commit is contained in:
Dean Herbert 2021-10-27 18:25:23 +09:00
parent 5448b94039
commit f1499641f3
14 changed files with 65 additions and 61 deletions

View File

@ -44,8 +44,8 @@ namespace osu.Game.Tournament.Tests.NonVisual
{
Beatmaps =
{
new RoundBeatmap { BeatmapInfo = TournamentTestScene.CreateSampleBeatmap() },
new RoundBeatmap { BeatmapInfo = TournamentTestScene.CreateSampleBeatmap() },
new RoundBeatmap { Beatmap = TournamentTestScene.CreateSampleBeatmap() },
new RoundBeatmap { Beatmap = TournamentTestScene.CreateSampleBeatmap() },
}
}
},

View File

@ -132,7 +132,7 @@ namespace osu.Game.Tournament.Tests.Screens
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Add(new RoundBeatmap
{
BeatmapInfo = CreateSampleBeatmap(),
Beatmap = CreateSampleBeatmap(),
Mods = mods
});
}

View File

@ -73,19 +73,19 @@ namespace osu.Game.Tournament.Tests
{
new SeedingBeatmap
{
BeatmapInfo = CreateSampleBeatmap(),
Beatmap = CreateSampleBeatmap(),
Score = 12345672,
Seed = { Value = 24 },
},
new SeedingBeatmap
{
BeatmapInfo = CreateSampleBeatmap(),
Beatmap = CreateSampleBeatmap(),
Score = 1234567,
Seed = { Value = 12 },
},
new SeedingBeatmap
{
BeatmapInfo = CreateSampleBeatmap(),
Beatmap = CreateSampleBeatmap(),
Score = 1234567,
Seed = { Value = 16 },
}
@ -99,19 +99,19 @@ namespace osu.Game.Tournament.Tests
{
new SeedingBeatmap
{
BeatmapInfo = CreateSampleBeatmap(),
Beatmap = CreateSampleBeatmap(),
Score = 234567,
Seed = { Value = 3 },
},
new SeedingBeatmap
{
BeatmapInfo = CreateSampleBeatmap(),
Beatmap = CreateSampleBeatmap(),
Score = 234567,
Seed = { Value = 6 },
},
new SeedingBeatmap
{
BeatmapInfo = CreateSampleBeatmap(),
Beatmap = CreateSampleBeatmap(),
Score = 234567,
Seed = { Value = 12 },
}

View File

@ -22,21 +22,21 @@ namespace osu.Game.Tournament.Components
{
public class SongBar : CompositeDrawable
{
private APIBeatmap beatmapInfo;
private APIBeatmap beatmap;
public const float HEIGHT = 145 / 2f;
[Resolved]
private IBindable<RulesetInfo> ruleset { get; set; }
public APIBeatmap BeatmapInfo
public APIBeatmap Beatmap
{
set
{
if (beatmapInfo == value)
if (beatmap == value)
return;
beatmapInfo = value;
beatmap = value;
update();
}
}
@ -95,18 +95,18 @@ namespace osu.Game.Tournament.Components
private void update()
{
if (beatmapInfo == null)
if (beatmap == null)
{
flow.Clear();
return;
}
double bpm = beatmapInfo.BPM; // TODO: check this works.
double length = beatmapInfo.Length;
double bpm = beatmap.BPM; // TODO: check this works.
double length = beatmap.Length;
string hardRockExtra = "";
string srExtra = "";
float ar = beatmapInfo.Difficulty.ApproachRate;
float ar = beatmap.Difficulty.ApproachRate;
if ((mods & LegacyMods.HardRock) > 0)
{
@ -132,9 +132,9 @@ namespace osu.Game.Tournament.Components
default:
stats = new (string heading, string content)[]
{
("CS", $"{beatmapInfo.Difficulty.CircleSize:0.#}{hardRockExtra}"),
("CS", $"{beatmap.Difficulty.CircleSize:0.#}{hardRockExtra}"),
("AR", $"{ar:0.#}{hardRockExtra}"),
("OD", $"{beatmapInfo.Difficulty.OverallDifficulty:0.#}{hardRockExtra}"),
("OD", $"{beatmap.Difficulty.OverallDifficulty:0.#}{hardRockExtra}"),
};
break;
@ -142,15 +142,15 @@ namespace osu.Game.Tournament.Components
case 3:
stats = new (string heading, string content)[]
{
("OD", $"{beatmapInfo.Difficulty.OverallDifficulty:0.#}{hardRockExtra}"),
("HP", $"{beatmapInfo.Difficulty.DrainRate:0.#}{hardRockExtra}")
("OD", $"{beatmap.Difficulty.OverallDifficulty:0.#}{hardRockExtra}"),
("HP", $"{beatmap.Difficulty.DrainRate:0.#}{hardRockExtra}")
};
break;
case 2:
stats = new (string heading, string content)[]
{
("CS", $"{beatmapInfo.Difficulty.CircleSize:0.#}{hardRockExtra}"),
("CS", $"{beatmap.Difficulty.CircleSize:0.#}{hardRockExtra}"),
("AR", $"{ar:0.#}"),
};
break;
@ -186,7 +186,7 @@ namespace osu.Game.Tournament.Components
Children = new Drawable[]
{
new DiffPiece(stats),
new DiffPiece(("Star Rating", $"{beatmapInfo.StarRating:0.#}{srExtra}"))
new DiffPiece(("Star Rating", $"{beatmap.StarRating:0.#}{srExtra}"))
}
},
new FillFlowContainer
@ -229,7 +229,7 @@ namespace osu.Game.Tournament.Components
}
}
},
new TournamentBeatmapPanel(beatmapInfo)
new TournamentBeatmapPanel(beatmap)
{
RelativeSizeAxes = Axes.X,
Width = 0.5f,

View File

@ -21,7 +21,7 @@ namespace osu.Game.Tournament.Components
{
public class TournamentBeatmapPanel : CompositeDrawable
{
public readonly APIBeatmap BeatmapInfo;
public readonly APIBeatmap Beatmap;
private readonly string mod;
@ -33,11 +33,11 @@ namespace osu.Game.Tournament.Components
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private Box flash;
public TournamentBeatmapPanel(APIBeatmap beatmapInfo, string mod = null)
public TournamentBeatmapPanel(APIBeatmap beatmap, string mod = null)
{
if (beatmapInfo == null) throw new ArgumentNullException(nameof(beatmapInfo));
if (beatmap == null) throw new ArgumentNullException(nameof(beatmap));
BeatmapInfo = beatmapInfo;
Beatmap = beatmap;
this.mod = mod;
Width = 400;
@ -63,7 +63,7 @@ namespace osu.Game.Tournament.Components
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.5f),
BeatmapSet = BeatmapInfo.BeatmapSet,
BeatmapSet = Beatmap.BeatmapSet,
},
new FillFlowContainer
{
@ -76,7 +76,7 @@ namespace osu.Game.Tournament.Components
{
new TournamentSpriteText
{
Text = BeatmapInfo.GetDisplayTitleRomanisable(false),
Text = Beatmap.GetDisplayTitleRomanisable(false),
Font = OsuFont.Torus.With(weight: FontWeight.Bold),
},
new FillFlowContainer
@ -93,7 +93,7 @@ namespace osu.Game.Tournament.Components
},
new TournamentSpriteText
{
Text = BeatmapInfo.Metadata?.Author,
Text = Beatmap.Metadata?.Author,
Padding = new MarginPadding { Right = 20 },
Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 14)
},
@ -105,7 +105,7 @@ namespace osu.Game.Tournament.Components
},
new TournamentSpriteText
{
Text = BeatmapInfo.DifficultyName,
Text = Beatmap.DifficultyName,
Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 14)
},
}
@ -149,7 +149,7 @@ namespace osu.Game.Tournament.Components
private void updateState()
{
var found = currentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == BeatmapInfo.OnlineID);
var found = currentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == Beatmap.OnlineID);
bool doFlash = found != choice;
choice = found;

View File

@ -87,10 +87,10 @@ namespace osu.Game.Tournament.IPC
lastBeatmapId = beatmapId;
var existing = ladder.CurrentMatch.Value?.Round.Value?.Beatmaps.FirstOrDefault(b => b.ID == beatmapId && b.BeatmapInfo != null);
var existing = ladder.CurrentMatch.Value?.Round.Value?.Beatmaps.FirstOrDefault(b => b.ID == beatmapId && b.Beatmap != null);
if (existing != null)
Beatmap.Value = existing.BeatmapInfo;
Beatmap.Value = existing.Beatmap;
else
{
beatmapLookupRequest = new GetBeatmapRequest(new APIBeatmap { OnlineID = beatmapId });

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using Newtonsoft.Json;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Tournament.Models
@ -10,6 +11,7 @@ namespace osu.Game.Tournament.Models
public int ID;
public string Mods;
public APIBeatmap BeatmapInfo;
[JsonProperty("BeatmapInfo")]
public APIBeatmap Beatmap;
}
}

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using Newtonsoft.Json;
using osu.Framework.Bindables;
using osu.Game.Online.API.Requests.Responses;
@ -10,7 +11,8 @@ namespace osu.Game.Tournament.Models
{
public int ID;
public APIBeatmap BeatmapInfo;
[JsonProperty("BeatmapInfo")]
public APIBeatmap Beatmap;
public long Score;

View File

@ -40,7 +40,7 @@ namespace osu.Game.Tournament.Screens
private void beatmapChanged(ValueChangedEvent<APIBeatmap> beatmap)
{
SongBar.FadeInFromZero(300, Easing.OutQuint);
SongBar.BeatmapInfo = beatmap.NewValue;
SongBar.Beatmap = beatmap.NewValue;
}
}
}

View File

@ -226,9 +226,9 @@ namespace osu.Game.Tournament.Screens.Editors
Model.ID = id.NewValue ?? 0;
if (id.NewValue != id.OldValue)
Model.BeatmapInfo = null;
Model.Beatmap = null;
if (Model.BeatmapInfo != null)
if (Model.Beatmap != null)
{
updatePanel();
return;
@ -238,13 +238,13 @@ namespace osu.Game.Tournament.Screens.Editors
req.Success += res =>
{
Model.BeatmapInfo = res;
Model.Beatmap = res;
updatePanel();
};
req.Failure += _ =>
{
Model.BeatmapInfo = null;
Model.Beatmap = null;
updatePanel();
};
@ -259,9 +259,9 @@ namespace osu.Game.Tournament.Screens.Editors
{
drawableContainer.Clear();
if (Model.BeatmapInfo != null)
if (Model.Beatmap != null)
{
drawableContainer.Child = new TournamentBeatmapPanel(Model.BeatmapInfo, Model.Mods)
drawableContainer.Child = new TournamentBeatmapPanel(Model.Beatmap, Model.Mods)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,

View File

@ -234,9 +234,9 @@ namespace osu.Game.Tournament.Screens.Editors
Model.ID = id.NewValue ?? 0;
if (id.NewValue != id.OldValue)
Model.BeatmapInfo = null;
Model.Beatmap = null;
if (Model.BeatmapInfo != null)
if (Model.Beatmap != null)
{
updatePanel();
return;
@ -246,13 +246,13 @@ namespace osu.Game.Tournament.Screens.Editors
req.Success += res =>
{
Model.BeatmapInfo = res;
Model.Beatmap = res;
updatePanel();
};
req.Failure += _ =>
{
Model.BeatmapInfo = null;
Model.Beatmap = null;
updatePanel();
};
@ -267,9 +267,9 @@ namespace osu.Game.Tournament.Screens.Editors
{
drawableContainer.Clear();
if (Model.BeatmapInfo != null)
if (Model.Beatmap != null)
{
drawableContainer.Child = new TournamentBeatmapPanel(Model.BeatmapInfo, result.Mod.Value)
drawableContainer.Child = new TournamentBeatmapPanel(Model.Beatmap, result.Mod.Value)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,

View File

@ -147,11 +147,11 @@ namespace osu.Game.Tournament.Screens.MapPool
if (map != null)
{
if (e.Button == MouseButton.Left && map.BeatmapInfo.OnlineID > 0)
addForBeatmap(map.BeatmapInfo.OnlineID);
if (e.Button == MouseButton.Left && map.Beatmap.OnlineID > 0)
addForBeatmap(map.Beatmap.OnlineID);
else
{
var existing = CurrentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == map.BeatmapInfo.OnlineID);
var existing = CurrentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == map.Beatmap.OnlineID);
if (existing != null)
{
@ -179,7 +179,7 @@ namespace osu.Game.Tournament.Screens.MapPool
if (CurrentMatch.Value == null)
return;
if (CurrentMatch.Value.Round.Value.Beatmaps.All(b => b.BeatmapInfo.OnlineID != beatmapId))
if (CurrentMatch.Value.Round.Value.Beatmaps.All(b => b.Beatmap.OnlineID != beatmapId))
// don't attempt to add if the beatmap isn't in our pool
return;
@ -245,7 +245,7 @@ namespace osu.Game.Tournament.Screens.MapPool
flowCount = 1;
}
currentFlow.Add(new TournamentBeatmapPanel(b.BeatmapInfo, b.Mods)
currentFlow.Add(new TournamentBeatmapPanel(b.Beatmap, b.Mods)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,

View File

@ -141,9 +141,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Spacing = new Vector2(5),
Children = new Drawable[]
{
new TournamentSpriteText { Text = beatmap.BeatmapInfo.Metadata.Title, Colour = TournamentGame.TEXT_COLOUR, },
new TournamentSpriteText { Text = beatmap.Beatmap.Metadata.Title, Colour = TournamentGame.TEXT_COLOUR, },
new TournamentSpriteText { Text = "by", Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular) },
new TournamentSpriteText { Text = beatmap.BeatmapInfo.Metadata.Artist, Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular) },
new TournamentSpriteText { Text = beatmap.Beatmap.Metadata.Artist, Colour = TournamentGame.TEXT_COLOUR, Font = OsuFont.Torus.With(weight: FontWeight.Regular) },
}
},
new FillFlowContainer

View File

@ -193,7 +193,7 @@ namespace osu.Game.Tournament
{
var beatmapsRequiringPopulation = ladder.Rounds
.SelectMany(r => r.Beatmaps)
.Where(b => string.IsNullOrEmpty(b.BeatmapInfo?.BeatmapSet?.Title) && b.ID > 0).ToList();
.Where(b => string.IsNullOrEmpty(b.Beatmap?.BeatmapSet?.Title) && b.ID > 0).ToList();
if (beatmapsRequiringPopulation.Count == 0)
return false;
@ -204,7 +204,7 @@ namespace osu.Game.Tournament
var req = new GetBeatmapRequest(new APIBeatmap { OnlineID = b.ID });
API.Perform(req);
b.BeatmapInfo = req.Response ?? new APIBeatmap();
b.Beatmap = req.Response ?? new APIBeatmap();
updateLoadProgressMessage($"Populating round beatmaps ({i} / {beatmapsRequiringPopulation.Count})");
}
@ -220,7 +220,7 @@ namespace osu.Game.Tournament
var beatmapsRequiringPopulation = ladder.Teams
.SelectMany(r => r.SeedingResults)
.SelectMany(r => r.Beatmaps)
.Where(b => string.IsNullOrEmpty(b.BeatmapInfo?.BeatmapSet?.Title) && b.ID > 0).ToList();
.Where(b => string.IsNullOrEmpty(b.Beatmap?.BeatmapSet?.Title) && b.ID > 0).ToList();
if (beatmapsRequiringPopulation.Count == 0)
return false;
@ -231,7 +231,7 @@ namespace osu.Game.Tournament
var req = new GetBeatmapRequest(new APIBeatmap { OnlineID = b.ID });
API.Perform(req);
b.BeatmapInfo = req.Response ?? new APIBeatmap();
b.Beatmap = req.Response ?? new APIBeatmap();
updateLoadProgressMessage($"Populating seeding beatmaps ({i} / {beatmapsRequiringPopulation.Count})");
}