1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 17:23:52 +08:00

Begun refractorization process of wrapping Button text in a FillFlowContainer

This commit is contained in:
Viktor Rosvall 2019-12-30 23:58:49 +01:00
parent b0bcbf8b93
commit f40ebc83ca
3 changed files with 31 additions and 33 deletions

View File

@ -16,7 +16,8 @@ namespace osu.Game.Tests.Visual.UserInterface
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] public override IReadOnlyList<Type> RequiredTypes => new[]
{ {
typeof(FooterButtonMods) typeof(FooterButtonMods),
typeof(FooterButton)
}; };
private readonly TestFooterButtonMods footerButtonMods; private readonly TestFooterButtonMods footerButtonMods;

View File

@ -56,7 +56,7 @@ namespace osu.Game.Screens.Select
} }
} }
protected readonly Container TextContainer; protected FillFlowContainer TextContainer;
protected readonly SpriteText SpriteText; protected readonly SpriteText SpriteText;
private readonly Box box; private readonly Box box;
private readonly Box light; private readonly Box light;
@ -80,15 +80,24 @@ namespace osu.Game.Screens.Select
EdgeSmoothness = new Vector2(2, 0), EdgeSmoothness = new Vector2(2, 0),
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}, },
TextContainer = new Container TextContainer = new FillFlowContainer
{ {
Size = new Vector2(100 - SHEAR_WIDTH, 50), Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Direction = FillDirection.Horizontal,
Shear = -SHEAR, Shear = -SHEAR,
Child = SpriteText = new OsuSpriteText Children = new Drawable[]
{ {
Anchor = Anchor.Centre, SpriteText = new OsuSpriteText
Origin = Anchor.Centre, {
} Size = new Vector2(100 - SHEAR_WIDTH, 50),
Shear = -SHEAR,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
},
AutoSizeAxes = Axes.Both,
// Margin = new MarginPadding { Left = 70, Right = 14 }
}, },
}; };
} }

View File

@ -3,7 +3,7 @@
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; // using osu.Framework.Graphics.Containers;
using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.HUD;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using System.Collections.Generic; using System.Collections.Generic;
@ -34,31 +34,19 @@ namespace osu.Game.Screens.Select
public FooterButtonMods() public FooterButtonMods()
{ {
Add(new FillFlowContainer TextContainer.Add(modDisplay = new FooterModDisplay
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft, Origin = Anchor.Centre,
Direction = FillDirection.Horizontal, DisplayUnrankedText = false,
Shear = -SHEAR, Scale = new Vector2(0.8f)
Children = new Drawable[] });
{ TextContainer.Add(MultiplierText = new OsuSpriteText
modDisplay = new FooterModDisplay {
{ Anchor = Anchor.Centre,
Anchor = Anchor.Centre, Origin = Anchor.Centre,
Origin = Anchor.Centre, Font = OsuFont.GetFont(weight: FontWeight.Bold),
DisplayUnrankedText = false, Margin = new MarginPadding { Right = 6 }
Scale = new Vector2(0.8f)
},
MultiplierText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Margin = new MarginPadding { Right = 6 }
}
},
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Left = 70, Right = 14 }
}); });
} }