mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 13:22:57 +08:00
Add MusicControllerToast used to display current music playback status on OSD
This commit is contained in:
parent
2ab30281fb
commit
2926932a1a
@ -726,21 +726,21 @@ namespace osu.Game
|
||||
if (!musicController.IsLoaded) return true;
|
||||
|
||||
if (musicController.PlayTrack())
|
||||
osd.Display(new Overlays.OSD.OsdIconToast(musicController.IsPlaying ? "Play track" : "Pause track", musicController.IsPlaying ? FontAwesome.Solid.PlayCircle : FontAwesome.Solid.PauseCircle));
|
||||
osd.Display(new Overlays.OSD.MusicControllerToast(musicController.IsPlaying ? "Play track" : "Pause track"));
|
||||
return true;
|
||||
|
||||
case GlobalAction.MusicNext:
|
||||
if (!musicController.IsLoaded) return true;
|
||||
|
||||
if (musicController.NextTrack())
|
||||
osd.Display(new Overlays.OSD.OsdIconToast("Next track", FontAwesome.Solid.FastForward));
|
||||
osd.Display(new Overlays.OSD.MusicControllerToast("Next track"));
|
||||
return true;
|
||||
|
||||
case GlobalAction.MusicPrev:
|
||||
if (!musicController.IsLoaded) return true;
|
||||
|
||||
if (musicController.PreviousTrack())
|
||||
osd.Display(new Overlays.OSD.OsdIconToast("Previous track", FontAwesome.Solid.FastBackward));
|
||||
osd.Display(new Overlays.OSD.MusicControllerToast("Previous track"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
13
osu.Game/Overlays/OSD/MusicControllerToast.cs
Normal file
13
osu.Game/Overlays/OSD/MusicControllerToast.cs
Normal file
@ -0,0 +1,13 @@
|
||||
// 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.
|
||||
|
||||
namespace osu.Game.Overlays.OSD
|
||||
{
|
||||
public class MusicControllerToast : Toast
|
||||
{
|
||||
public MusicControllerToast(string value)
|
||||
: base("Music Playback", value, "")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
// 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.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.OSD
|
||||
{
|
||||
public class OsdIconToast : OsdToast
|
||||
{
|
||||
public OsdIconToast(string message, IconUsage icon)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new osuTK.Vector2(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light),
|
||||
Text = message
|
||||
},
|
||||
new SpriteIcon
|
||||
{
|
||||
Icon = icon,
|
||||
Size = new osuTK.Vector2(45),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user