Move CommentsHeader to it's own file

This commit is contained in:
Andrei Zavatski 2019-10-08 20:57:55 +03:00
parent 9ab309fc0e
commit b9ad079bf8
3 changed files with 71 additions and 56 deletions

View File

@ -17,6 +17,8 @@ public class TestSceneCommentsContainer : OsuTestScene
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(CommentsContainer),
typeof(CommentsHeader),
typeof(DrawableComment),
};
protected override bool UseOnlineAPI => true;

View File

@ -9,8 +9,6 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osuTK;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Overlays.Comments
@ -115,59 +113,5 @@ private void load()
{
background.Colour = colours.Gray3;
}
private class CommentsHeader : CompositeDrawable
{
private const int height = 40;
private const int spacing = 10;
private const int padding = 50;
public readonly Bindable<SortCommentsBy> Sort = new Bindable<SortCommentsBy>();
private readonly Box background;
public CommentsHeader()
{
RelativeSizeAxes = Axes.X;
Height = height;
AddRangeInternal(new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
},
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = padding },
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(spacing, 0),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
new SpriteText
{
Font = OsuFont.GetFont(size: 14),
Text = @"Sort by"
}
}
}
}
}
});
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
background.Colour = colours.Gray4;
}
}
}
}

View File

@ -0,0 +1,69 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.API.Requests;
using osu.Framework.Graphics;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osuTK;
namespace osu.Game.Overlays.Comments
{
public class CommentsHeader : CompositeDrawable
{
private const int height = 40;
private const int spacing = 10;
private const int padding = 50;
public readonly Bindable<SortCommentsBy> Sort = new Bindable<SortCommentsBy>();
private readonly Box background;
public CommentsHeader()
{
RelativeSizeAxes = Axes.X;
Height = height;
AddRangeInternal(new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
},
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = padding },
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(spacing, 0),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
new SpriteText
{
Font = OsuFont.GetFont(size: 14),
Text = @"Sort by"
}
}
}
}
}
});
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
background.Colour = colours.Gray4;
}
}
}