1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 20:47:22 +08:00

Rename OriginalBeatmap back to Beatmap

This commit is contained in:
smoogipoo 2018-05-07 10:29:38 +09:00
parent 7e83c75888
commit 9128e64c9a
20 changed files with 38 additions and 38 deletions

View File

@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Osu
public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap)
{ {
IEnumerable<HitObject> hitObjects = beatmap.OriginalBeatmap.HitObjects; IEnumerable<HitObject> hitObjects = beatmap.Beatmap.HitObjects;
IEnumerable<HitObject> circles = hitObjects.Where(c => !(c is IHasEndTime)); IEnumerable<HitObject> circles = hitObjects.Where(c => !(c is IHasEndTime));
IEnumerable<HitObject> sliders = hitObjects.Where(s => s is IHasCurve); IEnumerable<HitObject> sliders = hitObjects.Where(s => s is IHasCurve);
IEnumerable<HitObject> spinners = hitObjects.Where(s => s is IHasEndTime && !(s is IHasCurve)); IEnumerable<HitObject> spinners = hitObjects.Where(s => s is IHasEndTime && !(s is IHasCurve));

View File

@ -274,13 +274,13 @@ namespace osu.Game.Tests.Beatmaps.IO
foreach (BeatmapInfo b in set.Beatmaps) foreach (BeatmapInfo b in set.Beatmaps)
Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineBeatmapID == b.OnlineBeatmapID)); Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineBeatmapID == b.OnlineBeatmapID));
Assert.IsTrue(set.Beatmaps.Count > 0); Assert.IsTrue(set.Beatmaps.Count > 0);
var beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.OriginalBeatmap; var beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap;
Assert.IsTrue(beatmap?.HitObjects.Any() == true); Assert.IsTrue(beatmap?.HitObjects.Any() == true);
beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.OriginalBeatmap; beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap;
Assert.IsTrue(beatmap?.HitObjects.Any() == true); Assert.IsTrue(beatmap?.HitObjects.Any() == true);
beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.OriginalBeatmap; beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap;
Assert.IsTrue(beatmap?.HitObjects.Any() == true); Assert.IsTrue(beatmap?.HitObjects.Any() == true);
beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.OriginalBeatmap; beatmap = store.GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap;
Assert.IsTrue(beatmap?.HitObjects.Any() == true); Assert.IsTrue(beatmap?.HitObjects.Any() == true);
} }

View File

@ -139,7 +139,7 @@ namespace osu.Game.Tests.Visual
}; };
} }
private SortedList<TimingControlPoint> timingPoints => Beatmap.Value.OriginalBeatmap.ControlPointInfo.TimingPoints; private SortedList<TimingControlPoint> timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints;
private TimingControlPoint getNextTimingPoint(TimingControlPoint current) private TimingControlPoint getNextTimingPoint(TimingControlPoint current)
{ {
if (timingPoints[timingPoints.Count - 1] == current) if (timingPoints[timingPoints.Count - 1] == current)

View File

@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual
}); });
// select part is redundant, but wait for load isn't // select part is redundant, but wait for load isn't
selectBeatmap(beatmap.Value.OriginalBeatmap); selectBeatmap(beatmap.Value.Beatmap);
AddWaitStep(3); AddWaitStep(3);

View File

