1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +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)
{
IEnumerable<HitObject> hitObjects = beatmap.OriginalBeatmap.HitObjects;
IEnumerable<HitObject> hitObjects = beatmap.Beatmap.HitObjects;
IEnumerable<HitObject> circles = hitObjects.Where(c => !(c is IHasEndTime));
IEnumerable<HitObject> sliders = hitObjects.Where(s => 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)
Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineBeatmapID == b.OnlineBeatmapID));
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);
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);
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);
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);
}

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)
{
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
selectBeatmap(beatmap.Value.OriginalBeatmap);
selectBeatmap(beatmap.Value.Beatmap);
AddWaitStep(3);

View File

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

View File

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

View File

@ -38,7 +38,7 @@ namespace osu.Game.Beatmaps
Mods.ValueChanged += mods => applyRateAdjustments();
originalBeatmap = new AsyncLazy<IBeatmap>(populateOriginalBeatmap);
beatmap = new AsyncLazy<IBeatmap>(populateBeatmap);
background = new AsyncLazy<Texture>(populateBackground, b => b == null || !b.IsDisposed);
track = new AsyncLazy<Track>(populateTrack);
waveform = new AsyncLazy<Waveform>(populateWaveform);
@ -47,31 +47,31 @@ namespace osu.Game.Beatmaps
}
/// <summary>
/// Saves the <see cref="Beatmap"/>.
/// Saves the <see cref="Beatmaps.Beatmap"/>.
/// </summary>
public void Save()
{
var path = FileSafety.GetTempPath(Guid.NewGuid().ToString().Replace("-", string.Empty) + ".json");
using (var sw = new StreamWriter(path))
sw.WriteLine(OriginalBeatmap.Serialize());
sw.WriteLine(Beatmap.Serialize());
Process.Start(path);
}
protected abstract IBeatmap GetOriginalBeatmap();
protected abstract IBeatmap GetBeatmap();
protected abstract Texture GetBackground();
protected abstract Track GetTrack();
protected virtual Skin GetSkin() => new DefaultSkin();
protected virtual Waveform GetWaveform() => new Waveform();
protected virtual Storyboard GetStoryboard() => new Storyboard { BeatmapInfo = BeatmapInfo };
public bool BeatmapLoaded => originalBeatmap.IsResultAvailable;
public IBeatmap OriginalBeatmap => originalBeatmap.Value.Result;
public async Task<IBeatmap> GetOriginalBeatmapAsync() => await originalBeatmap.Value;
private readonly AsyncLazy<IBeatmap> originalBeatmap;
public bool BeatmapLoaded => beatmap.IsResultAvailable;
public IBeatmap Beatmap => beatmap.Value.Result;
public async Task<IBeatmap> GetBeatmapAsync() => await beatmap.Value;
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.
b.BeatmapInfo = BeatmapInfo;
@ -80,21 +80,21 @@ namespace osu.Game.Beatmaps
}
/// <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"/>.
/// </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>
/// <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)
{
var rulesetInstance = ruleset.CreateInstance();
IBeatmapConverter converter = rulesetInstance.CreateBeatmapConverter(OriginalBeatmap);
IBeatmapConverter converter = rulesetInstance.CreateBeatmapConverter(Beatmap);
// Check if the beatmap can be converted
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
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;
var track = Beatmap.Value.Track;
var beatmap = Beatmap.Value.OriginalBeatmap;
var beatmap = Beatmap.Value.Beatmap;
if (track == null || beatmap == null)
return;

View File

@ -343,7 +343,7 @@ namespace osu.Game.Overlays
// todo: this can likely be replaced with WorkingBeatmap.GetBeatmapAsync()
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.Text = @"Nothing to play";

View File

@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Scoring.Legacy
/* score.FileChecksum = */
var beatmapHash = sr.ReadString();
score.Beatmap = beatmaps.QueryBeatmap(b => b.MD5Hash == beatmapHash);
currentBeatmap = beatmaps.GetWorkingBeatmap(score.Beatmap).OriginalBeatmap;
currentBeatmap = beatmaps.GetWorkingBeatmap(score.Beatmap).Beatmap;
/* score.PlayerName = */
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)
{
base.LoadBeatmap(beatmap);
foreach (var breakPeriod in beatmap.OriginalBeatmap.Breaks)
foreach (var breakPeriod in beatmap.Beatmap.Breaks)
Add(new BreakVisualisation(breakPeriod));
}

View File

@ -20,7 +20,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
{
base.LoadBeatmap(beatmap);
ControlPointInfo cpi = beatmap.OriginalBeatmap.ControlPointInfo;
ControlPointInfo cpi = beatmap.Beatmap.ControlPointInfo;
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.
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);
dependencies.CacheAs<IFrameBasedClock>(clock);

View File

@ -87,7 +87,7 @@ namespace osu.Game.Screens.Menu
private void updateAmplitudes()
{
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];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -250,7 +250,7 @@ namespace osu.Game.Tests.Visual
return;
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);
}
@ -381,7 +381,7 @@ namespace osu.Game.Tests.Visual
var allMods = ruleset.GetAllMods().ToList();
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)
{
var categories = new Dictionary<string, double>();