1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 22:27:25 +08:00

Use a bindable for the current screen in EditorMenuBar

Replaces the current Action.
This commit is contained in:
smoogipoo 2017-10-04 19:37:17 +09:00
parent 34eede0d04
commit 8a52fdc8fa
2 changed files with 4 additions and 6 deletions

View File

@ -96,7 +96,7 @@ namespace osu.Game.Screens.Edit
}; };
timeline.Beatmap.BindTo(Beatmap); timeline.Beatmap.BindTo(Beatmap);
menuBar.ModeChanged += onModeChanged; menuBar.Mode.ValueChanged += onModeChanged;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -11,16 +11,14 @@ using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Game.Screens.Edit.Screens; using osu.Game.Screens.Edit.Screens;
namespace osu.Game.Screens.Edit.Menus namespace osu.Game.Screens.Edit.Menus
{ {
public class EditorMenuBar : OsuMenu public class EditorMenuBar : OsuMenu
{ {
/// <summary> public readonly Bindable<EditorScreenMode> Mode = new Bindable<EditorScreenMode>();
/// Invaoked when the selected mode has changed.
/// </summary>
public event Action<EditorScreenMode> ModeChanged;
private readonly ScreenSelectionTabControl tabControl; private readonly ScreenSelectionTabControl tabControl;
@ -42,7 +40,7 @@ namespace osu.Game.Screens.Edit.Menus
} }
}); });
tabControl.Current.ValueChanged += v => ModeChanged?.Invoke(v); tabControl.Current.BindTo(Mode);
} }
protected override void LoadComplete() protected override void LoadComplete()