mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:23:00 +08:00
Remove IHasTimeSpan, add rename to TimingSection.
This commit is contained in:
parent
8641379424
commit
55f238f6a9
@ -45,18 +45,18 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
const double start_time = 500;
|
||||
const double duration = 500;
|
||||
|
||||
Func<double, bool, DrawableTimingChange> createTimingChange = (time, gravity) =>
|
||||
Func<double, bool, DrawableTimingSection> createTimingChange = (time, gravity) =>
|
||||
{
|
||||
if (gravity)
|
||||
{
|
||||
return new DrawableManiaGravityTimingChange(new TimingChange
|
||||
return new DrawableManiaGravityTimingChange(new TimingSection
|
||||
{
|
||||
BeatLength = 1000,
|
||||
Time = time
|
||||
});
|
||||
}
|
||||
|
||||
return new DrawableManiaScrollingTimingChange(new TimingChange
|
||||
return new DrawableManiaScrollingTimingChange(new TimingSection
|
||||
{
|
||||
BeatLength = 1000,
|
||||
Time = time
|
||||
|
@ -31,11 +31,11 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
{
|
||||
var maniaHitRenderer = (ManiaHitRenderer)hitRenderer;
|
||||
|
||||
maniaHitRenderer.HitObjectTimingChanges = new List<DrawableTimingChange>[maniaHitRenderer.PreferredColumns];
|
||||
maniaHitRenderer.BarlineTimingChanges = new List<DrawableTimingChange>();
|
||||
maniaHitRenderer.HitObjectTimingChanges = new List<DrawableTimingSection>[maniaHitRenderer.PreferredColumns];
|
||||
maniaHitRenderer.BarlineTimingChanges = new List<DrawableTimingSection>();
|
||||
|
||||
for (int i = 0; i < maniaHitRenderer.PreferredColumns; i++)
|
||||
maniaHitRenderer.HitObjectTimingChanges[i] = new List<DrawableTimingChange>();
|
||||
maniaHitRenderer.HitObjectTimingChanges[i] = new List<DrawableTimingSection>();
|
||||
|
||||
foreach (HitObject obj in maniaHitRenderer.Objects)
|
||||
{
|
||||
@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
if (maniaObject == null)
|
||||
continue;
|
||||
|
||||
maniaHitRenderer.HitObjectTimingChanges[maniaObject.Column].Add(new DrawableManiaGravityTimingChange(new TimingChange
|
||||
maniaHitRenderer.HitObjectTimingChanges[maniaObject.Column].Add(new DrawableManiaGravityTimingChange(new TimingSection
|
||||
{
|
||||
Time = obj.StartTime,
|
||||
BeatLength = 1000
|
||||
@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
|
||||
for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength)
|
||||
{
|
||||
maniaHitRenderer.BarlineTimingChanges.Add(new DrawableManiaGravityTimingChange(new TimingChange
|
||||
maniaHitRenderer.BarlineTimingChanges.Add(new DrawableManiaGravityTimingChange(new TimingSection
|
||||
{
|
||||
Time = t,
|
||||
BeatLength = 1000
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Mania.Timing.Drawables
|
||||
/// </summary>
|
||||
public class DrawableManiaGravityTimingChange : DrawableManiaTimingChange
|
||||
{
|
||||
public DrawableManiaGravityTimingChange(TimingChange timingChange)
|
||||
public DrawableManiaGravityTimingChange(TimingSection timingChange)
|
||||
: base(timingChange)
|
||||
{
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Mania.Timing.Drawables
|
||||
/// </summary>
|
||||
public class DrawableManiaScrollingTimingChange : DrawableManiaTimingChange
|
||||
{
|
||||
public DrawableManiaScrollingTimingChange(TimingChange timingChange)
|
||||
public DrawableManiaScrollingTimingChange(TimingSection timingChange)
|
||||
: base(timingChange)
|
||||
{
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ using osu.Game.Rulesets.Timing.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Timing.Drawables
|
||||
{
|
||||
public abstract class DrawableManiaTimingChange : DrawableTimingChange
|
||||
public abstract class DrawableManiaTimingChange : DrawableTimingSection
|
||||
{
|
||||
protected DrawableManiaTimingChange(TimingChange timingChange)
|
||||
protected DrawableManiaTimingChange(TimingSection timingChange)
|
||||
: base(timingChange, Axes.Y)
|
||||
{
|
||||
}
|
||||
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Mania.Timing.Drawables
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
var parent = Parent as IHasTimeSpan;
|
||||
var parent = Parent as TimingSectionCollection;
|
||||
|
||||
if (parent == null)
|
||||
return;
|
||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
private readonly Container hitTargetBar;
|
||||
private readonly Container keyIcon;
|
||||
|
||||
private readonly TimingChangeContainer timingChanges;
|
||||
private readonly TimingSectionCollection timingChanges;
|
||||
|
||||
public Column()
|
||||
{
|
||||
@ -91,7 +91,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
}
|
||||
}
|
||||
},
|
||||
timingChanges = new TimingChangeContainer
|
||||
timingChanges = new TimingSectionCollection
|
||||
{
|
||||
Name = "Hit objects",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -191,7 +191,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
set { timingChanges.TimeSpan = value; }
|
||||
}
|
||||
|
||||
public void Add(DrawableTimingChange timingChange) => timingChanges.Add(timingChange);
|
||||
public void Add(DrawableTimingSection timingChange) => timingChanges.Add(timingChange);
|
||||
public void Add(DrawableHitObject hitObject)
|
||||
{
|
||||
hitObject.AccentColour = AccentColour;
|
||||
|
@ -40,12 +40,12 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
/// <summary>
|
||||
/// Per-column timing changes.
|
||||
/// </summary>
|
||||
public List<DrawableTimingChange>[] HitObjectTimingChanges;
|
||||
public List<DrawableTimingSection>[] HitObjectTimingChanges;
|
||||
|
||||
/// <summary>
|
||||
/// Bar line timing changes.
|
||||
/// </summary>
|
||||
public List<DrawableTimingChange> BarlineTimingChanges;
|
||||
public List<DrawableTimingSection> BarlineTimingChanges;
|
||||
|
||||
/// <summary>
|
||||
/// Number of columns in the playfield of this hit renderer. Null if the play field hasn't been generated yet.
|
||||
@ -65,11 +65,11 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
if (HitObjectTimingChanges != null || BarlineTimingChanges != null)
|
||||
return;
|
||||
|
||||
HitObjectTimingChanges = new List<DrawableTimingChange>[PreferredColumns];
|
||||
BarlineTimingChanges = new List<DrawableTimingChange>();
|
||||
HitObjectTimingChanges = new List<DrawableTimingSection>[PreferredColumns];
|
||||
BarlineTimingChanges = new List<DrawableTimingSection>();
|
||||
|
||||
for (int i = 0; i < PreferredColumns; i++)
|
||||
HitObjectTimingChanges[i] = new List<DrawableTimingChange>();
|
||||
HitObjectTimingChanges[i] = new List<DrawableTimingSection>();
|
||||
|
||||
double lastSpeedMultiplier = 1;
|
||||
double lastBeatLength = 500;
|
||||
@ -91,7 +91,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
if (difficultyPoint != null)
|
||||
lastSpeedMultiplier = difficultyPoint.SpeedMultiplier;
|
||||
|
||||
return new TimingChange
|
||||
return new TimingSection
|
||||
{
|
||||
Time = c.Time,
|
||||
BeatLength = lastBeatLength,
|
||||
|
@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
private readonly FlowContainer<Column> columns;
|
||||
public IEnumerable<Column> Columns => columns.Children;
|
||||
|
||||
private readonly TimingChangeContainer barLineContainer;
|
||||
private readonly TimingSectionCollection barLineContainer;
|
||||
|
||||
private List<Color4> normalColumnColours = new List<Color4>();
|
||||
private Color4 specialColumnColour;
|
||||
@ -117,7 +117,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
Padding = new MarginPadding { Top = HIT_TARGET_POSITION },
|
||||
Children = new[]
|
||||
{
|
||||
barLineContainer = new TimingChangeContainer
|
||||
barLineContainer = new TimingSectionCollection
|
||||
{
|
||||
Name = "Bar lines",
|
||||
Anchor = Anchor.TopCentre,
|
||||
@ -209,7 +209,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
|
||||
public override void Add(DrawableHitObject<ManiaHitObject, ManiaJudgement> h) => Columns.ElementAt(h.HitObject.Column).Add(h);
|
||||
|
||||
public void Add(DrawableTimingChange timingChange) => barLineContainer.Add(timingChange);
|
||||
public void Add(DrawableTimingSection timingChange) => barLineContainer.Add(timingChange);
|
||||
public void Add(DrawableBarLine barline) => barLineContainer.Add(barline);
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
|
@ -16,9 +16,9 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
/// <summary>
|
||||
/// Represents a container in which contains hit objects and moves relative to the current time.
|
||||
/// </summary>
|
||||
public abstract class DrawableTimingChange : Container<DrawableHitObject>
|
||||
public abstract class DrawableTimingSection : Container<DrawableHitObject>
|
||||
{
|
||||
public readonly TimingChange TimingChange;
|
||||
public readonly TimingSection TimingChange;
|
||||
|
||||
protected override Container<DrawableHitObject> Content => content;
|
||||
private readonly Container<DrawableHitObject> content;
|
||||
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
/// </summary>
|
||||
/// <param name="timingChange">The encapsulated timing change that provides the speed changes.</param>
|
||||
/// <param name="scrollingAxes">The axes through which this timing change scrolls.</param>
|
||||
protected DrawableTimingChange(TimingChange timingChange, Axes scrollingAxes)
|
||||
protected DrawableTimingSection(TimingSection timingChange, Axes scrollingAxes)
|
||||
{
|
||||
this.scrollingAxes = scrollingAxes;
|
||||
|
||||
@ -49,12 +49,12 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
public override Axes RelativeSizeAxes
|
||||
{
|
||||
get { return Axes.Both; }
|
||||
set { throw new InvalidOperationException($"{nameof(DrawableTimingChange)} must always be relatively-sized."); }
|
||||
set { throw new InvalidOperationException($"{nameof(DrawableTimingSection)} must always be relatively-sized."); }
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
var parent = Parent as IHasTimeSpan;
|
||||
var parent = Parent as Container;
|
||||
|
||||
if (parent == null)
|
||||
return;
|
||||
@ -63,9 +63,11 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
float speedAdjustedSize = (float)(1000 / TimingChange.BeatLength / TimingChange.SpeedMultiplier);
|
||||
|
||||
Size = new Vector2((scrollingAxes & Axes.X) > 0 ? speedAdjustedSize : 1, (scrollingAxes & Axes.Y) > 0 ? speedAdjustedSize : 1);
|
||||
RelativeChildSize = new Vector2((scrollingAxes & Axes.X) > 0 ? (float)parent.TimeSpan : 1, (scrollingAxes & Axes.Y) > 0 ? (float)parent.TimeSpan : 1);
|
||||
RelativeChildSize = new Vector2((scrollingAxes & Axes.X) > 0 ? parent.RelativeChildSize.X : 1, (scrollingAxes & Axes.Y) > 0 ? parent.RelativeChildSize.Y : 1);
|
||||
}
|
||||
|
||||
protected double TimeSpan => (Parent as TimingSectionCollection)?.TimeSpan ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this timing change can contain a hit object. This is true if the hit object occurs "after" after this timing change.
|
||||
/// </summary>
|
@ -1,18 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
/// <summary>
|
||||
/// A type of container which spans a length of time.
|
||||
/// </summary>
|
||||
public interface IHasTimeSpan : IContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// The amount of time which this container spans.
|
||||
/// </summary>
|
||||
double TimeSpan { get; }
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
|
||||
namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
public class TimingChange
|
||||
public class TimingSection
|
||||
{
|
||||
/// <summary>
|
||||
/// The time at which this timing change happened.
|
@ -11,7 +11,7 @@ using osu.Game.Rulesets.Timing.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
public class TimingChangeContainer : Container<DrawableTimingChange>, IHasTimeSpan
|
||||
public class TimingSectionCollection : Container<DrawableTimingSection>
|
||||
{
|
||||
public double TimeSpan { get; set; }
|
||||
|
||||
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Timing
|
||||
/// </summary>
|
||||
/// <param name="hitObject">The hit object to contain.</param>
|
||||
/// <returns>The last (time-wise) timing change which can contain <paramref name="hitObject"/>. Null if no timing change exists.</returns>
|
||||
private DrawableTimingChange timingChangeFor(DrawableHitObject hitObject) => Children.FirstOrDefault(c => c.CanContain(hitObject)) ?? Children.LastOrDefault();
|
||||
private DrawableTimingSection timingChangeFor(DrawableHitObject hitObject) => Children.FirstOrDefault(c => c.CanContain(hitObject)) ?? Children.LastOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -48,8 +48,8 @@ namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
public override int Compare(Drawable x, Drawable y)
|
||||
{
|
||||
var timingChangeX = x as DrawableTimingChange;
|
||||
var timingChangeY = y as DrawableTimingChange;
|
||||
var timingChangeX = x as DrawableTimingSection;
|
||||
var timingChangeY = y as DrawableTimingSection;
|
||||
|
||||
// If either of the two drawables are not hit objects, fall back to the base comparer
|
||||
if (timingChangeX?.TimingChange == null || timingChangeY?.TimingChange == null)
|
@ -193,10 +193,9 @@
|
||||
<Compile Include="Database\RulesetDatabase.cs" />
|
||||
<Compile Include="Rulesets\Scoring\Score.cs" />
|
||||
<Compile Include="Rulesets\Scoring\ScoreProcessor.cs" />
|
||||
<Compile Include="Rulesets\Timing\Drawables\DrawableTimingChange.cs" />
|
||||
<Compile Include="Rulesets\Timing\IHasTimeSpan.cs" />
|
||||
<Compile Include="Rulesets\Timing\TimingChange.cs" />
|
||||
<Compile Include="Rulesets\Timing\TimingChangeContainer.cs" />
|
||||
<Compile Include="Rulesets\Timing\Drawables\DrawableTimingSection.cs" />
|
||||
<Compile Include="Rulesets\Timing\TimingSection.cs" />
|
||||
<Compile Include="Rulesets\Timing\TimingSectionCollection.cs" />
|
||||
<Compile Include="Screens\Menu\MenuSideFlashes.cs" />
|
||||
<Compile Include="Screens\Play\HUD\HealthDisplay.cs" />
|
||||
<Compile Include="Screens\Play\HUDOverlay.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user