mirror of
https://github.com/ppy/osu
synced 2025-03-21 18:38:25 +00:00
Add music controller into game.
This commit is contained in:
parent
6aba03e1ca
commit
7543d491ae
osu.Game
@ -25,6 +25,7 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
public Toolbar Toolbar;
|
public Toolbar Toolbar;
|
||||||
public ChatConsole Chat;
|
public ChatConsole Chat;
|
||||||
|
public MusicController MusicController;
|
||||||
public MainMenu MainMenu => intro?.ChildGameMode as MainMenu;
|
public MainMenu MainMenu => intro?.ChildGameMode as MainMenu;
|
||||||
private Intro intro;
|
private Intro intro;
|
||||||
|
|
||||||
@ -74,11 +75,13 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
Beatmap = Beatmap
|
Beatmap = Beatmap
|
||||||
},
|
},
|
||||||
|
MusicController = new MusicController(),
|
||||||
Toolbar = new Toolbar
|
Toolbar = new Toolbar
|
||||||
{
|
{
|
||||||
OnHome = delegate { MainMenu?.MakeCurrent(); },
|
OnHome = delegate { MainMenu?.MakeCurrent(); },
|
||||||
OnSettings = Options.ToggleVisibility,
|
OnSettings = Options.ToggleVisibility,
|
||||||
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
|
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
|
||||||
|
OnMusicController = MusicController.ToggleVisibility,
|
||||||
},
|
},
|
||||||
Chat = new ChatConsole(API),
|
Chat = new ChatConsole(API),
|
||||||
volume = new VolumeControl
|
volume = new VolumeControl
|
||||||
|
@ -35,6 +35,13 @@ namespace osu.Game.Overlays
|
|||||||
public MusicController(BeatmapDatabase db = null)
|
public MusicController(BeatmapDatabase db = null)
|
||||||
{
|
{
|
||||||
database = db;
|
database = db;
|
||||||
|
Width = 400;
|
||||||
|
Height = 130;
|
||||||
|
CornerRadius = 5;
|
||||||
|
Masking = true;
|
||||||
|
Anchor = Anchor.TopRight;//placeholder
|
||||||
|
Origin = Anchor.TopRight;
|
||||||
|
Position = new Vector2(10, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load(BaseGame game)
|
public override void Load(BaseGame game)
|
||||||
@ -53,11 +60,6 @@ namespace osu.Game.Overlays
|
|||||||
workingChanged();
|
workingChanged();
|
||||||
playList = database.GetAllWithChildren<BeatmapSetInfo>();
|
playList = database.GetAllWithChildren<BeatmapSetInfo>();
|
||||||
|
|
||||||
Width = 400;
|
|
||||||
Height = 130;
|
|
||||||
CornerRadius = 5;
|
|
||||||
Masking = true;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
backgroundSprite = getScaledSprite(game.Textures.Get(@"Backgrounds/bg4")),//placeholder
|
backgroundSprite = getScaledSprite(game.Textures.Get(@"Backgrounds/bg4")),//placeholder
|
||||||
|
@ -22,6 +22,7 @@ namespace osu.Game.Overlays
|
|||||||
public Action OnSettings;
|
public Action OnSettings;
|
||||||
public Action OnHome;
|
public Action OnHome;
|
||||||
public Action<PlayMode> OnPlayModeChange;
|
public Action<PlayMode> OnPlayModeChange;
|
||||||
|
public Action OnMusicController;
|
||||||
|
|
||||||
private ToolbarModeSelector modeSelector;
|
private ToolbarModeSelector modeSelector;
|
||||||
|
|
||||||
@ -89,6 +90,11 @@ namespace osu.Game.Overlays
|
|||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Children = new []
|
Children = new []
|
||||||
{
|
{
|
||||||
|
new ToolbarButton
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.music,
|
||||||
|
Action = OnMusicController
|
||||||
|
},
|
||||||
new ToolbarButton
|
new ToolbarButton
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.search
|
Icon = FontAwesome.search
|
||||||
|
Loading…
Reference in New Issue
Block a user