1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 18:23:04 +08:00

Merge branch 'mania-pattern-changes' into mania-endtime-object-conversion

This commit is contained in:
smoogipooo 2017-05-22 10:17:54 +09:00
commit e9f7be8dce
15 changed files with 47 additions and 123 deletions

@ -1 +1 @@
Subproject commit d00a7df902074d0b3f1479904b7f322db9d39c1f Subproject commit 60e0a343d2bf590f736782e2bb2a01c132e6cac0

View File

@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
HitObject firstObject = Beatmap.HitObjects.FirstOrDefault(); HitObject firstObject = Beatmap.HitObjects.FirstOrDefault();
double drainTime = (lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0); double drainTime = (lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0);
drainTime -= Beatmap.EventInfo.TotalBreakTime; drainTime -= Beatmap.TotalBreakTime;
if (drainTime == 0) if (drainTime == 0)
drainTime = 10000; drainTime = 10000;

View File

@ -15,51 +15,51 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
/// <summary> /// <summary>
/// Keep the same as last row. /// Keep the same as last row.
/// </summary> /// </summary>
ForceStack = 1, ForceStack = 1 << 0,
/// <summary> /// <summary>
/// Keep different from last row. /// Keep different from last row.
/// </summary> /// </summary>
ForceNotStack = 2, ForceNotStack = 1 << 1,
/// <summary> /// <summary>
/// Keep as single note at its original position. /// Keep as single note at its original position.
/// </summary> /// </summary>
KeepSingle = 4, KeepSingle = 1 << 2,
/// <summary> /// <summary>
/// Use a lower random value. /// Use a lower random value.
/// </summary> /// </summary>
LowProbability = 8, LowProbability = 1 << 3,
/// <summary> /// <summary>
/// Reserved. /// Reserved.
/// </summary> /// </summary>
Alternate = 16, Alternate = 1 << 4,
/// <summary> /// <summary>
/// Ignore the repeat count. /// Ignore the repeat count.
/// </summary> /// </summary>
ForceSigSlider = 32, ForceSigSlider = 1 << 5,
/// <summary> /// <summary>
/// Convert slider to circle. /// Convert slider to circle.
/// </summary> /// </summary>
ForceNotSlider = 64, ForceNotSlider = 1 << 6,
/// <summary> /// <summary>
/// Notes gathered together. /// Notes gathered together.
/// </summary> /// </summary>
Gathered = 128, Gathered = 1 << 7,
Mirror = 256, Mirror = 1 << 8,
/// <summary> /// <summary>
/// Change 0 -> 6. /// Change 0 -> 6.
/// </summary> /// </summary>
Reverse = 512, Reverse = 1 << 9,
/// <summary> /// <summary>
/// 1 -> 5 -> 1 -> 5 like reverse. /// 1 -> 5 -> 1 -> 5 like reverse.
/// </summary> /// </summary>
Cycle = 1024, Cycle = 1 << 10,
/// <summary> /// <summary>
/// Next note will be at column + 1. /// Next note will be at column + 1.
/// </summary> /// </summary>
Stair = 2048, Stair = 1 << 11,
/// <summary> /// <summary>
/// Next note will be at column - 1. /// Next note will be at column - 1.
/// </summary> /// </summary>
ReverseStair = 4096 ReverseStair = 1 << 12
} }
} }

View File

@ -21,16 +21,16 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
public IEnumerable<ManiaHitObject> HitObjects => hitObjects; public IEnumerable<ManiaHitObject> HitObjects => hitObjects;
/// <summary> /// <summary>
/// Whether this pattern already contains a hit object in a code. /// Check whether a column of this patterns contains a hit object.
/// </summary> /// </summary>
/// <param name="column">The column index.</param> /// <param name="column">The column index.</param>
/// <returns>Whether this pattern already contains a hit object in <paramref name="column"/></returns> /// <returns>Whether the column with index <paramref name="column"/> contains a hit object.</returns>
public bool IsFilled(int column) => hitObjects.Exists(h => h.Column == column); public bool ColumnHasObject(int column) => hitObjects.Exists(h => h.Column == column);
/// <summary> /// <summary>
/// Amount of columns taken up by hit objects in this pattern. /// Amount of columns taken up by hit objects in this pattern.
/// </summary> /// </summary>
public int ColumnsFilled => HitObjects.GroupBy(h => h.Column).Count(); public int ColumnWithObjects => HitObjects.GroupBy(h => h.Column).Count();
/// <summary> /// <summary>
/// Adds a hit object to this pattern. /// Adds a hit object to this pattern.
@ -42,10 +42,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns
/// Copies hit object from another pattern to this one. /// Copies hit object from another pattern to this one.
/// </summary> /// </summary>
/// <param name="other">The other pattern.</param> /// <param name="other">The other pattern.</param>
public void Add(Pattern other) public void Add(Pattern other) => hitObjects.AddRange(other.HitObjects);
{
other.HitObjects.ForEach(Add);
}
/// <summary> /// <summary>
/// Clears this pattern, removing all hit objects. /// Clears this pattern, removing all hit objects.

View File

