mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 00:47:20 +08:00
Add a shadow and bit of elasticity to MusicController.
This commit is contained in:
parent
b65eb33774
commit
3b99a8fd06
@ -25,6 +25,8 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
public class MusicController : OverlayContainer
|
public class MusicController : OverlayContainer
|
||||||
{
|
{
|
||||||
|
private static readonly Vector2 start_position = new Vector2(10, 60);
|
||||||
|
|
||||||
private MusicControllerBackground backgroundSprite;
|
private MusicControllerBackground backgroundSprite;
|
||||||
private DragBar progress;
|
private DragBar progress;
|
||||||
private TextAwesome playButton, listButton;
|
private TextAwesome playButton, listButton;
|
||||||
@ -49,10 +51,17 @@ namespace osu.Game.Overlays
|
|||||||
Width = 400;
|
Width = 400;
|
||||||
Height = 130;
|
Height = 130;
|
||||||
CornerRadius = 5;
|
CornerRadius = 5;
|
||||||
|
EdgeEffect = new EdgeEffect
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Shadow,
|
||||||
|
Colour = new Color4(0, 0, 0, 40),
|
||||||
|
Radius = 5,
|
||||||
|
};
|
||||||
|
|
||||||
Masking = true;
|
Masking = true;
|
||||||
Anchor = Anchor.TopRight;//placeholder
|
Anchor = Anchor.TopRight;//placeholder
|
||||||
Origin = Anchor.TopRight;
|
Origin = Anchor.TopRight;
|
||||||
Position = new Vector2(10, 60);
|
Position = start_position;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
title = new SpriteText
|
title = new SpriteText
|
||||||
@ -164,6 +173,25 @@ namespace osu.Game.Overlays
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnDragStart(InputState state) => true;
|
||||||
|
|
||||||
|
protected override bool OnDrag(InputState state)
|
||||||
|
{
|
||||||
|
Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value);
|
||||||
|
change.X = -change.X;
|
||||||
|
|
||||||
|
change *= (float)Math.Pow(change.Length, 0.7f) / change.Length;
|
||||||
|
|
||||||
|
MoveTo(start_position + change);
|
||||||
|
return base.OnDrag(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnDragEnd(InputState state)
|
||||||
|
{
|
||||||
|
MoveTo(start_position, 800, EasingTypes.OutElastic);
|
||||||
|
return base.OnDragEnd(state);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
protected override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
base.Load(game);
|
base.Load(game);
|
||||||
@ -321,8 +349,6 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||||
|
|
||||||
protected override bool OnDragStart(InputState state) => true;
|
|
||||||
|
|
||||||
//placeholder for toggling
|
//placeholder for toggling
|
||||||
protected override void PopIn() => FadeIn(100);
|
protected override void PopIn() => FadeIn(100);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user