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

Merge branch 'master' into hold-note-freeze

This commit is contained in:
Dean Herbert 2020-08-23 22:38:48 +09:00 committed by GitHub
commit 1f717c4b00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 168 additions and 56 deletions

View File

@ -20,19 +20,19 @@ namespace osu.Game.Rulesets.Catch.Tests
foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation))) foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation)))
AddStep($"show {rep}", () => SetContents(() => createDrawable(rep))); AddStep($"show {rep}", () => SetContents(() => createDrawable(rep)));
AddStep("show droplet", () => SetContents(createDrawableDroplet)); AddStep("show droplet", () => SetContents(() => createDrawableDroplet()));
AddStep("show tiny droplet", () => SetContents(createDrawableTinyDroplet)); AddStep("show tiny droplet", () => SetContents(createDrawableTinyDroplet));
foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation))) foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation)))
AddStep($"show hyperdash {rep}", () => SetContents(() => createDrawable(rep, true))); AddStep($"show hyperdash {rep}", () => SetContents(() => createDrawable(rep, true)));
AddStep("show hyperdash droplet", () => SetContents(() => createDrawableDroplet(true)));
} }
private Drawable createDrawableTinyDroplet() private Drawable createDrawableTinyDroplet()
{ {
var droplet = new TinyDroplet var droplet = new TestCatchTinyDroplet
{ {
StartTime = Clock.CurrentTime,
Scale = 1.5f, Scale = 1.5f,
}; };
@ -47,12 +47,12 @@ namespace osu.Game.Rulesets.Catch.Tests
}; };
} }
private Drawable createDrawableDroplet() private Drawable createDrawableDroplet(bool hyperdash = false)
{ {
var droplet = new Droplet var droplet = new TestCatchDroplet
{ {
StartTime = Clock.CurrentTime,
Scale = 1.5f, Scale = 1.5f,
HyperDashTarget = hyperdash ? new Banana() : null
}; };
return new DrawableDroplet(droplet) return new DrawableDroplet(droplet)
@ -95,5 +95,21 @@ namespace osu.Game.Rulesets.Catch.Tests
public override FruitVisualRepresentation VisualRepresentation { get; } public override FruitVisualRepresentation VisualRepresentation { get; }
} }
public class TestCatchDroplet : Droplet
{
public TestCatchDroplet()
{
StartTime = 1000000000000;
}
}
public class TestCatchTinyDroplet : TinyDroplet
{
public TestCatchTinyDroplet()
{
StartTime = 1000000000000;
}
}
} }
} }

View File

@ -6,6 +6,7 @@ using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
@ -31,6 +32,8 @@ namespace osu.Game.Rulesets.Catch.Tests
AddUntilStep("wait for right hyperdash", () => getCatcher().Scale.X > 0 && getCatcher().HyperDashing); AddUntilStep("wait for right hyperdash", () => getCatcher().Scale.X > 0 && getCatcher().HyperDashing);
AddUntilStep("wait for left hyperdash", () => getCatcher().Scale.X < 0 && getCatcher().HyperDashing); AddUntilStep("wait for left hyperdash", () => getCatcher().Scale.X < 0 && getCatcher().HyperDashing);
} }
AddUntilStep("wait for right hyperdash", () => getCatcher().Scale.X > 0 && getCatcher().HyperDashing);
} }
private Catcher getCatcher() => Player.ChildrenOfType<CatcherArea>().First().MovableCatcher; private Catcher getCatcher() => Player.ChildrenOfType<CatcherArea>().First().MovableCatcher;
@ -46,6 +49,8 @@ namespace osu.Game.Rulesets.Catch.Tests
} }
}; };
beatmap.ControlPointInfo.Add(0, new TimingControlPoint());
// Should produce a hyper-dash (edge case test) // Should produce a hyper-dash (edge case test)
beatmap.HitObjects.Add(new Fruit { StartTime = 1816, X = 56, NewCombo = true }); beatmap.HitObjects.Add(new Fruit { StartTime = 1816, X = 56, NewCombo = true });
beatmap.HitObjects.Add(new Fruit { StartTime = 2008, X = 308, NewCombo = true }); beatmap.HitObjects.Add(new Fruit { StartTime = 2008, X = 308, NewCombo = true });
@ -63,6 +68,20 @@ namespace osu.Game.Rulesets.Catch.Tests
createObjects(() => new Fruit { X = right_x }); createObjects(() => new Fruit { X = right_x });
createObjects(() => new TestJuiceStream(left_x), 1); createObjects(() => new TestJuiceStream(left_x), 1);
beatmap.ControlPointInfo.Add(startTime, new TimingControlPoint
{
BeatLength = 50
});
createObjects(() => new TestJuiceStream(left_x)
{
Path = new SliderPath(new[]
{
new PathControlPoint(Vector2.Zero),
new PathControlPoint(new Vector2(512, 0))
})
}, 1);
return beatmap; return beatmap;
void createObjects(Func<CatchHitObject> createObject, int count = 3) void createObjects(Func<CatchHitObject> createObject, int count = 3)

