mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Change main menu buttons to be activate OnClick.
This commit is contained in:
parent
f060eb07dd
commit
e2f680a65f
@ -27,6 +27,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
private Container iconText;
|
private Container iconText;
|
||||||
private Container box;
|
private Container box;
|
||||||
|
private Box boxColourLayer;
|
||||||
|
private Box boxHoverLayer;
|
||||||
private Color4 colour;
|
private Color4 colour;
|
||||||
private TextAwesome icon;
|
private TextAwesome icon;
|
||||||
private string internalName;
|
private string internalName;
|
||||||
@ -72,16 +74,24 @@ namespace osu.Game.Screens.Menu
|
|||||||
},
|
},
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Colour = colour,
|
|
||||||
Scale = new Vector2(0, 1),
|
Scale = new Vector2(0, 1),
|
||||||
Size = boxSize,
|
Size = boxSize,
|
||||||
Shear = new Vector2(ButtonSystem.WEDGE_WIDTH / boxSize.Y, 0),
|
Shear = new Vector2(ButtonSystem.WEDGE_WIDTH / boxSize.Y, 0),
|
||||||
Children = new Drawable[]
|
Children = new []
|
||||||
{
|
{
|
||||||
new Box
|
boxColourLayer = new Box
|
||||||
{
|
{
|
||||||
EdgeSmoothness = new Vector2(1.5f, 0),
|
EdgeSmoothness = new Vector2(1.5f, 0),
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colour,
|
||||||
|
},
|
||||||
|
boxHoverLayer = new Box
|
||||||
|
{
|
||||||
|
EdgeSmoothness = new Vector2(1.5f, 0),
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
BlendingMode = BlendingMode.Additive,
|
||||||
|
Colour = Color4.White,
|
||||||
|
Alpha = 0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -228,6 +238,18 @@ namespace osu.Game.Screens.Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
|
{
|
||||||
|
boxHoverLayer.FadeTo(0.1f, 1000, EasingTypes.OutQuint);
|
||||||
|
return base.OnMouseDown(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||||
|
{
|
||||||
|
boxHoverLayer.FadeTo(0, 1000, EasingTypes.OutQuint);
|
||||||
|
return base.OnMouseUp(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(InputState state)
|
||||||
{
|
{
|
||||||
trigger();
|
trigger();
|
||||||
return true;
|
return true;
|
||||||
@ -250,7 +272,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
sampleClick.Play();
|
sampleClick.Play();
|
||||||
|
|
||||||
box.FlashColour(Color4.White, 500, EasingTypes.OutExpo);
|
boxHoverLayer.ClearTransformations();
|
||||||
|
boxHoverLayer.Alpha = 0.9f;
|
||||||
|
boxHoverLayer.FadeOut(800, EasingTypes.OutExpo);
|
||||||
|
|
||||||
clickAction?.Invoke();
|
clickAction?.Invoke();
|
||||||
}
|
}
|
||||||
|
@ -172,10 +172,10 @@ namespace osu.Game.Screens.Menu
|
|||||||
State = MenuState.TopLevel;
|
State = MenuState.TopLevel;
|
||||||
return;
|
return;
|
||||||
case MenuState.TopLevel:
|
case MenuState.TopLevel:
|
||||||
buttonsTopLevel.First().TriggerMouseDown();
|
buttonsTopLevel.First().TriggerClick();
|
||||||
return;
|
return;
|
||||||
case MenuState.Play:
|
case MenuState.Play:
|
||||||
buttonsPlay.First().TriggerMouseDown();
|
buttonsPlay.First().TriggerClick();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user