@ -158,7 +158,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
background.AccentColour = normalColour; background.AccentColour = normalColour;
completeColour = colours.YellowLight.Opacity(0.6f); completeColour = colours.YellowLight.Opacity(0.75f);
disc.AccentColour = colours.SpinnerFill; disc.AccentColour = colours.SpinnerFill;
circle.Colour = colours.BlueDark; circle.Colour = colours.BlueDark;

View File

@ -2,7 +2,6 @@
// 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 OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
@ -28,9 +27,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
EdgeEffect = new EdgeEffect EdgeEffect = new EdgeEffect
{ {
Hollow = true,
Type = EdgeEffectType.Glow, Type = EdgeEffectType.Glow,
Radius = 14, Radius = 40,
Colour = value.Opacity(0.3f), Colour = value,
}; };
} }
} }

View File

@ -127,7 +127,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
if (Complete && updateCompleteTick()) if (Complete && updateCompleteTick())
{ {
background.Flush(flushType: typeof(TransformAlpha)); background.Flush(flushType: typeof(TransformAlpha));
background.FadeTo(tracking_alpha + 0.4f, 60, EasingTypes.OutExpo); background.FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo);
background.Delay(60); background.Delay(60);
background.FadeTo(tracking_alpha, 250, EasingTypes.OutQuint); background.FadeTo(tracking_alpha, 250, EasingTypes.OutQuint);
} }

View File