View File

@ -4,7 +4,6 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Rulesets.Catch.Objects.Drawables.Pieces;
using osu.Game.Skinning; using osu.Game.Skinning;
namespace osu.Game.Rulesets.Catch.Objects.Drawables namespace osu.Game.Rulesets.Catch.Objects.Drawables
@ -21,11 +20,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
ScaleContainer.Child = new SkinnableDrawable(new CatchSkinComponent(CatchSkinComponents.Droplet), _ => new Pulp ScaleContainer.Child = new SkinnableDrawable(new CatchSkinComponent(CatchSkinComponents.Droplet), _ => new DropletPiece());
{
Size = Size / 4,
AccentColour = { BindTarget = AccentColour }
});
} }
protected override void UpdateInitialTransforms() protected override void UpdateInitialTransforms()

View File

@ -0,0 +1,69 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Catch.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;
namespace osu.Game.Rulesets.Catch.Objects.Drawables
{
public class DropletPiece : CompositeDrawable
{
public DropletPiece()
{
Size = new Vector2(CatchHitObject.OBJECT_RADIUS / 2);
}
[BackgroundDependencyLoader]
private void load(DrawableHitObject drawableObject)
{
DrawableCatchHitObject drawableCatchObject = (DrawableCatchHitObject)drawableObject;
var hitObject = drawableCatchObject.HitObject;
InternalChild = new Pulp
{
RelativeSizeAxes = Axes.Both,
AccentColour = { BindTarget = drawableObject.AccentColour }
};
if (hitObject.HyperDash)
{
AddInternal(new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Size = new Vector2(2f),
Depth = 1,
Children = new Drawable[]
{
new Circle
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
BorderColour = Catcher.DEFAULT_HYPER_DASH_COLOUR,
BorderThickness = 6,
Children = new Drawable[]
{
new Box
{
AlwaysPresent = true,
Alpha = 0.3f,
Blending = BlendingParameters.Additive,
RelativeSizeAxes = Axes.Both,
Colour = Catcher.DEFAULT_HYPER_DASH_COLOUR,
}
}
}
}
});
}
}
}
}

View File

