1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 11:27:24 +08:00

Split out [Sub]sections into seperate files

This commit is contained in:
Drew DeVault 2016-11-03 00:45:16 -04:00
parent 1d8c6db0a7
commit af8e4415c3
4 changed files with 118 additions and 95 deletions

View File

@ -0,0 +1,70 @@
using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Options
{
public class OptionsSection : Container
{
private SpriteText header;
private FlowContainer content;
protected override Container Content => content;
public string Header
{
get { return header.Text; }
set { header.Text = value; }
}
public OptionsSection()
{
const int headerSize = 30, headerMargin = 25;
const int borderSize = 2;
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
AddInternal(new Drawable[]
{
new Box
{
Colour = new Color4(3, 3, 3, 255),
RelativeSizeAxes = Axes.X,
Height = borderSize,
},
new Container
{
Padding = new MarginPadding
{
Top = 10 + borderSize,
Left = OptionsOverlay.SideMargins,
Right = OptionsOverlay.SideMargins,
Bottom = 10,
},
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
{
header = new SpriteText
{
TextSize = headerSize,
Colour = new Color4(247, 198, 35, 255),
},
content = new FlowContainer
{
Margin = new MarginPadding { Top = headerSize + headerMargin },
Direction = FlowDirection.VerticalOnly,
Spacing = new Vector2(0, 25),
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
},
}
},
});
}
}
}

View File

@ -0,0 +1,46 @@
using System;
using OpenTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Options
{
public class OptionsSubsection : Container
{
private SpriteText header;
private Container content;
protected override Container Content => content;
public string Header
{
get { return header.Text; }
set { header.Text = value.ToUpper(); }
}
public OptionsSubsection()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
AddInternal(new Drawable[]
{
content = new FlowContainer
{
Direction = FlowDirection.VerticalOnly,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0, 5),
Children = new[]
{
header = new SpriteText
{
TextSize = 25,
// TODO: Bold
}
}
},
});
}
}
}

View File

@ -120,99 +120,4 @@ namespace osu.Game.Overlays
MoveToX(-width, 300, EasingTypes.Out);
}
}
public class OptionsSection : Container
{
private SpriteText header;
private FlowContainer content;
protected override Container Content => content;
public string Header
{
get { return header.Text; }
set { header.Text = value; }
}
public OptionsSection()
{
const int headerSize = 30, headerMargin = 25;
const int borderSize = 2;
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
AddInternal(new Drawable[]
{
new Box
{
Colour = new Color4(3, 3, 3, 255),
RelativeSizeAxes = Axes.X,
Height = borderSize,
},
new Container
{
Padding = new MarginPadding
{
Top = 10 + borderSize,
Left = OptionsOverlay.SideMargins,
Right = OptionsOverlay.SideMargins,
Bottom = 10,
},
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
{
header = new SpriteText
{
TextSize = headerSize,
Colour = new Color4(247, 198, 35, 255),
},
content = new FlowContainer
{
Margin = new MarginPadding { Top = headerSize + headerMargin },
Direction = FlowDirection.VerticalOnly,
Spacing = new Vector2(0, 25),
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
},
}
},
});
}
}
public class OptionsSubsection : Container
{
private SpriteText header;
private Container content;
protected override Container Content => content;
public string Header
{
get { return header.Text; }
set { header.Text = value.ToUpper(); }
}
public OptionsSubsection()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
AddInternal(new Drawable[]
{
content = new FlowContainer
{
Direction = FlowDirection.VerticalOnly,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0, 5),
Children = new[]
{
header = new SpriteText
{
TextSize = 25,
// TODO: Bold
}
}
},
});
}
}
}

View File

@ -225,6 +225,8 @@
<Compile Include="Overlays\Options\OnlineIntegrationOptions.cs" />
<Compile Include="Overlays\Options\InGameChatOptions.cs" />
<Compile Include="Overlays\Options\MaintenanceOptions.cs" />
<Compile Include="Overlays\Options\OptionsSection.cs" />
<Compile Include="Overlays\Options\OptionsSubsection.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">