mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 08:12:55 +08:00
Merge pull request #1210 from smoogipooo/new-menus
Update framework in line with the new Menu changes
This commit is contained in:
commit
5988b5924d
@ -1 +1 @@
|
|||||||
Subproject commit 2bd341b29d6a7ed864aa9c1c5fad4668dafe03a4
|
Subproject commit 3edf65857759f32d5a6d07ed523a2892b09c3c6a
|
@ -11,6 +11,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
{
|
{
|
||||||
public class BeatmapGroup : IStateful<BeatmapGroupState>
|
public class BeatmapGroup : IStateful<BeatmapGroupState>
|
||||||
{
|
{
|
||||||
|
public event Action<BeatmapGroupState> StateChanged;
|
||||||
|
|
||||||
public BeatmapPanel SelectedPanel;
|
public BeatmapPanel SelectedPanel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -31,17 +33,18 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
|
|
||||||
public BeatmapSetHeader Header;
|
public BeatmapSetHeader Header;
|
||||||
|
|
||||||
private BeatmapGroupState state;
|
|
||||||
|
|
||||||
public List<BeatmapPanel> BeatmapPanels;
|
public List<BeatmapPanel> BeatmapPanels;
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet;
|
public BeatmapSetInfo BeatmapSet;
|
||||||
|
|
||||||
|
private BeatmapGroupState state;
|
||||||
public BeatmapGroupState State
|
public BeatmapGroupState State
|
||||||
{
|
{
|
||||||
get { return state; }
|
get { return state; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
state = value;
|
||||||
|
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case BeatmapGroupState.Expanded:
|
case BeatmapGroupState.Expanded:
|
||||||
@ -60,7 +63,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
panel.State = PanelSelectedState.Hidden;
|
panel.State = PanelSelectedState.Hidden;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state = value;
|
|
||||||
|
StateChanged?.Invoke(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,6 +94,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
Header.AddDifficultyIcons(BeatmapPanels);
|
Header.AddDifficultyIcons(BeatmapPanels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void headerGainedSelection(BeatmapSetHeader panel)
|
private void headerGainedSelection(BeatmapSetHeader panel)
|
||||||
{
|
{
|
||||||
State = BeatmapGroupState.Expanded;
|
State = BeatmapGroupState.Expanded;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -15,6 +16,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
{
|
{
|
||||||
public const float MAX_HEIGHT = 80;
|
public const float MAX_HEIGHT = 80;
|
||||||
|
|
||||||
|
public event Action<PanelSelectedState> StateChanged;
|
||||||
|
|
||||||
public override bool RemoveWhenNotAlive => false;
|
public override bool RemoveWhenNotAlive => false;
|
||||||
|
|
||||||
private readonly Container nestedContainer;
|
private readonly Container nestedContainer;
|
||||||
@ -77,11 +80,15 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (state == value) return;
|
if (state == value)
|
||||||
|
return;
|
||||||
|
|
||||||
var last = state;
|
var last = state;
|
||||||
state = value;
|
state = value;
|
||||||
|
|
||||||
ApplyState(last);
|
ApplyState(last);
|
||||||
|
|
||||||
|
StateChanged?.Invoke(State);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,12 +19,12 @@ namespace osu.Game.Graphics.Containers
|
|||||||
samplePopIn = audio.Sample.Get(@"UI/melodic-5");
|
samplePopIn = audio.Sample.Get(@"UI/melodic-5");
|
||||||
samplePopOut = audio.Sample.Get(@"UI/melodic-4");
|
samplePopOut = audio.Sample.Get(@"UI/melodic-4");
|
||||||
|
|
||||||
StateChanged += OsuFocusedOverlayContainer_StateChanged;
|
StateChanged += onStateChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OsuFocusedOverlayContainer_StateChanged(VisibilityContainer arg1, Visibility arg2)
|
private void onStateChanged(Visibility visibility)
|
||||||
{
|
{
|
||||||
switch (arg2)
|
switch (visibility)
|
||||||
{
|
{
|
||||||
case Visibility.Visible:
|
case Visibility.Visible:
|
||||||
samplePopIn?.Play();
|
samplePopIn?.Play();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -35,6 +36,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private class BreadcrumbTabItem : OsuTabItem, IStateful<Visibility>
|
private class BreadcrumbTabItem : OsuTabItem, IStateful<Visibility>
|
||||||
{
|
{
|
||||||
|
public event Action<Visibility> StateChanged;
|
||||||
|
|
||||||
public readonly SpriteIcon Chevron;
|
public readonly SpriteIcon Chevron;
|
||||||
|
|
||||||
//don't allow clicking between transitions and don't make the chevron clickable
|
//don't allow clicking between transitions and don't make the chevron clickable
|
||||||
@ -42,6 +45,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
public override bool HandleInput => State == Visibility.Visible;
|
public override bool HandleInput => State == Visibility.Visible;
|
||||||
|
|
||||||
private Visibility state;
|
private Visibility state;
|
||||||
|
|
||||||
public Visibility State
|
public Visibility State
|
||||||
{
|
{
|
||||||
get { return state; }
|
get { return state; }
|
||||||
@ -62,6 +66,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
this.FadeOut(transition_duration, Easing.OutQuint);
|
this.FadeOut(transition_duration, Easing.OutQuint);
|
||||||
this.ScaleTo(new Vector2(0.8f, 1f), transition_duration, Easing.OutQuint);
|
this.ScaleTo(new Vector2(0.8f, 1f), transition_duration, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StateChanged?.Invoke(State);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,14 +14,17 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private const int fade_duration = 250;
|
private const int fade_duration = 250;
|
||||||
|
|
||||||
public OsuContextMenu()
|
public OsuContextMenu()
|
||||||
|
: base(Direction.Vertical)
|
||||||
{
|
{
|
||||||
CornerRadius = 5;
|
MaskingContainer.CornerRadius = 5;
|
||||||
EdgeEffect = new EdgeEffectParameters
|
MaskingContainer.EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Shadow,
|
Type = EdgeEffectType.Shadow,
|
||||||
Colour = Color4.Black.Opacity(0.1f),
|
Colour = Color4.Black.Opacity(0.1f),
|
||||||
Radius = 4,
|
Radius = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ItemsContainer.Padding = new MarginPadding { Vertical = DrawableOsuMenuItem.MARGIN_VERTICAL };
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -32,7 +35,5 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override void AnimateOpen() => this.FadeIn(fade_duration, Easing.OutQuint);
|
protected override void AnimateOpen() => this.FadeIn(fade_duration, Easing.OutQuint);
|
||||||
protected override void AnimateClose() => this.FadeOut(fade_duration, Easing.OutQuint);
|
protected override void AnimateClose() => this.FadeOut(fade_duration, Easing.OutQuint);
|
||||||
|
|
||||||
protected override MarginPadding ItemFlowContainerPadding => new MarginPadding { Vertical = DrawableOsuMenuItem.MARGIN_VERTICAL };
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -57,6 +57,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
CornerRadius = 4;
|
CornerRadius = 4;
|
||||||
BackgroundColour = Color4.Black.Opacity(0.5f);
|
BackgroundColour = Color4.Black.Opacity(0.5f);
|
||||||
|
|
||||||
|
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
|
||||||
|
ItemsContainer.Padding = new MarginPadding(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
|
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
|
||||||
@ -64,13 +67,18 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
protected override void AnimateClose() => this.FadeOut(300, Easing.OutQuint);
|
protected override void AnimateClose() => this.FadeOut(300, Easing.OutQuint);
|
||||||
|
|
||||||
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
|
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
|
||||||
protected override MarginPadding ItemFlowContainerPadding => new MarginPadding(5);
|
protected override void UpdateSize(Vector2 newSize)
|
||||||
|
|
||||||
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
|
|
||||||
protected override void UpdateMenuHeight()
|
|
||||||
{
|
{
|
||||||
var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight;
|
if (Direction == Direction.Vertical)
|
||||||
this.ResizeHeightTo(State == MenuState.Opened ? actualHeight : 0, 300, Easing.OutQuint);
|
{
|
||||||
|
Width = newSize.X;
|
||||||
|
this.ResizeHeightTo(newSize.Y, 300, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Height = newSize.Y;
|
||||||
|
this.ResizeWidthTo(newSize.X, 300, Easing.OutQuint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 accentColour;
|
private Color4 accentColour;
|
||||||
@ -141,7 +149,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override Drawable CreateContent() => new Content();
|
protected override Drawable CreateContent() => new Content();
|
||||||
|
|
||||||
protected class Content : FillFlowContainer, IHasText
|
protected new class Content : FillFlowContainer, IHasText
|
||||||
{
|
{
|
||||||
public string Text
|
public string Text
|
||||||
{
|
{
|
||||||
|
@ -12,27 +12,37 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public class OsuMenu : Menu
|
public class OsuMenu : Menu
|
||||||
{
|
{
|
||||||
public OsuMenu()
|
public OsuMenu(Direction direction)
|
||||||
|
: base(direction)
|
||||||
{
|
{
|
||||||
CornerRadius = 4;
|
|
||||||
BackgroundColour = Color4.Black.Opacity(0.5f);
|
BackgroundColour = Color4.Black.Opacity(0.5f);
|
||||||
|
|
||||||
|
MaskingContainer.CornerRadius = 4;
|
||||||
|
ItemsContainer.Padding = new MarginPadding(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void AnimateOpen() => this.FadeIn(300, Easing.OutQuint);
|
protected override void AnimateOpen() => this.FadeIn(300, Easing.OutQuint);
|
||||||
protected override void AnimateClose() => this.FadeOut(300, Easing.OutQuint);
|
protected override void AnimateClose() => this.FadeOut(300, Easing.OutQuint);
|
||||||
|
|
||||||
protected override void UpdateMenuHeight()
|
protected override void UpdateSize(Vector2 newSize)
|
||||||
{
|
{
|
||||||
var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight;
|
if (Direction == Direction.Vertical)
|
||||||
this.ResizeHeightTo(State == MenuState.Opened ? actualHeight : 0, 300, Easing.OutQuint);
|
{
|
||||||
|
Width = newSize.X;
|
||||||
|
this.ResizeHeightTo(newSize.Y, 300, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Height = newSize.Y;
|
||||||
|
this.ResizeWidthTo(newSize.X, 300, Easing.OutQuint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override MarginPadding ItemFlowContainerPadding => new MarginPadding(5);
|
|
||||||
|
|
||||||
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableOsuMenuItem(item);
|
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableOsuMenuItem(item);
|
||||||
|
|
||||||
|
@ -230,13 +230,13 @@ namespace osu.Game
|
|||||||
var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };
|
var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };
|
||||||
foreach (var overlay in singleDisplayOverlays)
|
foreach (var overlay in singleDisplayOverlays)
|
||||||
{
|
{
|
||||||
overlay.StateChanged += (container, state) =>
|
overlay.StateChanged += state =>
|
||||||
{
|
{
|
||||||
if (state == Visibility.Hidden) return;
|
if (state == Visibility.Hidden) return;
|
||||||
|
|
||||||
foreach (var c in singleDisplayOverlays)
|
foreach (var c in singleDisplayOverlays)
|
||||||
{
|
{
|
||||||
if (c == container) continue;
|
if (c == overlay) continue;
|
||||||
c.State = Visibility.Hidden;
|
c.State = Visibility.Hidden;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -169,7 +169,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel;
|
channelTabs.Current.ValueChanged += newChannel => CurrentChannel = newChannel;
|
||||||
channelTabs.ChannelSelectorActive.ValueChanged += value => channelSelection.State = value ? Visibility.Visible : Visibility.Hidden;
|
channelTabs.ChannelSelectorActive.ValueChanged += value => channelSelection.State = value ? Visibility.Visible : Visibility.Hidden;
|
||||||
channelSelection.StateChanged += (overlay, state) =>
|
channelSelection.StateChanged += state =>
|
||||||
{
|
{
|
||||||
channelTabs.ChannelSelectorActive.Value = state == Visibility.Visible;
|
channelTabs.ChannelSelectorActive.Value = state == Visibility.Visible;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Overlays
|
|||||||
dialogContainer.Add(currentDialog);
|
dialogContainer.Add(currentDialog);
|
||||||
|
|
||||||
currentDialog.Show();
|
currentDialog.Show();
|
||||||
currentDialog.StateChanged += onDialogOnStateChanged;
|
currentDialog.StateChanged += state => onDialogOnStateChanged(dialog, state);
|
||||||
State = Visibility.Visible;
|
State = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private const float hidden_width = 120;
|
private const float hidden_width = 120;
|
||||||
|
|
||||||
private void keyBindingOverlay_StateChanged(VisibilityContainer container, Visibility visibility)
|
private void keyBindingOverlay_StateChanged(Visibility visibility)
|
||||||
{
|
{
|
||||||
switch (visibility)
|
switch (visibility)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -19,6 +20,8 @@ namespace osu.Game.Overlays.MedalSplash
|
|||||||
private const float scale_when_unlocked = 0.76f;
|
private const float scale_when_unlocked = 0.76f;
|
||||||
private const float scale_when_full = 0.6f;
|
private const float scale_when_full = 0.6f;
|
||||||
|
|
||||||
|
public event Action<DisplayState> StateChanged;
|
||||||
|
|
||||||
private readonly Medal medal;
|
private readonly Medal medal;
|
||||||
private readonly Container medalContainer;
|
private readonly Container medalContainer;
|
||||||
private readonly Sprite medalSprite, medalGlow;
|
private readonly Sprite medalSprite, medalGlow;
|
||||||
@ -132,6 +135,8 @@ namespace osu.Game.Overlays.MedalSplash
|
|||||||
|
|
||||||
state = value;
|
state = value;
|
||||||
updateState();
|
updateState();
|
||||||
|
|
||||||
|
StateChanged?.Invoke(State);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
beatmapBacking.BindTo(game.Beatmap);
|
beatmapBacking.BindTo(game.Beatmap);
|
||||||
|
|
||||||
playlist.StateChanged += (c, s) => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
|
playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -292,6 +292,8 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
Colour = Color4.Black.Opacity(0.25f),
|
Colour = Color4.Black.Opacity(0.25f),
|
||||||
Radius = 4,
|
Radius = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ItemsContainer.Padding = new MarginPadding();
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -300,8 +302,6 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
BackgroundColour = colours.Gray3;
|
BackgroundColour = colours.Gray3;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override MarginPadding ItemFlowContainerPadding => new MarginPadding();
|
|
||||||
|
|
||||||
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableUserDropdownMenuItem(item);
|
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableUserDropdownMenuItem(item);
|
||||||
|
|
||||||
private class DrawableUserDropdownMenuItem : DrawableOsuDropdownMenuItem
|
private class DrawableUserDropdownMenuItem : DrawableOsuDropdownMenuItem
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
@ -19,6 +20,9 @@ namespace osu.Game.Overlays.Settings
|
|||||||
private readonly FillFlowContainer<SidebarButton> content;
|
private readonly FillFlowContainer<SidebarButton> content;
|
||||||
internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH;
|
internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH;
|
||||||
internal const int EXPANDED_WIDTH = 200;
|
internal const int EXPANDED_WIDTH = 200;
|
||||||
|
|
||||||
|
public event Action<ExpandedState> StateChanged;
|
||||||
|
|
||||||
protected override Container<SidebarButton> Content => content;
|
protected override Container<SidebarButton> Content => content;
|
||||||
|
|
||||||
public Sidebar()
|
public Sidebar()
|
||||||
@ -102,6 +106,8 @@ namespace osu.Game.Overlays.Settings
|
|||||||
this.ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, Easing.OutQuint);
|
this.ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, Easing.OutQuint);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StateChanged?.Invoke(State);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
stateContainer.StateChanged -= stateChanged;
|
stateContainer.StateChanged -= stateChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stateChanged(VisibilityContainer c, Visibility state)
|
private void stateChanged(Visibility state)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
|
@ -167,6 +167,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private class Wave : Container, IStateful<Visibility>
|
private class Wave : Container, IStateful<Visibility>
|
||||||
{
|
{
|
||||||
|
public event Action<Visibility> StateChanged;
|
||||||
|
|
||||||
public float FinalPosition;
|
public float FinalPosition;
|
||||||
|
|
||||||
public Wave()
|
public Wave()
|
||||||
@ -200,6 +202,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Visibility state;
|
private Visibility state;
|
||||||
|
|
||||||
public Visibility State
|
public Visibility State
|
||||||
{
|
{
|
||||||
get { return state; }
|
get { return state; }
|
||||||
@ -216,6 +219,8 @@ namespace osu.Game.Overlays
|
|||||||
this.MoveToY(FinalPosition, APPEAR_DURATION, easing_show);
|
this.MoveToY(FinalPosition, APPEAR_DURATION, easing_show);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StateChanged?.Invoke(State);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Button : BeatSyncedContainer, IStateful<ButtonState>
|
public class Button : BeatSyncedContainer, IStateful<ButtonState>
|
||||||
{
|
{
|
||||||
|
public event Action<ButtonState> StateChanged;
|
||||||
|
|
||||||
private readonly Container iconText;
|
private readonly Container iconText;
|
||||||
private readonly Container box;
|
private readonly Container box;
|
||||||
private readonly Box boxHoverLayer;
|
private readonly Box boxHoverLayer;
|
||||||
@ -266,6 +268,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
this.FadeOut(explode_duration / 4f * 3);
|
this.FadeOut(explode_duration / 4f * 3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StateChanged?.Invoke(State);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
public class ButtonSystem : Container, IStateful<MenuState>
|
public class ButtonSystem : Container, IStateful<MenuState>
|
||||||
{
|
{
|
||||||
|
public event Action<MenuState> StateChanged;
|
||||||
|
|
||||||
public Action OnEdit;
|
public Action OnEdit;
|
||||||
public Action OnExit;
|
public Action OnExit;
|
||||||
public Action OnDirect;
|
public Action OnDirect;
|
||||||
@ -294,6 +296,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
backButton.State = state == MenuState.Play ? ButtonState.Expanded : ButtonState.Contracted;
|
backButton.State = state == MenuState.Play ? ButtonState.Expanded : ButtonState.Contracted;
|
||||||
settingsButton.State = state == MenuState.TopLevel ? ButtonState.Expanded : ButtonState.Contracted;
|
settingsButton.State = state == MenuState.TopLevel ? ButtonState.Expanded : ButtonState.Contracted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StateChanged?.Invoke(State);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +133,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private class FadeContainer : Container, IStateful<Visibility>
|
private class FadeContainer : Container, IStateful<Visibility>
|
||||||
{
|
{
|
||||||
|
public event Action<Visibility> StateChanged;
|
||||||
|
|
||||||
private Visibility state;
|
private Visibility state;
|
||||||
private ScheduledDelegate scheduledHide;
|
private ScheduledDelegate scheduledHide;
|
||||||
|
|
||||||
@ -144,8 +146,10 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
var lastState = state;
|
if (state == value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var lastState = state;
|
||||||
state = value;
|
state = value;
|
||||||
|
|
||||||
scheduledHide?.Cancel();
|
scheduledHide?.Cancel();
|
||||||
@ -164,6 +168,8 @@ namespace osu.Game.Screens.Play
|
|||||||
this.FadeOut(1000, Easing.OutExpo);
|
this.FadeOut(1000, Easing.OutExpo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StateChanged?.Invoke(State);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
@ -170,6 +171,8 @@ namespace osu.Game.Screens.Play
|
|||||||
private const float padding = 2;
|
private const float padding = 2;
|
||||||
public const float WIDTH = cube_size + padding;
|
public const float WIDTH = cube_size + padding;
|
||||||
|
|
||||||
|
public event Action<ColumnState> StateChanged;
|
||||||
|
|
||||||
private readonly List<Box> drawableRows = new List<Box>();
|
private readonly List<Box> drawableRows = new List<Box>();
|
||||||
|
|
||||||
private float filled;
|
private float filled;
|
||||||
@ -186,6 +189,7 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ColumnState state;
|
private ColumnState state;
|
||||||
|
|
||||||
public ColumnState State
|
public ColumnState State
|
||||||
{
|
{
|
||||||
get { return state; }
|
get { return state; }
|
||||||
@ -196,6 +200,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
if (IsLoaded)
|
if (IsLoaded)
|
||||||
fillActive();
|
fillActive();
|
||||||
|
|
||||||
|
StateChanged?.Invoke(State);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -21,6 +22,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
{
|
{
|
||||||
public static readonly float HEIGHT = 60;
|
public static readonly float HEIGHT = 60;
|
||||||
|
|
||||||
|
public event Action<Visibility> StateChanged;
|
||||||
|
|
||||||
public readonly int RankPosition;
|
public readonly int RankPosition;
|
||||||
public readonly Score Score;
|
public readonly Score Score;
|
||||||
|
|
||||||
@ -41,11 +44,14 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
private readonly FillFlowContainer<ScoreModIcon> modsContainer;
|
private readonly FillFlowContainer<ScoreModIcon> modsContainer;
|
||||||
|
|
||||||
private Visibility state;
|
private Visibility state;
|
||||||
|
|
||||||
public Visibility State
|
public Visibility State
|
||||||
{
|
{
|
||||||
get { return state; }
|
get { return state; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (state == value)
|
||||||
|
return;
|
||||||
state = value;
|
state = value;
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
@ -88,6 +94,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StateChanged?.Invoke(State);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user