Merge pull request #608 from Tom94/music-controller-button-animation

Music controller button animation
This commit is contained in:
Dean Herbert 2017-04-08 20:48:39 +09:00 committed by GitHub
commit adc16b0727
4 changed files with 21 additions and 8 deletions

@ -1 +1 @@
Subproject commit a7c99e06ff4c3f56fad24bec170eb93f42b1e149 Subproject commit 45e75163b272b7aa023afec7801ea079aba4ee69

View File

@ -48,7 +48,7 @@ public class MusicController : FocusedOverlayContainer
private const float progress_height = 10; private const float progress_height = 10;
private const float bottom_black_area_height = 50; private const float bottom_black_area_height = 55;
public MusicController() public MusicController()
{ {
@ -144,7 +144,8 @@ private void load(OsuGameBase game, OsuConfigManager config, BeatmapDatabase bea
}, },
playButton = new Button playButton = new Button
{ {
//Scale = new Vector2(1.3f), Scale = new Vector2(1.4f),
IconScale = new Vector2(1.4f),
Action = () => Action = () =>
{ {
if (current?.Track == null) return; if (current?.Track == null) return;
@ -422,6 +423,13 @@ public FontAwesome Icon
} }
private const float button_size = 30; private const float button_size = 30;
private Color4 flashColour;
public Vector2 IconScale
{
get { return icon.Scale; }
set { icon.Scale = value; }
}
public Button() public Button()
{ {
@ -468,6 +476,7 @@ public Button()
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
hover.Colour = colours.Yellow.Opacity(0.6f); hover.Colour = colours.Yellow.Opacity(0.6f);
flashColour = colours.Yellow;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(InputState state)
@ -482,9 +491,15 @@ protected override void OnHoverLost(InputState state)
base.OnHoverLost(state); base.OnHoverLost(state);
} }
protected override bool OnClick(InputState state)
{
hover.FlashColour(flashColour, 800, EasingTypes.OutQuint);
return base.OnClick(state);
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{ {
content.ScaleTo(1, 2000, EasingTypes.OutQuint); content.ScaleTo(0.75f, 2000, EasingTypes.OutQuint);
return base.OnMouseDown(state, args); return base.OnMouseDown(state, args);
} }

View File

@ -43,8 +43,8 @@ private void updateItems()
// device names. Dropdowns, however, may not have multiple identical // device names. Dropdowns, however, may not have multiple identical
// keys. Thus, we remove duplicate audio device names from // keys. Thus, we remove duplicate audio device names from
// the dropdown. BASS does not give us a simple mechanism to select // the dropdown. BASS does not give us a simple mechanism to select
// specific audio devices in such a case anyways.This functionality would // specific audio devices in such a case anyways. Such
// require OS-specific and involved code. // functionality would require involved OS-specific code.
dropdown.Items = deviceItems.Distinct().ToList(); dropdown.Items = deviceItems.Distinct().ToList();
} }

View File

@ -194,8 +194,6 @@ protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
return true; return true;
} }
protected override bool OnDragStart(InputState state) => true;
protected override bool OnClick(InputState state) protected override bool OnClick(InputState state)
{ {
if (!Interactive) return false; if (!Interactive) return false;