mirror of
https://github.com/ppy/osu
synced 2024-12-15 03:16:17 +00:00
Merge pull request #11423 from peppy/fix-control-point-pollution
This commit is contained in:
commit
8df060ad6e
@ -246,5 +246,32 @@ namespace osu.Game.Tests.NonVisual
|
||||
Assert.That(cpi.DifficultyPoints.Count, Is.EqualTo(0));
|
||||
Assert.That(cpi.AllControlPoints.Count, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateCopyIsDeepClone()
|
||||
{
|
||||
var cpi = new ControlPointInfo();
|
||||
|
||||
cpi.Add(1000, new TimingControlPoint { BeatLength = 500 });
|
||||
|
||||
var cpiCopy = cpi.CreateCopy();
|
||||
|
||||
cpiCopy.Add(2000, new TimingControlPoint { BeatLength = 500 });
|
||||
|
||||
Assert.That(cpi.Groups.Count, Is.EqualTo(1));
|
||||
Assert.That(cpiCopy.Groups.Count, Is.EqualTo(2));
|
||||
|
||||
Assert.That(cpi.TimingPoints.Count, Is.EqualTo(1));
|
||||
Assert.That(cpiCopy.TimingPoints.Count, Is.EqualTo(2));
|
||||
|
||||
Assert.That(cpi.TimingPoints[0], Is.Not.SameAs(cpiCopy.TimingPoints[0]));
|
||||
Assert.That(cpi.TimingPoints[0].BeatLengthBindable, Is.Not.SameAs(cpiCopy.TimingPoints[0].BeatLengthBindable));
|
||||
|
||||
Assert.That(cpi.TimingPoints[0].BeatLength, Is.EqualTo(cpiCopy.TimingPoints[0].BeatLength));
|
||||
|
||||
cpi.TimingPoints[0].BeatLength = 800;
|
||||
|
||||
Assert.That(cpi.TimingPoints[0].BeatLength, Is.Not.EqualTo(cpiCopy.TimingPoints[0].BeatLength));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,15 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
IBeatmap IBeatmap.Clone() => Clone();
|
||||
|
||||
public Beatmap<T> Clone() => (Beatmap<T>)MemberwiseClone();
|
||||
public Beatmap<T> Clone()
|
||||
{
|
||||
var clone = (Beatmap<T>)MemberwiseClone();
|
||||
|
||||
clone.ControlPointInfo = ControlPointInfo.CreateCopy();
|
||||
// todo: deep clone other elements as required.
|
||||
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
public class Beatmap : Beatmap<HitObject>
|
||||
|
@ -28,5 +28,21 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
/// <param name="existing">An existing control point to compare with.</param>
|
||||
/// <returns>Whether this <see cref="ControlPoint"/> is redundant when placed alongside <paramref name="existing"/>.</returns>
|
||||
public abstract bool IsRedundant(ControlPoint existing);
|
||||
|
||||
/// <summary>
|
||||
/// Create an unbound copy of this control point.
|
||||
/// </summary>
|
||||
public ControlPoint CreateCopy()
|
||||
{
|
||||
var copy = (ControlPoint)Activator.CreateInstance(GetType());
|
||||
|
||||
copy.CopyFrom(this);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
public virtual void CopyFrom(ControlPoint other)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -297,5 +297,15 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public ControlPointInfo CreateCopy()
|
||||
{
|
||||
var controlPointInfo = new ControlPointInfo();
|
||||
|
||||
foreach (var point in AllControlPoints)
|
||||
controlPointInfo.Add(point.Time, point.CreateCopy());
|
||||
|
||||
return controlPointInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,5 +39,12 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
public override bool IsRedundant(ControlPoint existing)
|
||||
=> existing is DifficultyControlPoint existingDifficulty
|
||||
&& SpeedMultiplier == existingDifficulty.SpeedMultiplier;
|
||||
|
||||
public override void CopyFrom(ControlPoint other)
|
||||
{
|
||||
SpeedMultiplier = ((DifficultyControlPoint)other).SpeedMultiplier;
|
||||
|
||||
base.CopyFrom(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,5 +50,13 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
&& existing is EffectControlPoint existingEffect
|
||||
&& KiaiMode == existingEffect.KiaiMode
|
||||
&& OmitFirstBarLine == existingEffect.OmitFirstBarLine;
|
||||
|
||||
public override void CopyFrom(ControlPoint other)
|
||||
{
|
||||
KiaiMode = ((EffectControlPoint)other).KiaiMode;
|
||||
OmitFirstBarLine = ((EffectControlPoint)other).OmitFirstBarLine;
|
||||
|
||||
base.CopyFrom(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,5 +72,13 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
=> existing is SampleControlPoint existingSample
|
||||
&& SampleBank == existingSample.SampleBank
|
||||
&& SampleVolume == existingSample.SampleVolume;
|
||||
|
||||
public override void CopyFrom(ControlPoint other)
|
||||
{
|
||||
SampleVolume = ((SampleControlPoint)other).SampleVolume;
|
||||
SampleBank = ((SampleControlPoint)other).SampleBank;
|
||||
|
||||
base.CopyFrom(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,5 +69,13 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
|
||||
// Timing points are never redundant as they can change the time signature.
|
||||
public override bool IsRedundant(ControlPoint existing) => false;
|
||||
|
||||
public override void CopyFrom(ControlPoint other)
|
||||
{
|
||||
TimeSignature = ((TimingControlPoint)other).TimeSignature;
|
||||
BeatLength = ((TimingControlPoint)other).BeatLength;
|
||||
|
||||
base.CopyFrom(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -164,13 +164,24 @@ namespace osu.Game.Beatmaps.Formats
|
||||
/// Legacy BPM multiplier that introduces floating-point errors for rulesets that depend on it.
|
||||
/// DO NOT USE THIS UNLESS 100% SURE.
|
||||
/// </summary>
|
||||
public readonly float BpmMultiplier;
|
||||
public float BpmMultiplier { get; private set; }
|
||||
|
||||
public LegacyDifficultyControlPoint(double beatLength)
|
||||
: this()
|
||||
{
|
||||
BpmMultiplier = beatLength < 0 ? Math.Clamp((float)-beatLength, 10, 10000) / 100f : 1;
|
||||
}
|
||||
|
||||
public LegacyDifficultyControlPoint()
|
||||
{
|
||||
SpeedMultiplierBindable.Precision = double.Epsilon;
|
||||
}
|
||||
|
||||
BpmMultiplier = beatLength < 0 ? Math.Clamp((float)-beatLength, 10, 10000) / 100f : 1;
|
||||
public override void CopyFrom(ControlPoint other)
|
||||
{
|
||||
base.CopyFrom(other);
|
||||
|
||||
BpmMultiplier = ((LegacyDifficultyControlPoint)other).BpmMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,6 +203,13 @@ namespace osu.Game.Beatmaps.Formats
|
||||
=> base.IsRedundant(existing)
|
||||
&& existing is LegacySampleControlPoint existingSample
|
||||
&& CustomSampleBank == existingSample.CustomSampleBank;
|
||||
|
||||
public override void CopyFrom(ControlPoint other)
|
||||
{
|
||||
base.CopyFrom(other);
|
||||
|
||||
CustomSampleBank = ((LegacySampleControlPoint)other).CustomSampleBank;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,9 @@ namespace osu.Game.Screens.Edit.Compose
|
||||
{
|
||||
public class ComposeScreen : EditorScreenWithTimeline
|
||||
{
|
||||
[Resolved]
|
||||
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
||||
|
||||
private HitObjectComposer composer;
|
||||
|
||||
public ComposeScreen()
|
||||
@ -59,7 +62,7 @@ namespace osu.Game.Screens.Edit.Compose
|
||||
{
|
||||
Debug.Assert(ruleset != null);
|
||||
|
||||
var beatmapSkinProvider = new BeatmapSkinProvidingContainer(Beatmap.Value.Skin);
|
||||
var beatmapSkinProvider = new BeatmapSkinProvidingContainer(beatmap.Value.Skin);
|
||||
|
||||
// the beatmapSkinProvider is used as the fallback source here to allow the ruleset-specific skin implementation
|
||||
// full access to all skin sources.
|
||||
|
@ -486,6 +486,8 @@ namespace osu.Game.Screens.Edit
|
||||
ApplyToBackground(b => b.FadeColour(Color4.White, 500));
|
||||
resetTrack();
|
||||
|
||||
Beatmap.Value = beatmapManager.GetWorkingBeatmap(Beatmap.Value.BeatmapInfo);
|
||||
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,8 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
|
||||
namespace osu.Game.Screens.Edit
|
||||
{
|
||||
@ -14,9 +12,6 @@ namespace osu.Game.Screens.Edit
|
||||
/// </summary>
|
||||
public abstract class EditorScreen : Container
|
||||
{
|
||||
[Resolved]
|
||||
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||
|
||||
[Resolved]
|
||||
protected EditorBeatmap EditorBeatmap { get; private set; }
|
||||
|
||||
|
@ -30,16 +30,16 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
}
|
||||
|
||||
private Container mainContent;
|
||||
|
||||
private LoadingSpinner spinner;
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load([CanBeNull] BindableBeatDivisor beatDivisor)
|
||||
{
|
||||
if (beatDivisor != null)
|
||||
this.beatDivisor.BindTo(beatDivisor);
|
||||
|
||||
Container mainContent;
|
||||
|
||||
LoadingSpinner spinner;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
mainContent = new Container
|
||||
@ -99,6 +99,11 @@ namespace osu.Game.Screens.Edit
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
LoadComponentAsync(CreateMainContent(), content =>
|
||||
{
|
||||
|
@ -13,9 +13,6 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
{
|
||||
internal class DifficultySection : SetupSection
|
||||
{
|
||||
[Resolved]
|
||||
private EditorBeatmap editorBeatmap { get; set; }
|
||||
|
||||
private LabelledSliderBar<float> circleSizeSlider;
|
||||
private LabelledSliderBar<float> healthDrainSlider;
|
||||
private LabelledSliderBar<float> approachRateSlider;
|
||||
@ -34,7 +31,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
{
|
||||
Label = "Object Size",
|
||||
Description = "The size of all hit objects",
|
||||
Current = new BindableFloat(Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize)
|
||||
Current = new BindableFloat(Beatmap.BeatmapInfo.BaseDifficulty.CircleSize)
|
||||
{
|
||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||
MinValue = 0,
|
||||
@ -46,7 +43,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
{
|
||||
Label = "Health Drain",
|
||||
Description = "The rate of passive health drain throughout playable time",
|
||||
Current = new BindableFloat(Beatmap.Value.BeatmapInfo.BaseDifficulty.DrainRate)
|
||||
Current = new BindableFloat(Beatmap.BeatmapInfo.BaseDifficulty.DrainRate)
|
||||
{
|
||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||
MinValue = 0,
|
||||
@ -58,7 +55,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
{
|
||||
Label = "Approach Rate",
|
||||
Description = "The speed at which objects are presented to the player",
|
||||
Current = new BindableFloat(Beatmap.Value.BeatmapInfo.BaseDifficulty.ApproachRate)
|
||||
Current = new BindableFloat(Beatmap.BeatmapInfo.BaseDifficulty.ApproachRate)
|
||||
{
|
||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||
MinValue = 0,
|
||||
@ -70,7 +67,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
{
|
||||
Label = "Overall Difficulty",
|
||||
Description = "The harshness of hit windows and difficulty of special objects (ie. spinners)",
|
||||
Current = new BindableFloat(Beatmap.Value.BeatmapInfo.BaseDifficulty.OverallDifficulty)
|
||||
Current = new BindableFloat(Beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty)
|
||||
{
|
||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||
MinValue = 0,
|
||||
@ -88,12 +85,12 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
{
|
||||
// for now, update these on commit rather than making BeatmapMetadata bindables.
|
||||
// after switching database engines we can reconsider if switching to bindables is a good direction.
|
||||
Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = circleSizeSlider.Current.Value;
|
||||
Beatmap.Value.BeatmapInfo.BaseDifficulty.DrainRate = healthDrainSlider.Current.Value;
|
||||
Beatmap.Value.BeatmapInfo.BaseDifficulty.ApproachRate = approachRateSlider.Current.Value;
|
||||
Beatmap.Value.BeatmapInfo.BaseDifficulty.OverallDifficulty = overallDifficultySlider.Current.Value;
|
||||
Beatmap.BeatmapInfo.BaseDifficulty.CircleSize = circleSizeSlider.Current.Value;
|
||||
Beatmap.BeatmapInfo.BaseDifficulty.DrainRate = healthDrainSlider.Current.Value;
|
||||
Beatmap.BeatmapInfo.BaseDifficulty.ApproachRate = approachRateSlider.Current.Value;
|
||||
Beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty = overallDifficultySlider.Current.Value;
|
||||
|
||||
editorBeatmap.UpdateAllHitObjects();
|
||||
Beatmap.UpdateAllHitObjects();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
artistTextBox = new LabelledTextBox
|
||||
{
|
||||
Label = "Artist",
|
||||
Current = { Value = Beatmap.Value.Metadata.Artist },
|
||||
Current = { Value = Beatmap.Metadata.Artist },
|
||||
TabbableContentContainer = this
|
||||
},
|
||||
titleTextBox = new LabelledTextBox
|
||||
{
|
||||
Label = "Title",
|
||||
Current = { Value = Beatmap.Value.Metadata.Title },
|
||||
Current = { Value = Beatmap.Metadata.Title },
|
||||
TabbableContentContainer = this
|
||||
},
|
||||
creatorTextBox = new LabelledTextBox
|
||||
{
|
||||
Label = "Creator",
|
||||
Current = { Value = Beatmap.Value.Metadata.AuthorString },
|
||||
Current = { Value = Beatmap.Metadata.AuthorString },
|
||||
TabbableContentContainer = this
|
||||
},
|
||||
difficultyTextBox = new LabelledTextBox
|
||||
{
|
||||
Label = "Difficulty Name",
|
||||
Current = { Value = Beatmap.Value.BeatmapInfo.Version },
|
||||
Current = { Value = Beatmap.BeatmapInfo.Version },
|
||||
TabbableContentContainer = this
|
||||
},
|
||||
};
|
||||
@ -62,10 +62,10 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
|
||||
// for now, update these on commit rather than making BeatmapMetadata bindables.
|
||||
// after switching database engines we can reconsider if switching to bindables is a good direction.
|
||||
Beatmap.Value.Metadata.Artist = artistTextBox.Current.Value;
|
||||
Beatmap.Value.Metadata.Title = titleTextBox.Current.Value;
|
||||
Beatmap.Value.Metadata.AuthorString = creatorTextBox.Current.Value;
|
||||
Beatmap.Value.BeatmapInfo.Version = difficultyTextBox.Current.Value;
|
||||
Beatmap.Metadata.Artist = artistTextBox.Current.Value;
|
||||
Beatmap.Metadata.Title = titleTextBox.Current.Value;
|
||||
Beatmap.Metadata.AuthorString = creatorTextBox.Current.Value;
|
||||
Beatmap.BeatmapInfo.Version = difficultyTextBox.Current.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,9 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IBindable<WorkingBeatmap> working { get; set; }
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private Editor editor { get; set; }
|
||||
|
||||
@ -70,7 +73,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
audioTrackTextBox = new FileChooserLabelledTextBox
|
||||
{
|
||||
Label = "Audio Track",
|
||||
Current = { Value = Beatmap.Value.Metadata.AudioFile ?? "Click to select a track" },
|
||||
Current = { Value = working.Value.Metadata.AudioFile ?? "Click to select a track" },
|
||||
Target = audioTrackFileChooserContainer,
|
||||
TabbableContentContainer = this
|
||||
},
|
||||
@ -115,11 +118,11 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
if (!info.Exists)
|
||||
return false;
|
||||
|
||||
var set = Beatmap.Value.BeatmapSetInfo;
|
||||
var set = working.Value.BeatmapSetInfo;
|
||||
|
||||
// remove the previous background for now.
|
||||
// in the future we probably want to check if this is being used elsewhere (other difficulties?)
|
||||
var oldFile = set.Files.FirstOrDefault(f => f.Filename == Beatmap.Value.Metadata.BackgroundFile);
|
||||
var oldFile = set.Files.FirstOrDefault(f => f.Filename == working.Value.Metadata.BackgroundFile);
|
||||
|
||||
using (var stream = info.OpenRead())
|
||||
{
|
||||
@ -129,7 +132,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
beatmaps.AddFile(set, stream, info.Name);
|
||||
}
|
||||
|
||||
Beatmap.Value.Metadata.BackgroundFile = info.Name;
|
||||
working.Value.Metadata.BackgroundFile = info.Name;
|
||||
updateBackgroundSprite();
|
||||
|
||||
return true;
|
||||
@ -148,11 +151,11 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
if (!info.Exists)
|
||||
return false;
|
||||
|
||||
var set = Beatmap.Value.BeatmapSetInfo;
|
||||
var set = working.Value.BeatmapSetInfo;
|
||||
|
||||
// remove the previous audio track for now.
|
||||
// in the future we probably want to check if this is being used elsewhere (other difficulties?)
|
||||
var oldFile = set.Files.FirstOrDefault(f => f.Filename == Beatmap.Value.Metadata.AudioFile);
|
||||
var oldFile = set.Files.FirstOrDefault(f => f.Filename == working.Value.Metadata.AudioFile);
|
||||
|
||||
using (var stream = info.OpenRead())
|
||||
{
|
||||
@ -162,7 +165,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
beatmaps.AddFile(set, stream, info.Name);
|
||||
}
|
||||
|
||||
Beatmap.Value.Metadata.AudioFile = info.Name;
|
||||
working.Value.Metadata.AudioFile = info.Name;
|
||||
|
||||
music.ReloadCurrentTrack();
|
||||
|
||||
@ -178,7 +181,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
|
||||
private void updateBackgroundSprite()
|
||||
{
|
||||
LoadComponentAsync(new BeatmapBackgroundSprite(Beatmap.Value)
|
||||
LoadComponentAsync(new BeatmapBackgroundSprite(working.Value)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
|
@ -2,10 +2,8 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK;
|
||||
|
||||
@ -19,7 +17,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
protected OsuColour Colours { get; private set; }
|
||||
|
||||
[Resolved]
|
||||
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||
protected EditorBeatmap Beatmap { get; private set; }
|
||||
|
||||
protected override Container<Drawable> Content => flow;
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
|
||||
protected override DifficultyControlPoint CreatePoint()
|
||||
{
|
||||
var reference = Beatmap.Value.Beatmap.ControlPointInfo.DifficultyPointAt(SelectedGroup.Value.Time);
|
||||
var reference = Beatmap.ControlPointInfo.DifficultyPointAt(SelectedGroup.Value.Time);
|
||||
|
||||
return new DifficultyControlPoint
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
|
||||
protected override EffectControlPoint CreatePoint()
|
||||
{
|
||||
var reference = Beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(SelectedGroup.Value.Time);
|
||||
var reference = Beatmap.ControlPointInfo.EffectPointAt(SelectedGroup.Value.Time);
|
||||
|
||||
return new EffectControlPoint
|
||||
{
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
@ -24,7 +23,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; }
|
||||
|
||||
[Resolved]
|
||||
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||
protected EditorBeatmap Beatmap { get; private set; }
|
||||
|
||||
[Resolved]
|
||||
private EditorClock clock { get; set; }
|
||||
@ -107,13 +106,13 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
|
||||
var currentGroupItems = SelectedGroup.Value.ControlPoints.ToArray();
|
||||
|
||||
Beatmap.Value.Beatmap.ControlPointInfo.RemoveGroup(SelectedGroup.Value);
|
||||
Beatmap.ControlPointInfo.RemoveGroup(SelectedGroup.Value);
|
||||
|
||||
foreach (var cp in currentGroupItems)
|
||||
Beatmap.Value.Beatmap.ControlPointInfo.Add(time, cp);
|
||||
Beatmap.ControlPointInfo.Add(time, cp);
|
||||
|
||||
// the control point might not necessarily exist yet, if currentGroupItems was empty.
|
||||
SelectedGroup.Value = Beatmap.Value.Beatmap.ControlPointInfo.GroupAt(time, true);
|
||||
SelectedGroup.Value = Beatmap.ControlPointInfo.GroupAt(time, true);
|
||||
|
||||
changeHandler?.EndChange();
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
|
||||
protected override SampleControlPoint CreatePoint()
|
||||
{
|
||||
var reference = Beatmap.Value.Beatmap.ControlPointInfo.SamplePointAt(SelectedGroup.Value.Time);
|
||||
var reference = Beatmap.ControlPointInfo.SamplePointAt(SelectedGroup.Value.Time);
|
||||
|
||||
return new SampleControlPoint
|
||||
{
|
||||
|
@ -7,7 +7,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -27,7 +26,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
private const float header_height = 20;
|
||||
|
||||
[Resolved]
|
||||
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||
protected EditorBeatmap Beatmap { get; private set; }
|
||||
|
||||
[Resolved]
|
||||
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; }
|
||||
|
@ -7,7 +7,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
@ -62,7 +61,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
private EditorClock clock { get; set; }
|
||||
|
||||
[Resolved]
|
||||
protected IBindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||
protected EditorBeatmap Beatmap { get; private set; }
|
||||
|
||||
[Resolved]
|
||||
private Bindable<ControlPointGroup> selectedGroup { get; set; }
|
||||
@ -124,7 +123,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
|
||||
selectedGroup.BindValueChanged(selected => { deleteButton.Enabled.Value = selected.NewValue != null; }, true);
|
||||
|
||||
controlPointGroups.BindTo(Beatmap.Value.Beatmap.ControlPointInfo.Groups);
|
||||
controlPointGroups.BindTo(Beatmap.ControlPointInfo.Groups);
|
||||
controlPointGroups.BindCollectionChanged((sender, args) =>
|
||||
{
|
||||
table.ControlGroups = controlPointGroups;
|
||||
@ -137,14 +136,14 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
if (selectedGroup.Value == null)
|
||||
return;
|
||||
|
||||
Beatmap.Value.Beatmap.ControlPointInfo.RemoveGroup(selectedGroup.Value);
|
||||
Beatmap.ControlPointInfo.RemoveGroup(selectedGroup.Value);
|
||||
|
||||
selectedGroup.Value = Beatmap.Value.Beatmap.ControlPointInfo.Groups.FirstOrDefault(g => g.Time >= clock.CurrentTime);
|
||||
selectedGroup.Value = Beatmap.ControlPointInfo.Groups.FirstOrDefault(g => g.Time >= clock.CurrentTime);
|
||||
}
|
||||
|
||||
private void addNew()
|
||||
{
|
||||
selectedGroup.Value = Beatmap.Value.Beatmap.ControlPointInfo.GroupAt(clock.CurrentTime, true);
|
||||
selectedGroup.Value = Beatmap.ControlPointInfo.GroupAt(clock.CurrentTime, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
|
||||
protected override TimingControlPoint CreatePoint()
|
||||
{
|
||||
var reference = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(SelectedGroup.Value.Time);
|
||||
var reference = Beatmap.ControlPointInfo.TimingPointAt(SelectedGroup.Value.Time);
|
||||
|
||||
return new TimingControlPoint
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user