@ -3,7 +3,6 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -21,11 +20,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
public const float RADIUS_ADJUST = 1.1f; public const float RADIUS_ADJUST = 1.1f;
private Circle border; private Circle border;
private CatchHitObject hitObject; private CatchHitObject hitObject;
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
public FruitPiece() public FruitPiece()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
@ -37,8 +33,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
DrawableCatchHitObject drawableCatchObject = (DrawableCatchHitObject)drawableObject; DrawableCatchHitObject drawableCatchObject = (DrawableCatchHitObject)drawableObject;
hitObject = drawableCatchObject.HitObject; hitObject = drawableCatchObject.HitObject;
accentColour.BindTo(drawableCatchObject.AccentColour);
AddRangeInternal(new[] AddRangeInternal(new[]
{ {
getFruitFor(drawableCatchObject.HitObject.VisualRepresentation), getFruitFor(drawableCatchObject.HitObject.VisualRepresentation),

View File

@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables.Pieces
EdgeEffect = new EdgeEffectParameters EdgeEffect = new EdgeEffectParameters
{ {
Type = EdgeEffectType.Glow, Type = EdgeEffectType.Glow,
Radius = Size.X / 2, Radius = DrawWidth / 2,
Colour = colour.NewValue.Darken(0.2f).Opacity(0.75f) Colour = colour.NewValue.Darken(0.2f).Opacity(0.75f)
}; };
} }

View File

@ -229,9 +229,8 @@ namespace osu.Game.Rulesets.Catch.UI
catchObjectPosition >= catcherPosition - halfCatchWidth && catchObjectPosition >= catcherPosition - halfCatchWidth &&
catchObjectPosition <= catcherPosition + halfCatchWidth; catchObjectPosition <= catcherPosition + halfCatchWidth;
// only update hyperdash state if we are catching a fruit. // only update hyperdash state if we are not catching a tiny droplet.
// exceptions are Droplets and JuiceStreams. if (fruit is TinyDroplet) return validCatch;
if (!(fruit is Fruit)) return validCatch;
if (validCatch && fruit.HyperDash) if (validCatch && fruit.HyperDash)
{ {

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK; using osuTK;
@ -20,9 +21,12 @@ namespace osu.Game.Rulesets.Mania.Skinning
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>(); private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
private readonly bool isLastColumn; private readonly bool isLastColumn;
private Container borderLineContainer;
private Container lightContainer; private Container lightContainer;
private Sprite light; private Sprite light;
private float hitPosition;
public LegacyColumnBackground(bool isLastColumn) public LegacyColumnBackground(bool isLastColumn)
{ {
this.isLastColumn = isLastColumn; this.isLastColumn = isLastColumn;
@ -44,6 +48,9 @@ namespace osu.Game.Rulesets.Mania.Skinning
bool hasRightLine = rightLineWidth > 0 && skin.GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value >= 2.4m bool hasRightLine = rightLineWidth > 0 && skin.GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value >= 2.4m
|| isLastColumn; || isLastColumn;
hitPosition = GetColumnSkinConfig<float>(skin, LegacyManiaSkinConfigurationLookups.HitPosition)?.Value
?? Stage.HIT_TARGET_POSITION;
float lightPosition = GetColumnSkinConfig<float>(skin, LegacyManiaSkinConfigurationLookups.LightPosition)?.Value float lightPosition = GetColumnSkinConfig<float>(skin, LegacyManiaSkinConfigurationLookups.LightPosition)?.Value
?? 0; ?? 0;
@ -63,23 +70,30 @@ namespace osu.Game.Rulesets.Mania.Skinning
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = backgroundColour Colour = backgroundColour
}, },
new Box borderLineContainer = new Container
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Both,
Width = leftLineWidth, Children = new[]
Scale = new Vector2(0.740f, 1), {
Colour = lineColour, new Box
Alpha = hasLeftLine ? 1 : 0 {
}, RelativeSizeAxes = Axes.Y,
new Box Width = leftLineWidth,
{ Scale = new Vector2(0.740f, 1),
Anchor = Anchor.TopRight, Colour = lineColour,
Origin = Anchor.TopRight, Alpha = hasLeftLine ? 1 : 0
RelativeSizeAxes = Axes.Y, },
Width = rightLineWidth, new Box
Scale = new Vector2(0.740f, 1), {
Colour = lineColour, Anchor = Anchor.TopRight,
Alpha = hasRightLine ? 1 : 0 Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Y,
Width = rightLineWidth,
Scale = new Vector2(0.740f, 1),
Colour = lineColour,
Alpha = hasRightLine ? 1 : 0
}
}
}, },
lightContainer = new Container lightContainer = new Container
{ {
@ -109,11 +123,15 @@ namespace osu.Game.Rulesets.Mania.Skinning
{ {
lightContainer.Anchor = Anchor.TopCentre; lightContainer.Anchor = Anchor.TopCentre;
lightContainer.Scale = new Vector2(1, -1); lightContainer.Scale = new Vector2(1, -1);
borderLineContainer.Padding = new MarginPadding { Top = hitPosition };
} }
else else
{ {
lightContainer.Anchor = Anchor.BottomCentre; lightContainer.Anchor = Anchor.BottomCentre;
lightContainer.Scale = Vector2.One; lightContainer.Scale = Vector2.One;
borderLineContainer.Padding = new MarginPadding { Bottom = hitPosition };
} }
} }

View File

@ -68,22 +68,22 @@ namespace osu.Game.Tests.Visual.Settings
[Test] [Test]
public void TestClearButtonOnBindings() public void TestClearButtonOnBindings()
{ {
KeyBindingRow backBindingRow = null; KeyBindingRow multiBindingRow = null;
AddStep("click back binding row", () => AddStep("click first row with two bindings", () =>
{ {
backBindingRow = panel.ChildrenOfType<KeyBindingRow>().ElementAt(10); multiBindingRow = panel.ChildrenOfType<KeyBindingRow>().First(row => row.Defaults.Count() > 1);
InputManager.MoveMouseTo(backBindingRow); InputManager.MoveMouseTo(multiBindingRow);
InputManager.Click(MouseButton.Left); InputManager.Click(MouseButton.Left);
}); });
clickClearButton(); clickClearButton();
AddAssert("first binding cleared", () => string.IsNullOrEmpty(backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().First().Text.Text)); AddAssert("first binding cleared", () => string.IsNullOrEmpty(multiBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().First().Text.Text));
AddStep("click second binding", () => AddStep("click second binding", () =>
{ {
var target = backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1); var target = multiBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1);
InputManager.MoveMouseTo(target); InputManager.MoveMouseTo(target);
InputManager.Click(MouseButton.Left); InputManager.Click(MouseButton.Left);
@ -91,13 +91,13 @@ namespace osu.Game.Tests.Visual.Settings
clickClearButton(); clickClearButton();
AddAssert("second binding cleared", () => string.IsNullOrEmpty(backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1).Text.Text)); AddAssert("second binding cleared", () => string.IsNullOrEmpty(multiBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1).Text.Text));
void clickClearButton() void clickClearButton()
{ {
AddStep("click clear button", () => AddStep("click clear button", () =>
{ {
var clearButton = backBindingRow.ChildrenOfType<KeyBindingRow.ClearButton>().Single(); var clearButton = multiBindingRow.ChildrenOfType<KeyBindingRow.ClearButton>().Single();
InputManager.MoveMouseTo(clearButton); InputManager.MoveMouseTo(clearButton);
InputManager.Click(MouseButton.Left); InputManager.Click(MouseButton.Left);
@ -108,20 +108,20 @@ namespace osu.Game.Tests.Visual.Settings
[Test] [Test]
public void TestClickRowSelectsFirstBinding() public void TestClickRowSelectsFirstBinding()
{ {
KeyBindingRow backBindingRow = null; KeyBindingRow multiBindingRow = null;
AddStep("click back binding row", () => AddStep("click first row with two bindings", () =>
{ {
backBindingRow = panel.ChildrenOfType<KeyBindingRow>().ElementAt(10); multiBindingRow = panel.ChildrenOfType<KeyBindingRow>().First(row => row.Defaults.Count() > 1);
InputManager.MoveMouseTo(backBindingRow); InputManager.MoveMouseTo(multiBindingRow);
InputManager.Click(MouseButton.Left); InputManager.Click(MouseButton.Left);
}); });
AddAssert("first binding selected", () => backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().First().IsBinding); AddAssert("first binding selected", () => multiBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().First().IsBinding);
AddStep("click second binding", () => AddStep("click second binding", () =>
{ {
var target = backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1); var target = multiBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1);
InputManager.MoveMouseTo(target); InputManager.MoveMouseTo(target);
InputManager.Click(MouseButton.Left); InputManager.Click(MouseButton.Left);
@ -129,12 +129,12 @@ namespace osu.Game.Tests.Visual.Settings
AddStep("click back binding row", () => AddStep("click back binding row", () =>
{ {
backBindingRow = panel.ChildrenOfType<KeyBindingRow>().ElementAt(10); multiBindingRow = panel.ChildrenOfType<KeyBindingRow>().ElementAt(10);
InputManager.MoveMouseTo(backBindingRow); InputManager.MoveMouseTo(multiBindingRow);
InputManager.Click(MouseButton.Left); InputManager.Click(MouseButton.Left);
}); });
AddAssert("first binding selected", () => backBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().First().IsBinding); AddAssert("first binding selected", () => multiBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().First().IsBinding);
} }
} }
} }

View File

@ -76,6 +76,8 @@ namespace osu.Game.Storyboards.Drawables
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
{ {
Channel?.Stop(); Channel?.Stop();
Channel = null;
base.Dispose(isDisposing); base.Dispose(isDisposing);
} }
} }