1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 20:47:22 +08:00

Add tiny droplet support

This commit is contained in:
Dean Herbert 2017-10-11 20:11:29 +09:00
parent 1a88ffe862
commit 0b282a49bd
5 changed files with 61 additions and 13 deletions

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
Size = new Vector2(Pulp.PULP_SIZE); Size = new Vector2(Pulp.PULP_SIZE);
AccentColour = Color4.Green; AccentColour = h.ComboColour;
Masking = false; Masking = false;
} }
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
Child = new Pulp Child = new Pulp
{ {
AccentColour = AccentColour, AccentColour = AccentColour,
Scale = new Vector2(0.6f), Scale = new Vector2(0.8f),
}; };
} }
} }

View File

@ -28,6 +28,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
foreach (CatchBaseHit tick in s.Ticks) foreach (CatchBaseHit tick in s.Ticks)
{ {
TinyDroplet tiny = tick as TinyDroplet;
if (tiny != null)
{
AddNested(new DrawableDroplet(tiny) { Scale = new Vector2(0.5f) });
continue;
}
Droplet droplet = tick as Droplet; Droplet droplet = tick as Droplet;
if (droplet != null) if (droplet != null)
AddNested(new DrawableDroplet(droplet)); AddNested(new DrawableDroplet(droplet));

View File

@ -11,6 +11,8 @@ using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using OpenTK; using OpenTK;
using osu.Framework.Lists;
using OpenTK.Graphics;
namespace osu.Game.Rulesets.Catch.Objects namespace osu.Game.Rulesets.Catch.Objects
{ {
@ -45,7 +47,10 @@ namespace osu.Game.Rulesets.Catch.Objects
{ {
get get
{ {
if (TickDistance == 0) yield break; SortedList<CatchBaseHit> ticks = new SortedList<CatchBaseHit>((a, b) => a.StartTime.CompareTo(b.StartTime));
if (TickDistance == 0)
return ticks;
var length = Curve.Distance; var length = Curve.Distance;
var tickDistance = Math.Min(TickDistance, length); var tickDistance = Math.Min(TickDistance, length);
@ -53,13 +58,15 @@ namespace osu.Game.Rulesets.Catch.Objects
var minDistanceFromEnd = Velocity * 0.01; var minDistanceFromEnd = Velocity * 0.01;
yield return new Fruit ticks.Add(new Fruit
{ {
Samples = Samples, Samples = Samples,
ComboColour = ComboColour, ComboColour = ComboColour,
StartTime = StartTime, StartTime = StartTime,
X = X X = X
}; });
double lastTickTime = StartTime;
for (var repeat = 0; repeat < RepeatCount; repeat++) for (var repeat = 0; repeat < RepeatCount; repeat++)
{ {
@ -74,11 +81,11 @@ namespace osu.Game.Rulesets.Catch.Objects
var timeProgress = d / length; var timeProgress = d / length;
var distanceProgress = reversed ? 1 - timeProgress : timeProgress; var distanceProgress = reversed ? 1 - timeProgress : timeProgress;
float tinyDroplet = 0; lastTickTime = repeatStartTime + timeProgress * repeatDuration;
ticks.Add(new Droplet
yield return new Droplet
{ {
StartTime = repeatStartTime + timeProgress * repeatDuration, StartTime = lastTickTime,
ComboColour = ComboColour,
X = Curve.PositionAt(distanceProgress).X / CatchPlayfield.BASE_WIDTH, X = Curve.PositionAt(distanceProgress).X / CatchPlayfield.BASE_WIDTH,
Samples = new SampleInfoList(Samples.Select(s => new SampleInfo Samples = new SampleInfoList(Samples.Select(s => new SampleInfo
{ {
@ -86,17 +93,41 @@ namespace osu.Game.Rulesets.Catch.Objects
Name = @"slidertick", Name = @"slidertick",
Volume = s.Volume Volume = s.Volume
})) }))
}; });
} }
yield return new Fruit double tinyTickInterval = (tickDistance / length) * repeatDuration;
while (tinyTickInterval > 100)
tinyTickInterval /= 2;
for (double t = 0; t < repeatDuration; t += tinyTickInterval)
{
double progress = reversed ? 1 - t / repeatDuration : t / repeatDuration;
ticks.Add(new TinyDroplet
{
StartTime = repeatStartTime + t,
ComboColour = ComboColour,
X = Curve.PositionAt(progress).X / CatchPlayfield.BASE_WIDTH,
Samples = new SampleInfoList(Samples.Select(s => new SampleInfo
{
Bank = s.Bank,
Name = @"slidertick",
Volume = s.Volume
}))
});
}
ticks.Add(new Fruit
{ {
Samples = Samples, Samples = Samples,
ComboColour = ComboColour, ComboColour = ComboColour,
StartTime = repeatStartTime + repeatDuration, StartTime = repeatStartTime + repeatDuration,
X = Curve.PositionAt(reversed ? 1 : 0).X X = Curve.PositionAt(reversed ? 0 : 1).X / CatchPlayfield.BASE_WIDTH
}; });
} }
return ticks;
} }
} }

View File

@ -0,0 +1,9 @@
// 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.Rulesets.Catch.Objects
{
public class TinyDroplet : Droplet
{
}
}

View File

@ -61,6 +61,7 @@
<Compile Include="Objects\Drawable\DrawableFruit.cs" /> <Compile Include="Objects\Drawable\DrawableFruit.cs" />
<Compile Include="Objects\Droplet.cs" /> <Compile Include="Objects\Droplet.cs" />
<Compile Include="Objects\Fruit.cs" /> <Compile Include="Objects\Fruit.cs" />
<Compile Include="Objects\TinyDroplet.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Tests\TestCaseCatcher.cs" /> <Compile Include="Tests\TestCaseCatcher.cs" />
<Compile Include="Tests\TestCaseCatchStacker.cs" /> <Compile Include="Tests\TestCaseCatchStacker.cs" />