1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 19:22:54 +08:00

Rearrange things somewhat

This commit is contained in:
Drew DeVault 2017-03-15 20:11:50 -04:00
parent cac6c42aac
commit 3aecbf5739
8 changed files with 40 additions and 35 deletions

View File

@ -8,7 +8,7 @@ using osu.Framework.Graphics.Primitives;
using osu.Framework.Screens.Testing;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.Select.Tab;
using osu.Game.Graphics.UserInterface;
namespace osu.Desktop.VisualTests.Tests
{
@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests.Tests
base.Reset();
OsuSpriteText text;
FilterTabControl<GroupMode> filter;
OsuTabControl<GroupMode> filter;
Add(new FillFlowContainer
{
@ -29,7 +29,7 @@ namespace osu.Desktop.VisualTests.Tests
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
filter = new FilterTabControl<GroupMode>
filter = new OsuTabControl<GroupMode>
{
Width = 229,
AutoSort = true

View File

@ -4,18 +4,18 @@
using System;
using osu.Framework.Graphics.UserInterface.Tab;
namespace osu.Game.Screens.Select.Tab
namespace osu.Game.Graphics.UserInterface
{
public class FilterTabControl<T> : TabControl<T>
public class OsuTabControl<T> : TabControl<T>
{
protected override TabDropDownMenu<T> CreateDropDownMenu() => new FilterTabDropDownMenu<T>();
protected override TabDropDownMenu<T> CreateDropDownMenu() => new OsuTabDropDownMenu<T>();
protected override TabItem<T> CreateTabItem(T value) => new FilterTabItem<T> { Value = value };
protected override TabItem<T> CreateTabItem(T value) => new OsuTabItem<T> { Value = value };
public FilterTabControl(float offset = 0) : base(offset)
public OsuTabControl(float offset = 0) : base(offset)
{
if (!typeof(T).IsEnum)
throw new InvalidOperationException("FilterTabControl only supports enums as the generic type argument");
throw new InvalidOperationException("OsuTabControl only supports enums as the generic type argument");
foreach (var val in (T[])Enum.GetValues(typeof(T)))
AddTab(val);

View File

@ -6,13 +6,14 @@ using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.UserInterface.Tab;
using osu.Game.Graphics;
namespace osu.Game.Screens.Select.Tab
namespace osu.Game.Graphics.UserInterface
{
public class FilterTabDropDownHeader : TabDropDownHeader
public class OsuTabDropDownHeader : TabDropDownHeader
{
protected override string Label { get; set; }
public FilterTabDropDownHeader() {
public OsuTabDropDownHeader()
{
Foreground.Children = new Drawable[]
{
new TextAwesome

View File

@ -12,18 +12,18 @@ using osu.Framework.Graphics.UserInterface.Tab;
using osu.Game.Graphics;
using osu.Game.Screens.Select.Filter;
namespace osu.Game.Screens.Select.Tab
namespace osu.Game.Graphics.UserInterface
{
public class FilterTabDropDownMenu<T> : TabDropDownMenu<T>
public class OsuTabDropDownMenu<T> : TabDropDownMenu<T>
{
public override float HeaderWidth => 14;
public override float HeaderHeight => 24;
protected override DropDownHeader CreateHeader() => new FilterTabDropDownHeader();
protected override DropDownHeader CreateHeader() => new OsuTabDropDownHeader();
protected override DropDownMenuItem<T> CreateDropDownItem(string key, T value) => new FilterTabDropDownMenuItem<T>(key, value);
protected override DropDownMenuItem<T> CreateDropDownItem(string key, T value) => new OsuTabDropDownMenuItem<T>(key, value);
public FilterTabDropDownMenu()
public OsuTabDropDownMenu()
{
MaxDropDownHeight = int.MaxValue;
ContentContainer.CornerRadius = 4;
@ -48,7 +48,8 @@ namespace osu.Game.Screens.Select.Tab
}
[BackgroundDependencyLoader]
private void load(OsuColour colours) {
private void load(OsuColour colours)
{
Header.Colour = typeof(T) == typeof(SortMode) ? colours.GreenLight : colours.Blue;
}
}

View File

@ -11,11 +11,11 @@ using OpenTK.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Select.Filter;
namespace osu.Game.Screens.Select.Tab
namespace osu.Game.Graphics.UserInterface
{
public class FilterTabDropDownMenuItem<T> : DropDownMenuItem<T>
public class OsuTabDropDownMenuItem<T> : DropDownMenuItem<T>
{
public FilterTabDropDownMenuItem(string text, T value) : base(text, value)
public OsuTabDropDownMenuItem(string text, T value) : base(text, value)
{
Foreground.Padding = new MarginPadding { Top = 4, Bottom = 4 };
Foreground.Margin = new MarginPadding { Left = 7 };

View File

@ -14,9 +14,9 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Select.Filter;
namespace osu.Game.Screens.Select.Tab
namespace osu.Game.Graphics.UserInterface
{
public class FilterTabItem<T> : TabItem<T>
public class OsuTabItem<T> : TabItem<T>
{
private SpriteText text;
private Box box;
@ -68,7 +68,7 @@ namespace osu.Game.Screens.Select.Tab
fadeInactive();
}
public FilterTabItem()
public OsuTabItem()
{
AutoSizeAxes = Axes.Both;
Children = new Drawable[]

View File

@ -9,12 +9,12 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface.Tab;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.Select.Tab;
using Container = osu.Framework.Graphics.Containers.Container;
using osu.Framework.Graphics.UserInterface.Tab;
namespace osu.Game.Screens.Select
{
@ -23,8 +23,10 @@ namespace osu.Game.Screens.Select
public Action FilterChanged;
public string Search => searchTextBox.Text;
private SortMode sort = SortMode.Title;
public SortMode Sort {
public SortMode Sort
{
get { return sort; }
set
{
@ -37,7 +39,8 @@ namespace osu.Game.Screens.Select
}
private GroupMode group = GroupMode.All;
public GroupMode Group {
public GroupMode Group
{
get { return group; }
set
{
@ -105,7 +108,7 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.TopLeft,
Position = new Vector2(0, 23)
},
groupTabs = new FilterTabControl<GroupMode>
groupTabs = new OsuTabControl<GroupMode>
{
Width = 230,
AutoSort = true
@ -128,7 +131,7 @@ namespace osu.Game.Screens.Select
Bottom = 5
},
},
sortTabs = new FilterTabControl<SortMode>(87)
sortTabs = new OsuTabControl<SortMode>(87)
{
Width = 191,
AutoSort = true

View File

@ -85,11 +85,6 @@
<Compile Include="Graphics\UserInterface\OsuPasswordTextBox.cs" />
<Compile Include="Graphics\UserInterface\OsuSliderBar.cs" />
<Compile Include="Graphics\UserInterface\OsuTextBox.cs" />
<Compile Include="Screens\Select\Tab\FilterTabControl.cs" />
<Compile Include="Screens\Select\Tab\FilterTabDropDownMenu.cs" />
<Compile Include="Screens\Select\Tab\FilterTabItem.cs" />
<Compile Include="Screens\Select\Tab\FilterTabDropDownHeader.cs" />
<Compile Include="Screens\Select\Tab\FilterTabDropDownMenuItem.cs" />
<Compile Include="Graphics\UserInterface\TwoLayerButton.cs" />
<Compile Include="Input\Handlers\ReplayInputHandler.cs" />
<Compile Include="IO\Legacy\ILegacySerializable.cs" />
@ -354,6 +349,11 @@
<Compile Include="Overlays\WaveOverlayContainer.cs" />
<Compile Include="Screens\Select\Options\BeatmapOptionsButton.cs" />
<Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" />
<Compile Include="Graphics\UserInterface\OsuTabControl.cs" />
<Compile Include="Graphics\UserInterface\OsuTabDropDownHeader.cs" />
<Compile Include="Graphics\UserInterface\OsuTabDropDownMenu.cs" />
<Compile Include="Graphics\UserInterface\OsuTabDropDownMenuItem.cs" />
<Compile Include="Graphics\UserInterface\OsuTabItem.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">