SettingsContainer -> SettingsDropdownContainer

This commit is contained in:
EVAST9919
2017-05-21 18:22:27 +03:00
parent 8c1437c51a
commit 0615f104f0
6 changed files with 24 additions and 19 deletions

View File

@ -48,7 +48,7 @@ namespace osu.Desktop.VisualTests.Tests
}));
}
private class ExampleContainer : SettingsContainer
private class ExampleContainer : SettingsDropdownContainer
{
public override string Title => @"EXAMPLE";
}

View File

@ -3,6 +3,7 @@
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
@ -10,7 +11,7 @@ using osu.Game.Graphics.Sprites;
namespace osu.Game.Graphics.UserInterface
{
public abstract class SettingsContainer : Container
public abstract class SettingsDropdownContainer : Container
{
/// <summary>
/// The title of this container.
@ -18,16 +19,19 @@ namespace osu.Game.Graphics.UserInterface
public abstract string Title { get; }
private const float transition_duration = 600;
private const int container_width = 250;
private const int container_width = 270;
private const int border_thickness = 2;
private const int header_height = 30;
private const int corner_radius = 5;
private readonly FillFlowContainer content;
private readonly SimpleButton button;
private FillFlowContainer content;
private SimpleButton button;
private bool buttonIsPressed;
protected SettingsContainer()
private Color4 buttonPressedColour;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AutoSizeAxes = Axes.Y;
Width = container_width;
@ -54,6 +58,7 @@ namespace osu.Game.Graphics.UserInterface
{
new Container
{
Name = @"Header",
RelativeSizeAxes = Axes.X,
Height = header_height,
Origin = Anchor.TopCentre,
@ -76,13 +81,15 @@ namespace osu.Game.Graphics.UserInterface
Anchor = Anchor.CentreRight,
Position = new Vector2(-15,0),
Icon = FontAwesome.fa_bars,
Scale = new Vector2(0.7f),
Action = () => triggerContentVisibility(),
Scale = new Vector2(0.75f),
Colour = buttonPressedColour = colours.Yellow,
Action = triggerContentVisibility,
},
}
},
content = new FillFlowContainer
{
Name = @"Content",
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
@ -91,13 +98,11 @@ namespace osu.Game.Graphics.UserInterface
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Padding = new MarginPadding(15),
Spacing = new Vector2(0, 10),
Spacing = new Vector2(0, 15),
}
}
},
};
button.TriggerClick();
}
public new void Add(Drawable drawable)
@ -107,10 +112,6 @@ namespace osu.Game.Graphics.UserInterface
private void triggerContentVisibility()
{
buttonIsPressed = !buttonIsPressed;
button.FadeColour(buttonIsPressed ? OsuColour.FromHex(@"ffcc22") : Color4.White, 200, EasingTypes.OutQuint);
if (buttonIsPressed)
{
content.ClearTransforms();
@ -121,6 +122,10 @@ namespace osu.Game.Graphics.UserInterface
content.AutoSizeAxes = Axes.None;
content.ResizeHeightTo(0, transition_duration, EasingTypes.OutQuint);
}
button.FadeColour(buttonIsPressed ? buttonPressedColour : Color4.White, 200, EasingTypes.OutQuint);
buttonIsPressed = !buttonIsPressed;
}
}
}

View File

@ -10,7 +10,7 @@ using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Play.Settings
{
public class CollectionSettings : SettingsContainer
public class CollectionSettings : SettingsDropdownContainer
{
public override string Title => @"COLLECTIONS";

View File

@ -9,7 +9,7 @@ using osu.Game.Overlays.Settings;
namespace osu.Game.Screens.Play.Settings
{
public class DiscussionSettings : SettingsContainer
public class DiscussionSettings : SettingsDropdownContainer
{
public override string Title => @"DISCUSSIONS";

View File

@ -8,7 +8,7 @@ using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Play.Settings
{
public class PlaybackSettings : SettingsContainer
public class PlaybackSettings : SettingsDropdownContainer
{
public override string Title => @"PLAYBACK";

View File

@ -239,7 +239,7 @@
<Compile Include="Screens\Play\HotkeyRetryOverlay.cs" />
<Compile Include="Screens\Play\Settings\CollectionSettings.cs" />
<Compile Include="Screens\Play\Settings\DiscussionSettings.cs" />
<Compile Include="Graphics\UserInterface\SettingsContainer.cs" />
<Compile Include="Graphics\UserInterface\SettingsDropdownContainer.cs" />
<Compile Include="Screens\Play\Settings\ReplaySettingsOverlay.cs" />
<Compile Include="Screens\Play\Settings\PlaybackSettings.cs" />
<Compile Include="Screens\Play\PauseContainer.cs" />