@ -30,7 +30,7 @@ namespace osu.Game.Beatmaps
this.audioManager = audioManager; this.audioManager = audioManager;
} }
protected override IBeatmap GetOriginalBeatmap() protected override IBeatmap GetBeatmap()
{ {
try try
{ {

View File

@ -40,7 +40,7 @@ namespace osu.Game.Beatmaps
this.game = game; this.game = game;
} }
protected override IBeatmap GetOriginalBeatmap() => new Beatmap(); protected override IBeatmap GetBeatmap() => new Beatmap();
protected override Texture GetBackground() => game.Textures.Get(@"Backgrounds/bg4"); protected override Texture GetBackground() => game.Textures.Get(@"Backgrounds/bg4");

View File

@ -38,7 +38,7 @@ namespace osu.Game.Beatmaps
Mods.ValueChanged += mods => applyRateAdjustments(); Mods.ValueChanged += mods => applyRateAdjustments();
originalBeatmap = new AsyncLazy<IBeatmap>(populateOriginalBeatmap); beatmap = new AsyncLazy<IBeatmap>(populateBeatmap);
background = new AsyncLazy<Texture>(populateBackground, b => b == null || !b.IsDisposed); background = new AsyncLazy<Texture>(populateBackground, b => b == null || !b.IsDisposed);
track = new AsyncLazy<Track>(populateTrack); track = new AsyncLazy<Track>(populateTrack);
waveform = new AsyncLazy<Waveform>(populateWaveform); waveform = new AsyncLazy<Waveform>(populateWaveform);
@ -47,31 +47,31 @@ namespace osu.Game.Beatmaps
} }
/// <summary> /// <summary>
/// Saves the <see cref="Beatmap"/>. /// Saves the <see cref="Beatmaps.Beatmap"/>.
/// </summary> /// </summary>
public void Save() public void Save()
{ {
var path = FileSafety.GetTempPath(Guid.NewGuid().ToString().Replace("-", string.Empty) + ".json"); var path = FileSafety.GetTempPath(Guid.NewGuid().ToString().Replace("-", string.Empty) + ".json");
using (var sw = new StreamWriter(path)) using (var sw = new StreamWriter(path))
sw.WriteLine(OriginalBeatmap.Serialize()); sw.WriteLine(Beatmap.Serialize());
Process.Start(path); Process.Start(path);
} }
protected abstract IBeatmap GetOriginalBeatmap(); protected abstract IBeatmap GetBeatmap();
protected abstract Texture GetBackground(); protected abstract Texture GetBackground();
protected abstract Track GetTrack(); protected abstract Track GetTrack();
protected virtual Skin GetSkin() => new DefaultSkin(); protected virtual Skin GetSkin() => new DefaultSkin();
protected virtual Waveform GetWaveform() => new Waveform(); protected virtual Waveform GetWaveform() => new Waveform();
protected virtual Storyboard GetStoryboard() => new Storyboard { BeatmapInfo = BeatmapInfo }; protected virtual Storyboard GetStoryboard() => new Storyboard { BeatmapInfo = BeatmapInfo };
public bool BeatmapLoaded => originalBeatmap.IsResultAvailable; public bool BeatmapLoaded => beatmap.IsResultAvailable;
public IBeatmap OriginalBeatmap => originalBeatmap.Value.Result; public IBeatmap Beatmap => beatmap.Value.Result;
public async Task<IBeatmap> GetOriginalBeatmapAsync() => await originalBeatmap.Value; public async Task<IBeatmap> GetBeatmapAsync() => await beatmap.Value;
private readonly AsyncLazy<IBeatmap> originalBeatmap; private readonly AsyncLazy<IBeatmap> beatmap;
private IBeatmap populateOriginalBeatmap() private IBeatmap populateBeatmap()
{ {
var b = GetOriginalBeatmap() ?? new Beatmap(); var b = GetBeatmap() ?? new Beatmap();
// use the database-backed info. // use the database-backed info.
b.BeatmapInfo = BeatmapInfo; b.BeatmapInfo = BeatmapInfo;
@ -80,21 +80,21 @@ namespace osu.Game.Beatmaps
} }
/// <summary> /// <summary>
/// Retrieves the resulting <see cref="IBeatmap"/> from the conversion of <see cref="OriginalBeatmap"/> to a specific <see cref="RulesetInfo"/>. /// Retrieves the resulting <see cref="IBeatmap"/> from the conversion of <see cref="Beatmap"/> to a specific <see cref="RulesetInfo"/>.
/// All mods have been applied to the returned <see cref="IBeatmap"/>. /// All mods have been applied to the returned <see cref="IBeatmap"/>.
/// </summary> /// </summary>
/// <param name="ruleset">The <see cref="RulesetInfo"/> to convert <see cref="OriginalBeatmap"/> to.</param> /// <param name="ruleset">The <see cref="RulesetInfo"/> to convert <see cref="Beatmap"/> to.</param>
/// <returns>The converted <see cref="IBeatmap"/>.</returns> /// <returns>The converted <see cref="IBeatmap"/>.</returns>
/// <exception cref="BeatmapInvalidForRulesetException">If <see cref="OriginalBeatmap"/> could not be converted to <paramref name="ruleset"/>.</exception> /// <exception cref="BeatmapInvalidForRulesetException">If <see cref="Beatmap"/> could not be converted to <paramref name="ruleset"/>.</exception>
public IBeatmap GetBeatmap(RulesetInfo ruleset) public IBeatmap GetBeatmap(RulesetInfo ruleset)
{ {
var rulesetInstance = ruleset.CreateInstance(); var rulesetInstance = ruleset.CreateInstance();
IBeatmapConverter converter = rulesetInstance.CreateBeatmapConverter(OriginalBeatmap); IBeatmapConverter converter = rulesetInstance.CreateBeatmapConverter(Beatmap);
// Check if the beatmap can be converted // Check if the beatmap can be converted
if (!converter.CanConvert) if (!converter.CanConvert)
throw new BeatmapInvalidForRulesetException($"{nameof(Beatmap)} can not be converted for the ruleset (ruleset: {ruleset}, converter: {converter})."); throw new BeatmapInvalidForRulesetException($"{nameof(Beatmaps.Beatmap)} can not be converted for the ruleset (ruleset: {ruleset}, converter: {converter}).");
// Apply conversion mods // Apply conversion mods
foreach (var mod in Mods.Value.OfType<IApplicableToBeatmapConverter>()) foreach (var mod in Mods.Value.OfType<IApplicableToBeatmapConverter>())

View File

@ -38,7 +38,7 @@ namespace osu.Game.Graphics.Containers
if (!Beatmap.Value.TrackLoaded || !Beatmap.Value.BeatmapLoaded) return; if (!Beatmap.Value.TrackLoaded || !Beatmap.Value.BeatmapLoaded) return;
var track = Beatmap.Value.Track; var track = Beatmap.Value.Track;
var beatmap = Beatmap.Value.OriginalBeatmap; var beatmap = Beatmap.Value.Beatmap;
if (track == null || beatmap == null) if (track == null || beatmap == null)
return; return;

View File

@ -343,7 +343,7 @@ namespace osu.Game.Overlays
// todo: this can likely be replaced with WorkingBeatmap.GetBeatmapAsync() // todo: this can likely be replaced with WorkingBeatmap.GetBeatmapAsync()
Task.Run(() => Task.Run(() =>
{ {
if (beatmap?.OriginalBeatmap == null) //this is not needed if a placeholder exists if (beatmap?.Beatmap == null) //this is not needed if a placeholder exists
{ {
title.Current = null; title.Current = null;
title.Text = @"Nothing to play"; title.Text = @"Nothing to play";

View File

@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Scoring.Legacy
/* score.FileChecksum = */ /* score.FileChecksum = */
var beatmapHash = sr.ReadString(); var beatmapHash = sr.ReadString();
score.Beatmap = beatmaps.QueryBeatmap(b => b.MD5Hash == beatmapHash); score.Beatmap = beatmaps.QueryBeatmap(b => b.MD5Hash == beatmapHash);
currentBeatmap = beatmaps.GetWorkingBeatmap(score.Beatmap).OriginalBeatmap; currentBeatmap = beatmaps.GetWorkingBeatmap(score.Beatmap).Beatmap;
/* score.PlayerName = */ /* score.PlayerName = */
score.User = new User { Username = sr.ReadString() }; score.User = new User { Username = sr.ReadString() };

View File

@ -17,7 +17,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
protected override void LoadBeatmap(WorkingBeatmap beatmap) protected override void LoadBeatmap(WorkingBeatmap beatmap)
{ {
base.LoadBeatmap(beatmap); base.LoadBeatmap(beatmap);
foreach (var breakPeriod in beatmap.OriginalBeatmap.Breaks) foreach (var breakPeriod in beatmap.Beatmap.Breaks)
Add(new BreakVisualisation(breakPeriod)); Add(new BreakVisualisation(breakPeriod));
} }

View File

@ -20,7 +20,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
{ {
base.LoadBeatmap(beatmap); base.LoadBeatmap(beatmap);
ControlPointInfo cpi = beatmap.OriginalBeatmap.ControlPointInfo; ControlPointInfo cpi = beatmap.Beatmap.ControlPointInfo;
cpi.TimingPoints.ForEach(addTimingPoint); cpi.TimingPoints.ForEach(addTimingPoint);

View File

@ -47,7 +47,7 @@ namespace osu.Game.Screens.Edit
{ {
// TODO: should probably be done at a RulesetContainer level to share logic with Player. // TODO: should probably be done at a RulesetContainer level to share logic with Player.
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock(); var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
clock = new EditorClock(Beatmap.Value.OriginalBeatmap.ControlPointInfo, beatDivisor) { IsCoupled = false }; clock = new EditorClock(Beatmap.Value.Beatmap.ControlPointInfo, beatDivisor) { IsCoupled = false };
clock.ChangeSource(sourceClock); clock.ChangeSource(sourceClock);
dependencies.CacheAs<IFrameBasedClock>(clock); dependencies.CacheAs<IFrameBasedClock>(clock);

View File

@ -87,7 +87,7 @@ namespace osu.Game.Screens.Menu
private void updateAmplitudes() private void updateAmplitudes()
{ {
var track = beatmap.Value.TrackLoaded ? beatmap.Value.Track : null; var track = beatmap.Value.TrackLoaded ? beatmap.Value.Track : null;
var effect = beatmap.Value.BeatmapLoaded ? beatmap.Value.OriginalBeatmap.ControlPointInfo.EffectPointAt(track?.CurrentTime ?? Time.Current) : null; var effect = beatmap.Value.BeatmapLoaded ? beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(track?.CurrentTime ?? Time.Current) : null;
float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256]; float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256];

View File

@ -97,7 +97,7 @@ namespace osu.Game.Screens.Play
try try
{ {
beatmap = working.OriginalBeatmap; beatmap = working.Beatmap;
if (beatmap == null) if (beatmap == null)
throw new InvalidOperationException("Beatmap was not loaded"); throw new InvalidOperationException("Beatmap was not loaded");

View File

@ -88,7 +88,7 @@ namespace osu.Game.Screens.Ranking
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Alpha = 0.5f, Alpha = 0.5f,
Objects = Beatmap.OriginalBeatmap.HitObjects, Objects = Beatmap.Beatmap.HitObjects,
}, },
scoreCounter = new SlowScoreCounter(6) scoreCounter = new SlowScoreCounter(6)
{ {

View File

@ -210,7 +210,7 @@ namespace osu.Game.Screens.Select
private InfoLabel[] getInfoLabels() private InfoLabel[] getInfoLabels()
{ {
var beatmap = working.OriginalBeatmap; var beatmap = working.Beatmap;
var info = working.BeatmapInfo; var info = working.BeatmapInfo;
List<InfoLabel> labels = new List<InfoLabel>(); List<InfoLabel> labels = new List<InfoLabel>();

View File

@ -24,7 +24,7 @@ namespace osu.Game.Tests.Beatmaps
} }
private readonly IBeatmap beatmap; private readonly IBeatmap beatmap;
protected override IBeatmap GetOriginalBeatmap() => beatmap; protected override IBeatmap GetBeatmap() => beatmap;
protected override Texture GetBackground() => null; protected override Texture GetBackground() => null;
protected override Track GetTrack() protected override Track GetTrack()

View File

@ -47,7 +47,7 @@ namespace osu.Game.Tests.Visual
private void beatmapChanged(WorkingBeatmap working) private void beatmapChanged(WorkingBeatmap working)
{ {
Clock.ControlPointInfo = working.OriginalBeatmap.ControlPointInfo; Clock.ControlPointInfo = working.Beatmap.ControlPointInfo;
Clock.ChangeSource((IAdjustableClock)working.Track ?? new StopwatchClock()); Clock.ChangeSource((IAdjustableClock)working.Track ?? new StopwatchClock());
Clock.ProcessFrame(); Clock.ProcessFrame();
} }

View File

@ -250,7 +250,7 @@ namespace osu.Game.Tests.Visual
return; return;
lastRequest = new GetScoresRequest(newBeatmap.BeatmapInfo, newBeatmap.BeatmapInfo.Ruleset); lastRequest = new GetScoresRequest(newBeatmap.BeatmapInfo, newBeatmap.BeatmapInfo.Ruleset);
lastRequest.Success += res => res.Scores.ForEach(s => scores.Add(new PerformanceDisplay(s, newBeatmap.OriginalBeatmap))); lastRequest.Success += res => res.Scores.ForEach(s => scores.Add(new PerformanceDisplay(s, newBeatmap.Beatmap)));
api.Queue(lastRequest); api.Queue(lastRequest);
} }
@ -381,7 +381,7 @@ namespace osu.Game.Tests.Visual
var allMods = ruleset.GetAllMods().ToList(); var allMods = ruleset.GetAllMods().ToList();
Mod[] activeMods = modFlow.Where(c => c.Current.Value).Select(c => allMods.First(m => m.ShortenedName == c.LabelText)).ToArray(); Mod[] activeMods = modFlow.Where(c => c.Current.Value).Select(c => allMods.First(m => m.ShortenedName == c.LabelText)).ToArray();
var diffCalc = ruleset.CreateDifficultyCalculator(beatmap.OriginalBeatmap, activeMods); var diffCalc = ruleset.CreateDifficultyCalculator(beatmap.Beatmap, activeMods);
if (diffCalc != null) if (diffCalc != null)
{ {
var categories = new Dictionary<string, double>(); var categories = new Dictionary<string, double>();