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 @@ public Editor()
};
timeline.Beatmap.BindTo(Beatmap);
menuBar.ModeChanged += onModeChanged;
menuBar.Mode.ValueChanged += onModeChanged;
}
[BackgroundDependencyLoader]

View File

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