mirror of
https://github.com/ppy/osu
synced 2025-01-01 03:42:19 +00:00
Use OverlayContainer in framework.
This commit is contained in:
parent
5e9d555309
commit
f4c381f745
@ -20,7 +20,7 @@ using osu.Game.Online.Chat.Display;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class ChatConsole : Overlay
|
||||
public class ChatConsole : OverlayContainer
|
||||
{
|
||||
private ChannelDisplay channelDisplay;
|
||||
|
||||
|
@ -6,13 +6,14 @@ using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Drawables;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.Input;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class Options : Overlay
|
||||
public class Options : OverlayContainer
|
||||
{
|
||||
private const float width = 300;
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
using osu.Framework;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
/// <summary>
|
||||
/// An element which starts hidden and can be toggled to visible.
|
||||
/// </summary>
|
||||
public abstract class Overlay : Container, IStateful<Visibility>
|
||||
{
|
||||
public override void Load(BaseGame game)
|
||||
{
|
||||
base.Load(game);
|
||||
|
||||
//TODO: init code using Alpha or IsVisible override to ensure we don't call Load on children before we first get unhidden.
|
||||
PopOut();
|
||||
Flush();
|
||||
}
|
||||
|
||||
private Visibility state;
|
||||
public Visibility State
|
||||
{
|
||||
get { return state; }
|
||||
set
|
||||
{
|
||||
if (value == state) return;
|
||||
state = value;
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case Visibility.Hidden:
|
||||
PopOut();
|
||||
break;
|
||||
case Visibility.Visible:
|
||||
PopIn();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void PopIn();
|
||||
|
||||
protected abstract void PopOut();
|
||||
|
||||
public void ToggleVisibility() => State = (State == Visibility.Visible ? Visibility.Hidden : Visibility.Visible);
|
||||
}
|
||||
|
||||
public enum Visibility
|
||||
{
|
||||
Hidden,
|
||||
Visible
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class Toolbar : Overlay
|
||||
public class Toolbar : OverlayContainer
|
||||
{
|
||||
private const float height = 50;
|
||||
|
||||
|
@ -156,7 +156,6 @@
|
||||
<Compile Include="OsuGameBase.cs" />
|
||||
<Compile Include="Overlays\ChatConsole.cs" />
|
||||
<Compile Include="Overlays\Options.cs" />
|
||||
<Compile Include="Overlays\Overlay.cs" />
|
||||
<Compile Include="Overlays\Toolbar.cs" />
|
||||
<Compile Include="Overlays\ToolbarButton.cs" />
|
||||
<Compile Include="Overlays\ToolbarModeButton.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user