mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Merge remote-tracking branch 'upstream/master' into tgi74-hit-shake
# Conflicts: # osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs # osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs # osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
This commit is contained in:
@ -5,10 +5,11 @@ using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.EventArgs;
|
||||
using osu.Framework.Input.States;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
@ -17,6 +18,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
private const float width = 128;
|
||||
|
||||
private Color4 accentColour = Color4.Black;
|
||||
|
||||
/// <summary>
|
||||
/// The colour that is used for the slider ball.
|
||||
/// </summary>
|
||||
@ -26,14 +28,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
if (ball != null)
|
||||
ball.Colour = value;
|
||||
if (drawableBall != null)
|
||||
drawableBall.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Slider slider;
|
||||
public readonly Box FollowCircle;
|
||||
private readonly Box ball;
|
||||
public readonly Drawable FollowCircle;
|
||||
private Drawable drawableBall;
|
||||
private readonly DrawableSlider drawableSlider;
|
||||
|
||||
public SliderBall(Slider slider, DrawableSlider drawableSlider = null)
|
||||
@ -44,19 +46,30 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Blending = BlendingMode.Additive;
|
||||
Origin = Anchor.Centre;
|
||||
BorderThickness = 10;
|
||||
BorderColour = Color4.Orange;
|
||||
|
||||
Children = new Drawable[]
|
||||
Children = new[]
|
||||
{
|
||||
FollowCircle = new Box
|
||||
FollowCircle = new Container
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Colour = Color4.Orange,
|
||||
Width = width,
|
||||
Height = width,
|
||||
Alpha = 0,
|
||||
Child = new SkinnableDrawable("Play/osu/sliderfollowcircle", _ => new CircularContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
BorderThickness = 5,
|
||||
BorderColour = Color4.Orange,
|
||||
Blending = BlendingMode.Additive,
|
||||
Child = new Box
|
||||
{
|
||||
Colour = Color4.Orange,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0.2f,
|
||||
}
|
||||
}),
|
||||
},
|
||||
new CircularContainer
|
||||
{
|
||||
@ -64,18 +77,26 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
BorderThickness = 10,
|
||||
BorderColour = Color4.White,
|
||||
Alpha = 1,
|
||||
Children = new[]
|
||||
Child = new Container
|
||||
{
|
||||
ball = new Box
|
||||
Width = width,
|
||||
Height = width,
|
||||
// TODO: support skin filename animation (sliderb0, sliderb1...)
|
||||
Child = new SkinnableDrawable("Play/osu/sliderb", _ => new CircularContainer
|
||||
{
|
||||
Colour = AccentColour,
|
||||
Alpha = 0.4f,
|
||||
Width = width,
|
||||
Height = width,
|
||||
},
|
||||
Masking = true,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BorderThickness = 10,
|
||||
BorderColour = Color4.White,
|
||||
Alpha = 1,
|
||||
Child = drawableBall = new Box
|
||||
{
|
||||
Colour = AccentColour,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0.4f,
|
||||
}
|
||||
}),
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -101,9 +122,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
return base.OnMouseMove(state);
|
||||
}
|
||||
|
||||
// If the current time is between the start and end of the slider, we should track mouse input regardless of the cursor position.
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => canCurrentlyTrack || base.ReceiveMouseInputAt(screenSpacePos);
|
||||
|
||||
public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null)
|
||||
{
|
||||
// Consider the case of rewinding - children's transforms are handled internally, so propagating down
|
||||
@ -112,6 +130,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
}
|
||||
|
||||
private bool tracking;
|
||||
|
||||
public bool Tracking
|
||||
{
|
||||
get { return tracking; }
|
||||
@ -121,8 +140,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
return;
|
||||
tracking = value;
|
||||
|
||||
FollowCircle.ScaleTo(tracking ? 2.8f : 1, 300, Easing.OutQuint);
|
||||
FollowCircle.FadeTo(tracking ? 0.2f : 0, 300, Easing.OutQuint);
|
||||
FollowCircle.ScaleTo(tracking ? 2f : 1, 300, Easing.OutQuint);
|
||||
FollowCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,7 +156,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
// Make sure to use the base version of ReceiveMouseInputAt so that we correctly check the position.
|
||||
Tracking = canCurrentlyTrack
|
||||
&& lastState != null
|
||||
&& base.ReceiveMouseInputAt(lastState.Mouse.NativeState.Position)
|
||||
&& ReceiveMouseInputAt(lastState.Mouse.NativeState.Position)
|
||||
&& (drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user