mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:42:54 +08:00
More renaming + fixes.
This commit is contained in:
parent
7d921f92b1
commit
1231d5d35e
@ -1 +1 @@
|
||||
Subproject commit 3ad1dd52ae511b816fb928f70ef811ec605c5c18
|
||||
Subproject commit b72b5a59a689358c4c5785623fbf5019169a66fc
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
@ -18,7 +19,7 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
public readonly TimingSection TimingSection;
|
||||
|
||||
protected override Container<DrawableHitObject> Content => content;
|
||||
private readonly Container<DrawableHitObject> content;
|
||||
private Container<DrawableHitObject> content;
|
||||
|
||||
private readonly Axes scrollingAxes;
|
||||
|
||||
@ -32,8 +33,12 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
this.scrollingAxes = scrollingAxes;
|
||||
|
||||
TimingSection = timingSection;
|
||||
}
|
||||
|
||||
AddInternal(content = CreateHitObjectCollection(scrollingAxes));
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AddInternal(content = CreateHitObjectCollection());
|
||||
content.RelativeChildOffset = new Vector2((scrollingAxes & Axes.X) > 0 ? (float)TimingSection.Time : 0, (scrollingAxes & Axes.Y) > 0 ? (float)TimingSection.Time : 0);
|
||||
}
|
||||
|
||||
@ -45,7 +50,7 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
var parent = Parent as Container;
|
||||
var parent = Parent as TimingSectionCollection;
|
||||
|
||||
if (parent == null)
|
||||
return;
|
||||
@ -55,7 +60,7 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
// The application of speed changes happens by modifying our size while maintaining the parent's relative child size as our own
|
||||
// By doing this the scroll speed of the hit objects is changed by a factor of Size / RelativeChildSize
|
||||
Size = new Vector2((scrollingAxes & Axes.X) > 0 ? speedAdjustedSize : 1, (scrollingAxes & Axes.Y) > 0 ? speedAdjustedSize : 1);
|
||||
RelativeChildSize = parent.RelativeChildSize;
|
||||
RelativeChildSize = new Vector2((scrollingAxes & Axes.X) > 0 ? (float)parent.TimeSpan : 1, (scrollingAxes & Axes.Y) > 0 ? (float)parent.TimeSpan : 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -66,8 +71,7 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
/// <summary>
|
||||
/// Creates the container which handles the movement of a collection of hit objects.
|
||||
/// </summary>
|
||||
/// <param name="autoSizingAxes"></param>
|
||||
/// <returns></returns>
|
||||
protected abstract HitObjectCollection CreateHitObjectCollection(Axes autoSizingAxes);
|
||||
/// <returns>The hit object collection.</returns>
|
||||
protected abstract HitObjectCollection CreateHitObjectCollection();
|
||||
}
|
||||
}
|
@ -28,9 +28,9 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
/// </para>
|
||||
///
|
||||
/// <para>
|
||||
/// This container will always be relatively-sized to its parent through the use of <see cref="Drawable.RelativeSizeAxes"/> such that the
|
||||
/// parent can utilise <see cref="Container{T}.RelativeChildSize"/> and <see cref="Container{T}.RelativeChildOffset"/> to apply further
|
||||
/// time offsets to this collection of hit objects.
|
||||
/// This container will always be relatively-sized and positioned to its parent through the use of <see cref="Drawable.RelativeSizeAxes"/>
|
||||
/// and <see cref="Drawable.RelativePositionAxes"/> such that the parent can utilise <see cref="Container{T}.RelativeChildSize"/> and
|
||||
/// <see cref="Container{T}.RelativeChildOffset"/> to apply further time offsets to this collection of hit objects.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public abstract class HitObjectCollection : Container<DrawableHitObject>
|
||||
@ -48,6 +48,9 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
protected HitObjectCollection(Axes autoSizingAxes)
|
||||
{
|
||||
this.autoSizingAxes = autoSizingAxes;
|
||||
|
||||
// We need a default size since RelativeSizeAxes is overridden
|
||||
Size = Vector2.One;
|
||||
}
|
||||
|
||||
public override Axes AutoSizeAxes { set { throw new InvalidOperationException($"{nameof(HitObjectCollection)} must always be relatively-sized."); } }
|
||||
@ -58,6 +61,12 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
set { throw new InvalidOperationException($"{nameof(HitObjectCollection)} must always be relatively-sized."); }
|
||||
}
|
||||
|
||||
public override Axes RelativePositionAxes
|
||||
{
|
||||
get { return Axes.Both; }
|
||||
set { throw new InvalidOperationException($"{nameof(HitObjectCollection)} must always be relatively-positioned."); }
|
||||
}
|
||||
|
||||
public override void InvalidateFromChild(Invalidation invalidation)
|
||||
{
|
||||
// We only want to re-compute our size when a child's size or position has changed
|
||||
@ -88,7 +97,7 @@ namespace osu.Game.Rulesets.Timing.Drawables
|
||||
float height = Children.Select(child => child.Y + child.Height).Max() - RelativeChildOffset.Y;
|
||||
|
||||
// Consider that width/height are time values. To have ourselves span these time values 1:1, we first need to set our size
|
||||
base.Size = new Vector2((autoSizingAxes & Axes.X) > 0 ? width : Size.X, (autoSizingAxes & Axes.Y) > 0 ? height : Size.Y);
|
||||
Size = new Vector2((autoSizingAxes & Axes.X) > 0 ? width : Size.X, (autoSizingAxes & Axes.Y) > 0 ? height : Size.Y);
|
||||
// Then to make our position-space be time values again, we need our relative child size to follow our size
|
||||
RelativeChildSize = Size;
|
||||
});
|
||||
|
@ -11,7 +11,7 @@ using osu.Game.Rulesets.Timing.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Timing
|
||||
{
|
||||
public abstract class TimingSectionCollection : Container<DrawableTimingSection>
|
||||
public class TimingSectionCollection : Container<DrawableTimingSection>
|
||||
{
|
||||
/// <summary>
|
||||
/// The length of time which is visualized
|
||||
@ -55,11 +55,11 @@ namespace osu.Game.Rulesets.Timing
|
||||
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)
|
||||
if (timingChangeX?.TimingSection == null || timingChangeY?.TimingSection == null)
|
||||
return base.Compare(x, y);
|
||||
|
||||
// Compare by start time
|
||||
int i = timingChangeY.TimingChange.Time.CompareTo(timingChangeX.TimingChange.Time);
|
||||
int i = timingChangeY.TimingSection.Time.CompareTo(timingChangeX.TimingSection.Time);
|
||||
if (i != 0)
|
||||
return i;
|
||||
|
||||
|
@ -194,6 +194,7 @@
|
||||
<Compile Include="Rulesets\Scoring\Score.cs" />
|
||||
<Compile Include="Rulesets\Scoring\ScoreProcessor.cs" />
|
||||
<Compile Include="Rulesets\Timing\Drawables\DrawableTimingSection.cs" />
|
||||
<Compile Include="Rulesets\Timing\Drawables\HitObjectCollection.cs" />
|
||||
<Compile Include="Rulesets\Timing\TimingSection.cs" />
|
||||
<Compile Include="Rulesets\Timing\TimingSectionCollection.cs" />
|
||||
<Compile Include="Screens\Menu\MenuSideFlashes.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user