Merge remote-tracking branch 'smoogipooo/mania-pattern-changes' into mania-hitobject-object-conversion

This commit is contained in:
smoogipooo 2017-05-22 10:32:32 +09:00
commit 7d417e4219
16 changed files with 52 additions and 129 deletions

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

View File

@ -90,7 +90,7 @@ protected double ConversionDifficulty
HitObject firstObject = Beatmap.HitObjects.FirstOrDefault();
double drainTime = (lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0);
drainTime -= Beatmap.EventInfo.TotalBreakTime;
drainTime -= Beatmap.TotalBreakTime;
if (drainTime == 0)
drainTime = 10000;

View File

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

View File

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

View File

@ -30,6 +30,9 @@ public class DrawableSpinner : DrawableOsuHitObject
private readonly TextAwesome symbol;
private readonly Color4 baseColour = OsuColour.FromHex(@"002c3c");
private readonly Color4 fillColour = OsuColour.FromHex(@"005b7c");
private Color4 normalColour;
private Color4 completeColour;
@ -154,13 +157,13 @@ protected override void CheckJudgement(bool userTriggered)
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
normalColour = colours.SpinnerBase;
normalColour = baseColour;
background.AccentColour = normalColour;
completeColour = colours.YellowLight.Opacity(0.6f);
completeColour = colours.YellowLight.Opacity(0.75f);
disc.AccentColour = colours.SpinnerFill;
disc.AccentColour = fillColour;
circle.Colour = colours.BlueDark;
glow.Colour = colours.BlueDark;
}

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
@ -28,9 +27,10 @@ public Color4 AccentColour
EdgeEffect = new EdgeEffect
{
Hollow = true,
Type = EdgeEffectType.Glow,
Radius = 14,
Colour = value.Opacity(0.3f),
Radius = 40,
Colour = value,
};
}
}

View File

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

View File

@ -2,11 +2,11 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Game.Beatmaps.Events;
using osu.Game.Beatmaps.Timing;
using osu.Game.Database;
using osu.Game.Rulesets.Objects;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Beatmaps
{
@ -18,7 +18,7 @@ public class Beatmap<T>
{
public BeatmapInfo BeatmapInfo;
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>
{
new Color4(17, 136, 170, 255),
@ -34,6 +34,11 @@ public class Beatmap<T>
/// </summary>
public List<T> HitObjects;
/// <summary>
/// Total amount of break time in the beatmap.
/// </summary>
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
/// <summary>
/// Constructs a new beatmap.
/// </summary>
@ -42,7 +47,7 @@ public Beatmap(Beatmap original = null)
{
BeatmapInfo = original?.BeatmapInfo ?? BeatmapInfo;
TimingInfo = original?.TimingInfo ?? TimingInfo;
EventInfo = original?.EventInfo ?? EventInfo;
Breaks = original?.Breaks ?? Breaks;
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.Globalization;
using System.IO;
using OpenTK.Graphics;
using osu.Game.Beatmaps.Events;
using osu.Game.Beatmaps.Timing;
using osu.Game.Beatmaps.Legacy;
using osu.Game.Rulesets.Objects.Legacy;
@ -217,18 +216,12 @@ private void handleEvents(Beatmap beatmap, string val)
case EventType.Background:
string filename = split[2].Trim('"');
beatmap.EventInfo.Backgrounds.Add(new BackgroundEvent
{
StartTime = double.Parse(split[1], NumberFormatInfo.InvariantInfo),
Filename = filename
});
if (type == EventType.Background)
beatmap.BeatmapInfo.Metadata.BackgroundFile = filename;
break;
case EventType.Break:
var breakEvent = new BreakEvent
var breakEvent = new BreakPeriod
{
StartTime = double.Parse(split[1], NumberFormatInfo.InvariantInfo),
EndTime = double.Parse(split[2], NumberFormatInfo.InvariantInfo)
@ -237,7 +230,7 @@ private void handleEvents(Beatmap beatmap, string val)
if (!breakEvent.HasEffect)
return;
beatmap.EventInfo.Breaks.Add(breakEvent);
beatmap.Breaks.Add(breakEvent);
break;
}
}

View File

@ -1,27 +1,32 @@
// 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
namespace osu.Game.Beatmaps.Timing
{
public class BreakEvent : Event
public class BreakPeriod
{
/// <summary>
/// The minimum duration required for a break to have any effect.
/// </summary>
private const double min_break_duration = 650;
/// <summary>
/// The break start time.
/// </summary>
public double StartTime;
/// <summary>
/// The break end time.
/// </summary>
public double EndTime;
/// <summary>
/// The duration of the break.
/// The break duration.
/// </summary>
public double Duration => EndTime - StartTime;
/// <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>
public bool HasEffect => Duration >= min_break_duration;
}

View File

@ -87,8 +87,5 @@ public static Color4 FromHex(string hex)
public readonly Color4 RedDarker = FromHex(@"870000");
public readonly Color4 ChatBlue = FromHex(@"17292e");
public readonly Color4 SpinnerBase = FromHex(@"002c3c");
public readonly Color4 SpinnerFill = FromHex(@"005b7c");
}
}

View File

@ -74,10 +74,6 @@
<Compile Include="Audio\SampleInfoList.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.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\Chat\ErrorMessage.cs" />
<Compile Include="Overlays\Chat\ChatTabControl.cs" />
@ -91,6 +87,7 @@
<Compile Include="Rulesets\Beatmaps\BeatmapConverter.cs" />
<Compile Include="Rulesets\Beatmaps\BeatmapProcessor.cs" />
<Compile Include="Beatmaps\Legacy\LegacyBeatmap.cs" />
<Compile Include="Beatmaps\Timing\BreakPeriod.cs" />
<Compile Include="Beatmaps\Timing\TimeSignatures.cs" />
<Compile Include="Beatmaps\Timing\TimingInfo.cs" />
<Compile Include="Database\BeatmapMetrics.cs" />