1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-29 05:43:21 +08:00

Combine constant

This commit is contained in:
Dean Herbert 2019-01-25 14:10:59 +09:00
parent 4cae9bae83
commit 787d4da153
10 changed files with 25 additions and 37 deletions

View File

@ -22,16 +22,12 @@ using osu.Game.Graphics.Containers;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Mods.Sections; using osu.Game.Overlays.Mods.Sections;
using osu.Game.Screens;
namespace osu.Game.Overlays.Mods namespace osu.Game.Overlays.Mods
{ {
public class ModSelectOverlay : WaveOverlayContainer public class ModSelectOverlay : WaveOverlayContainer
{ {
/// <summary>
/// How much this container should overflow the sides of the screen to account for parallax shifting.
/// </summary>
private const float overflow_padding = 50;
private const float content_width = 0.8f; private const float content_width = 0.8f;
protected Color4 LowMultiplierColour, HighMultiplierColour; protected Color4 LowMultiplierColour, HighMultiplierColour;
@ -203,11 +199,7 @@ namespace osu.Game.Overlays.Mods
Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e"); Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e");
Height = 510; Height = 510;
Padding = new MarginPadding Padding = new MarginPadding { Horizontal = -OsuScreen.HORIZONTAL_OVERFLOW_PADDING };
{
Left = -overflow_padding,
Right = -overflow_padding
};
Children = new Drawable[] Children = new Drawable[]
{ {
@ -267,11 +259,7 @@ namespace osu.Game.Overlays.Mods
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Width = content_width, Width = content_width,
Padding = new MarginPadding Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
{
Left = overflow_padding,
Right = overflow_padding
},
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText
@ -312,8 +300,7 @@ namespace osu.Game.Overlays.Mods
Padding = new MarginPadding Padding = new MarginPadding
{ {
Vertical = 10, Vertical = 10,
Left = overflow_padding, Horizontal = -OsuScreen.HORIZONTAL_OVERFLOW_PADDING
Right = overflow_padding
}, },
Child = ModSectionsContainer = new FillFlowContainer<ModSection> Child = ModSectionsContainer = new FillFlowContainer<ModSection>
{ {
@ -361,8 +348,7 @@ namespace osu.Game.Overlays.Mods
Padding = new MarginPadding Padding = new MarginPadding
{ {
Vertical = 15, Vertical = 15,
Left = overflow_padding, Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
Right = overflow_padding
}, },
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -37,7 +37,7 @@ namespace osu.Game.Screens.Multi
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + Multiplayer.OVERFLOW_PADDING }, Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer

View File

@ -13,7 +13,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
protected override Color4 BackgroundColour => OsuColour.FromHex(@"362e42"); protected override Color4 BackgroundColour => OsuColour.FromHex(@"362e42");
protected override PrimaryFilter DefaultTab => PrimaryFilter.Open; protected override PrimaryFilter DefaultTab => PrimaryFilter.Open;
protected override float InternalPadding => Multiplayer.OVERFLOW_PADDING; protected override float InternalPadding => OsuScreen.HORIZONTAL_OVERFLOW_PADDING;
public FilterControl() public FilterControl()
{ {

View File

@ -91,8 +91,8 @@ namespace osu.Game.Screens.Multi.Lounge
content.Padding = new MarginPadding content.Padding = new MarginPadding
{ {
Top = Filter.DrawHeight, Top = Filter.DrawHeight,
Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH + Multiplayer.OVERFLOW_PADDING, Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH + HORIZONTAL_OVERFLOW_PADDING,
Right = SearchableListOverlay.WIDTH_PADDING + Multiplayer.OVERFLOW_PADDING, Right = SearchableListOverlay.WIDTH_PADDING + HORIZONTAL_OVERFLOW_PADDING,
}; };
} }

View File

@ -70,7 +70,7 @@ namespace osu.Game.Screens.Multi.Match.Components
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + Multiplayer.OVERFLOW_PADDING }, Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer

View File

@ -41,7 +41,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + Multiplayer.OVERFLOW_PADDING }, Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer

View File

@ -81,7 +81,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{ {
Padding = new MarginPadding Padding = new MarginPadding
{ {
Horizontal = Multiplayer.OVERFLOW_PADDING, Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
Vertical = 10 Vertical = 10
}, },
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -214,7 +214,7 @@ namespace osu.Game.Screens.Multi.Match.Components
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 20), Spacing = new Vector2(0, 20),
Margin = new MarginPadding { Vertical = 20 }, Margin = new MarginPadding { Vertical = 20 },
Padding = new MarginPadding { Horizontal = Multiplayer.OVERFLOW_PADDING }, Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
Children = new Drawable[] Children = new Drawable[]
{ {
ApplyButton = new CreateRoomButton ApplyButton = new CreateRoomButton

View File

@ -77,7 +77,7 @@ namespace osu.Game.Screens.Multi.Match
{ {
Padding = new MarginPadding Padding = new MarginPadding
{ {
Left = 10 + Multiplayer.OVERFLOW_PADDING, Left = 10 + HORIZONTAL_OVERFLOW_PADDING,
Right = 10, Right = 10,
Vertical = 10, Vertical = 10,
}, },
@ -89,7 +89,7 @@ namespace osu.Game.Screens.Multi.Match
Padding = new MarginPadding Padding = new MarginPadding
{ {
Left = 10, Left = 10,
Right = 10 + Multiplayer.OVERFLOW_PADDING, Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
Vertical = 10, Vertical = 10,
}, },
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -121,8 +121,9 @@ namespace osu.Game.Screens.Multi.Match
header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect
{ {
Selected = addPlaylistItem, Selected = addPlaylistItem,
Padding = new MarginPadding { Horizontal = Multiplayer.OVERFLOW_PADDING } Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING }
}); });
header.Tabs.Current.ValueChanged += t => header.Tabs.Current.ValueChanged += t =>
{ {
const float fade_duration = 500; const float fade_duration = 500;

View File

@ -26,11 +26,6 @@ namespace osu.Game.Screens.Multi
[Cached] [Cached]
public class Multiplayer : OsuScreen, IOnlineComponent public class Multiplayer : OsuScreen, IOnlineComponent
{ {
/// <summary>
/// How much this container should overflow the sides of the screen to account for parallax shifting.
/// </summary>
public const float OVERFLOW_PADDING = 50;
private readonly MultiplayerWaveContainer waves; private readonly MultiplayerWaveContainer waves;
public override bool AllowBeatmapRulesetChange => currentSubScreen?.AllowBeatmapRulesetChange ?? base.AllowBeatmapRulesetChange; public override bool AllowBeatmapRulesetChange => currentSubScreen?.AllowBeatmapRulesetChange ?? base.AllowBeatmapRulesetChange;
@ -53,7 +48,7 @@ namespace osu.Game.Screens.Multi
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}; };
Padding = new MarginPadding { Horizontal = -OVERFLOW_PADDING }; Padding = new MarginPadding { Horizontal = -HORIZONTAL_OVERFLOW_PADDING };
waves.AddRange(new Drawable[] waves.AddRange(new Drawable[]
{ {
@ -93,7 +88,7 @@ namespace osu.Game.Screens.Multi
Margin = new MarginPadding Margin = new MarginPadding
{ {
Top = 10, Top = 10,
Right = 10 + OVERFLOW_PADDING, Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
}, },
Text = "Create room", Text = "Create room",
Action = () => loungeSubScreen.Push(new Room Action = () => loungeSubScreen.Push(new Room

View File

@ -23,6 +23,12 @@ namespace osu.Game.Screens
{ {
public abstract class OsuScreen : Screen, IKeyBindingHandler<GlobalAction>, IHasDescription public abstract class OsuScreen : Screen, IKeyBindingHandler<GlobalAction>, IHasDescription
{ {
/// <summary>
/// The amount of negative padding that should be applied to game background content which touches both the left and right sides of the screen.
/// This allows for the game content to be pushed byt he options/notification overlays without causing black areas to appear.
/// </summary>
public const float HORIZONTAL_OVERFLOW_PADDING = 50;
public BackgroundScreen Background { get; private set; } public BackgroundScreen Background { get; private set; }
/// <summary> /// <summary>