mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 05:22:54 +08:00
add random button
This commit is contained in:
parent
b4d0755818
commit
01cc78108c
@ -54,7 +54,8 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly SpriteText spriteText;
|
protected readonly Container textContainer;
|
||||||
|
protected readonly SpriteText spriteText;
|
||||||
private readonly Box box;
|
private readonly Box box;
|
||||||
private readonly Box light;
|
private readonly Box light;
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ namespace osu.Game.Screens.Select
|
|||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
textContainer = new Container
|
||||||
{
|
{
|
||||||
Size = new Vector2(100, 50),
|
Size = new Vector2(100, 50),
|
||||||
Child = spriteText = new OsuSpriteText
|
Child = spriteText = new OsuSpriteText
|
||||||
|
56
osu.Game/Screens/Select/FooterButtonRandom.cs
Normal file
56
osu.Game/Screens/Select/FooterButtonRandom.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
// 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.Graphics;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select
|
||||||
|
{
|
||||||
|
public class FooterButtonRandom : FooterButton
|
||||||
|
{
|
||||||
|
private readonly SpriteText secondaryText;
|
||||||
|
private bool secondaryActive;
|
||||||
|
|
||||||
|
public FooterButtonRandom()
|
||||||
|
{
|
||||||
|
textContainer.Add(secondaryText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Text = @"rewind",
|
||||||
|
Alpha = 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
{
|
||||||
|
secondaryActive = e.ShiftPressed;
|
||||||
|
updateText();
|
||||||
|
return base.OnKeyDown(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyUp(KeyUpEvent e)
|
||||||
|
{
|
||||||
|
secondaryActive = e.ShiftPressed;
|
||||||
|
updateText();
|
||||||
|
return base.OnKeyUp(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateText()
|
||||||
|
{
|
||||||
|
if (secondaryActive)
|
||||||
|
{
|
||||||
|
spriteText.FadeOut(120, Easing.InQuad);
|
||||||
|
secondaryText.FadeIn(120, Easing.InQuad);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spriteText.FadeIn(120, Easing.InQuad);
|
||||||
|
secondaryText.FadeOut(120, Easing.InQuad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -225,7 +225,7 @@ namespace osu.Game.Screens.Select
|
|||||||
if (Footer != null)
|
if (Footer != null)
|
||||||
{
|
{
|
||||||
Footer.AddButton(new FooterButtonMods(selectedMods), @"mods", colours.Yellow, ModSelect, Key.F1);
|
Footer.AddButton(new FooterButtonMods(selectedMods), @"mods", colours.Yellow, ModSelect, Key.F1);
|
||||||
Footer.AddButton(new FooterButton(), @"random", colours.Green, triggerRandom, Key.F2);
|
Footer.AddButton(new FooterButtonRandom(), @"random", colours.Green, triggerRandom, Key.F2);
|
||||||
Footer.AddButton(new FooterButton(), @"options", colours.Blue, BeatmapOptions, Key.F3);
|
Footer.AddButton(new FooterButton(), @"options", colours.Blue, BeatmapOptions, Key.F3);
|
||||||
|
|
||||||
BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue);
|
BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue);
|
||||||
|
Loading…
Reference in New Issue
Block a user