1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 09:23:06 +08:00

Fix line endings.

This commit is contained in:
smoogipooo 2017-05-11 17:41:00 +09:00
parent 5f30a89f76
commit 5dd83067ee

View File

@ -1,67 +1,67 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using OpenTK; using OpenTK;
namespace osu.Game.Rulesets.Mania.Timing namespace osu.Game.Rulesets.Mania.Timing
{ {
/// <summary> /// <summary>
/// A container in which the Y-relative coordinate space is spanned by a length of time. /// A container in which the Y-relative coordinate space is spanned by a length of time.
/// <para> /// <para>
/// This container contains <see cref="TimingSection"/>s which scroll inside this container. /// This container contains <see cref="TimingSection"/>s which scroll inside this container.
/// Drawables added to this container are moved inside the relevant <see cref="TimingSection"/>, /// Drawables added to this container are moved inside the relevant <see cref="TimingSection"/>,
/// and as such, will scroll along with the <see cref="TimingSection"/>s. /// and as such, will scroll along with the <see cref="TimingSection"/>s.
/// </para> /// </para>
/// </summary> /// </summary>
public class TimeRelativeContainer : Container<Drawable> public class TimeRelativeContainer : Container<Drawable>
{ {
/// <summary> /// <summary>
/// The amount of time which the height of this container spans. /// The amount of time which the height of this container spans.
/// </summary> /// </summary>
public double TimeSpan public double TimeSpan
{
get { return RelativeCoordinateSpace.Y; }
set { RelativeCoordinateSpace = new Vector2(1, (float)value); }
}
public TimeRelativeContainer(IEnumerable<TimingSection> timingSections)
{ {
Children = timingSections.Select(t => new DrawableTimingSection(t)); get { return RelativeCoordinateSpace.Y; }
set { RelativeCoordinateSpace = new Vector2(1, (float)value); }
} }
/// <summary> public TimeRelativeContainer(IEnumerable<TimingSection> timingSections)
/// Adds a drawable to this container. Note that the drawable added must have a {
/// Y-position as a time relative to this container. Children = timingSections.Select(t => new DrawableTimingSection(t));
/// </summary> }
/// <param name="drawable">The drawable to add.</param>
public override void Add(Drawable drawable) /// <summary>
/// Adds a drawable to this container. Note that the drawable added must have a
/// Y-position as a time relative to this container.
/// </summary>
/// <param name="drawable">The drawable to add.</param>
public override void Add(Drawable drawable)
{ {
// Always add timing sections to ourselves // Always add timing sections to ourselves
if (drawable is DrawableTimingSection) if (drawable is DrawableTimingSection)
{ {
base.Add(drawable); base.Add(drawable);
return; return;
} }
var section = (Children.LastOrDefault(t => t.Y >= drawable.Y) ?? Children.First()) as DrawableTimingSection; var section = (Children.LastOrDefault(t => t.Y >= drawable.Y) ?? Children.First()) as DrawableTimingSection;
if (section == null) if (section == null)
throw new Exception("Could not find suitable timing section to add object to."); throw new Exception("Could not find suitable timing section to add object to.");
section.Add(drawable); section.Add(drawable);
} }
/// <summary> /// <summary>
/// A container that contains drawables within the time span of a timing section. /// A container that contains drawables within the time span of a timing section.
/// <para> /// <para>
/// Scrolls relative to the current time. /// Scrolls relative to the current time.
/// </para> /// </para>
/// </summary> /// </summary>
private class DrawableTimingSection : Container private class DrawableTimingSection : Container
{ {
private readonly TimingSection section; private readonly TimingSection section;
@ -93,10 +93,10 @@ namespace osu.Game.Rulesets.Mania.Timing
// we need to offset it back by our position so that it becomes correctly relatively-positioned to us // we need to offset it back by our position so that it becomes correctly relatively-positioned to us
// This can be removed if hit objects were stored such that either their StartTime or their "beat offset" was relative to the timing section // This can be removed if hit objects were stored such that either their StartTime or their "beat offset" was relative to the timing section
// they belonged to, but this requires a radical change to the beatmap format which we're not ready to do just yet // they belonged to, but this requires a radical change to the beatmap format which we're not ready to do just yet
drawable.Y -= Y; drawable.Y -= Y;
base.Add(drawable); base.Add(drawable);
} }
} }
} }
} }