@ -2,12 +2,10 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -15,24 +13,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
public class SpinnerTicks : Container public class SpinnerTicks : Container
{ {
private Color4 glowColour;
public SpinnerTicks() public SpinnerTicks()
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
glowColour = colours.BlueDarker.Opacity(0.4f);
layout();
}
private void layout()
{
const int count = 18; const int count = 18;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
@ -44,8 +30,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
EdgeEffect = new EdgeEffect EdgeEffect = new EdgeEffect
{ {
Type = EdgeEffectType.Glow, Type = EdgeEffectType.Glow,
Radius = 20, Radius = 10,
Colour = glowColour, Colour = Color4.Gray.Opacity(0.2f),
}, },
RelativePositionAxes = Axes.Both, RelativePositionAxes = Axes.Both,
Masking = true, Masking = true,

View File

@ -2,11 +2,11 @@
// 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 OpenTK.Graphics; using OpenTK.Graphics;
using osu.Game.Beatmaps.Events;
using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Timing;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Beatmaps namespace osu.Game.Beatmaps
{ {
@ -18,7 +18,7 @@ namespace osu.Game.Beatmaps
{ {
public BeatmapInfo BeatmapInfo; public BeatmapInfo BeatmapInfo;
public TimingInfo TimingInfo = new TimingInfo(); public TimingInfo TimingInfo = new TimingInfo();
public EventInfo EventInfo = new EventInfo(); public List<BreakPeriod> Breaks = new List<BreakPeriod>();
public readonly List<Color4> ComboColors = new List<Color4> public readonly List<Color4> ComboColors = new List<Color4>
{ {
new Color4(17, 136, 170, 255), new Color4(17, 136, 170, 255),
@ -34,6 +34,11 @@ namespace osu.Game.Beatmaps
/// </summary> /// </summary>
public List<T> HitObjects; public List<T> HitObjects;
/// <summary>
/// Total amount of break time in the beatmap.
/// </summary>
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
/// <summary> /// <summary>
/// Constructs a new beatmap. /// Constructs a new beatmap.
/// </summary> /// </summary>
@ -42,7 +47,7 @@ namespace osu.Game.Beatmaps
{ {
BeatmapInfo = original?.BeatmapInfo ?? BeatmapInfo; BeatmapInfo = original?.BeatmapInfo ?? BeatmapInfo;
TimingInfo = original?.TimingInfo ?? TimingInfo; TimingInfo = original?.TimingInfo ?? TimingInfo;
EventInfo = original?.EventInfo ?? EventInfo; Breaks = original?.Breaks ?? Breaks;
ComboColors = original?.ComboColors ?? ComboColors; ComboColors = original?.ComboColors ?? ComboColors;
} }
} }

View File

@ -1,13 +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
namespace osu.Game.Beatmaps.Events
{
public class BackgroundEvent : Event
{
/// <summary>
/// The file name.
/// </summary>
public string Filename;
}
}

View File

@ -1,13 +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
namespace osu.Game.Beatmaps.Events
{
public abstract class Event
{
/// <summary>
/// The event start time.
/// </summary>
public double StartTime;
}
}

View File

@ -1,33 +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 System.Collections.Generic;
using System.Linq;
namespace osu.Game.Beatmaps.Events
{
public class EventInfo
{
/// <summary>
/// All the background events.
/// </summary>
public readonly List<BackgroundEvent> Backgrounds = new List<BackgroundEvent>();
/// <summary>
/// All the break events.
/// </summary>
public readonly List<BreakEvent> Breaks = new List<BreakEvent>();
/// <summary>
/// Total duration of all breaks.
/// </summary>
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
/// <summary>
/// Retrieves the active background at a time.
/// </summary>
/// <param name="time">The time to retrieve the background at.</param>
/// <returns>The background.</returns>
public BackgroundEvent BackgroundAt(double time) => Backgrounds.FirstOrDefault(b => b.StartTime <= time);
}
}

View File

@ -5,7 +5,6 @@ using System;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Game.Beatmaps.Events;
using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Timing;
using osu.Game.Beatmaps.Legacy; using osu.Game.Beatmaps.Legacy;
using osu.Game.Rulesets.Objects.Legacy; using osu.Game.Rulesets.Objects.Legacy;
@ -217,18 +216,12 @@ namespace osu.Game.Beatmaps.Formats
case EventType.Background: case EventType.Background:
string filename = split[2].Trim('"'); string filename = split[2].Trim('"');
beatmap.EventInfo.Backgrounds.Add(new BackgroundEvent
{
StartTime = double.Parse(split[1], NumberFormatInfo.InvariantInfo),
Filename = filename
});
if (type == EventType.Background) if (type == EventType.Background)
beatmap.BeatmapInfo.Metadata.BackgroundFile = filename; beatmap.BeatmapInfo.Metadata.BackgroundFile = filename;
break; break;
case EventType.Break: case EventType.Break:
var breakEvent = new BreakEvent var breakEvent = new BreakPeriod
{ {
StartTime = double.Parse(split[1], NumberFormatInfo.InvariantInfo), StartTime = double.Parse(split[1], NumberFormatInfo.InvariantInfo),
EndTime = double.Parse(split[2], NumberFormatInfo.InvariantInfo) EndTime = double.Parse(split[2], NumberFormatInfo.InvariantInfo)
@ -237,7 +230,7 @@ namespace osu.Game.Beatmaps.Formats
if (!breakEvent.HasEffect) if (!breakEvent.HasEffect)
return; return;
beatmap.EventInfo.Breaks.Add(breakEvent); beatmap.Breaks.Add(breakEvent);
break; break;
} }
} }

View File

@ -1,27 +1,32 @@
// 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
namespace osu.Game.Beatmaps.Events namespace osu.Game.Beatmaps.Timing
{ {
public class BreakEvent : Event public class BreakPeriod
{ {
/// <summary> /// <summary>
/// The minimum duration required for a break to have any effect. /// The minimum duration required for a break to have any effect.
/// </summary> /// </summary>
private const double min_break_duration = 650; private const double min_break_duration = 650;
/// <summary>
/// The break start time.
/// </summary>
public double StartTime;
/// <summary> /// <summary>
/// The break end time. /// The break end time.
/// </summary> /// </summary>
public double EndTime; public double EndTime;
/// <summary> /// <summary>
/// The duration of the break. /// The break duration.
/// </summary> /// </summary>
public double Duration => EndTime - StartTime; public double Duration => EndTime - StartTime;
/// <summary> /// <summary>
/// Whether the break has any effect. Breaks that are too short are culled before they reach the EventInfo. /// Whether the break has any effect. Breaks that are too short are culled before they are added to the beatmap.
/// </summary> /// </summary>
public bool HasEffect => Duration >= min_break_duration; public bool HasEffect => Duration >= min_break_duration;
} }

View File

@ -74,10 +74,6 @@
<Compile Include="Audio\SampleInfoList.cs" /> <Compile Include="Audio\SampleInfoList.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" /> <Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
<Compile Include="Beatmaps\DifficultyCalculator.cs" /> <Compile Include="Beatmaps\DifficultyCalculator.cs" />
<Compile Include="Beatmaps\Events\BackgroundEvent.cs" />
<Compile Include="Beatmaps\Events\BreakEvent.cs" />
<Compile Include="Beatmaps\Events\Event.cs" />
<Compile Include="Beatmaps\Events\EventInfo.cs" />
<Compile Include="Online\API\Requests\PostMessageRequest.cs" /> <Compile Include="Online\API\Requests\PostMessageRequest.cs" />
<Compile Include="Online\Chat\ErrorMessage.cs" /> <Compile Include="Online\Chat\ErrorMessage.cs" />
<Compile Include="Overlays\Chat\ChatTabControl.cs" /> <Compile Include="Overlays\Chat\ChatTabControl.cs" />
@ -91,6 +87,7 @@
<Compile Include="Rulesets\Beatmaps\BeatmapConverter.cs" /> <Compile Include="Rulesets\Beatmaps\BeatmapConverter.cs" />
<Compile Include="Rulesets\Beatmaps\BeatmapProcessor.cs" /> <Compile Include="Rulesets\Beatmaps\BeatmapProcessor.cs" />
<Compile Include="Beatmaps\Legacy\LegacyBeatmap.cs" /> <Compile Include="Beatmaps\Legacy\LegacyBeatmap.cs" />
<Compile Include="Beatmaps\Timing\BreakPeriod.cs" />
<Compile Include="Beatmaps\Timing\TimeSignatures.cs" /> <Compile Include="Beatmaps\Timing\TimeSignatures.cs" />
<Compile Include="Beatmaps\Timing\TimingInfo.cs" /> <Compile Include="Beatmaps\Timing\TimingInfo.cs" />
<Compile Include="Database\BeatmapMetrics.cs" /> <Compile Include="Database\BeatmapMetrics.cs" />