mirror of
https://github.com/ppy/osu
synced 2024-12-17 12:25:19 +00:00
Implement fixes related to auto size changes
This commit is contained in:
parent
e5168f8da8
commit
ff1a5187cd
@ -1 +1 @@
|
|||||||
Subproject commit ca807cf81ae3706972937d4e1009376cfaa0b266
|
Subproject commit 0505cf0d3b317667dbc95346f57b67fdbcdb4dee
|
@ -21,7 +21,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
class BeatmapButton : AutoSizeContainer
|
class BeatmapButton : Container
|
||||||
{
|
{
|
||||||
private BeatmapSetInfo beatmapSet;
|
private BeatmapSetInfo beatmapSet;
|
||||||
private BeatmapInfo beatmap;
|
private BeatmapInfo beatmap;
|
||||||
@ -51,6 +51,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
{
|
{
|
||||||
this.beatmapSet = set;
|
this.beatmapSet = set;
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
CornerRadius = 5;
|
CornerRadius = 5;
|
||||||
BorderThickness = 2;
|
BorderThickness = 2;
|
||||||
@ -62,12 +63,13 @@ namespace osu.Game.GameModes.Play
|
|||||||
{
|
{
|
||||||
Colour = new Color4(40, 86, 102, 255), // TODO: gradient
|
Colour = new Color4(40, 86, 102, 255), // TODO: gradient
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Size = new Vector2(1),
|
Size = Vector2.One,
|
||||||
},
|
},
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding(5),
|
Padding = new MarginPadding(5),
|
||||||
Direction = FlowDirection.HorizontalOnly,
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new DifficultyIcon(FontAwesome.dot_circle_o, new Color4(159, 198, 0, 255)),
|
new DifficultyIcon(FontAwesome.dot_circle_o, new Color4(159, 198, 0, 255)),
|
||||||
@ -75,11 +77,13 @@ namespace osu.Game.GameModes.Play
|
|||||||
{
|
{
|
||||||
Padding = new MarginPadding { Left = 10 },
|
Padding = new MarginPadding { Left = 10 },
|
||||||
Direction = FlowDirection.VerticalOnly,
|
Direction = FlowDirection.VerticalOnly,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
Direction = FlowDirection.HorizontalOnly,
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new SpriteText
|
new SpriteText
|
||||||
|
@ -20,7 +20,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
class BeatmapGroup : AutoSizeContainer
|
class BeatmapGroup : Container
|
||||||
{
|
{
|
||||||
private const float collapsedAlpha = 0.5f;
|
private const float collapsedAlpha = 0.5f;
|
||||||
private const float collapsedWidth = 0.8f;
|
private const float collapsedWidth = 0.8f;
|
||||||
@ -64,13 +64,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
else
|
else
|
||||||
topContainer.Add(difficulties);
|
topContainer.Add(difficulties);
|
||||||
setBox.ClearTransformations();
|
setBox.ClearTransformations();
|
||||||
setBox.Transforms.Add(new TransformSize(Clock)
|
setBox.Width = collapsed ? collapsedWidth : 1; // TODO: Transform
|
||||||
{
|
|
||||||
StartValue = new Vector2(collapsed ? 1 : collapsedWidth, -1),
|
|
||||||
EndValue = new Vector2(collapsed ? collapsedWidth : 1, -1),
|
|
||||||
StartTime = Time,
|
|
||||||
EndTime = Time + 200,
|
|
||||||
});
|
|
||||||
setBox.BorderColour = new Color4(
|
setBox.BorderColour = new Color4(
|
||||||
setBox.BorderColour.R,
|
setBox.BorderColour.R,
|
||||||
setBox.BorderColour.G,
|
setBox.BorderColour.G,
|
||||||
@ -89,13 +83,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
var button = buttons[i] as BeatmapButton;
|
var button = buttons[i] as BeatmapButton;
|
||||||
float targetWidth = 1 - Math.Abs((selected - i) * 0.025f);
|
float targetWidth = 1 - Math.Abs((selected - i) * 0.025f);
|
||||||
targetWidth = MathHelper.Clamp(targetWidth, 0.8f, 1);
|
targetWidth = MathHelper.Clamp(targetWidth, 0.8f, 1);
|
||||||
button.Transforms.Add(new TransformSize(Clock)
|
button.Width = targetWidth; // TODO: Transform
|
||||||
{
|
|
||||||
StartValue = new Vector2(button.Size.X, -1),
|
|
||||||
EndValue = new Vector2(targetWidth, -1),
|
|
||||||
StartTime = Time,
|
|
||||||
EndTime = Time + 100,
|
|
||||||
});
|
|
||||||
button.Selected = selected == i;
|
button.Selected = selected == i;
|
||||||
}
|
}
|
||||||
BeatmapSelected?.Invoke(BeatmapSet, map);
|
BeatmapSelected?.Invoke(BeatmapSet, map);
|
||||||
@ -106,22 +94,24 @@ namespace osu.Game.GameModes.Play
|
|||||||
BeatmapSet = beatmapSet;
|
BeatmapSet = beatmapSet;
|
||||||
selectedBeatmap = beatmapSet.Beatmaps[0];
|
selectedBeatmap = beatmapSet.Beatmaps[0];
|
||||||
Alpha = collapsedAlpha;
|
Alpha = collapsedAlpha;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Size = new Vector2(1, -1);
|
Width = 1;
|
||||||
float difficultyWidth = 1;
|
float difficultyWidth = 1;
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
topContainer = new FlowContainer
|
topContainer = new FlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Size = new Vector2(1, -1),
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Width = 1,
|
||||||
Direction = FlowDirection.VerticalOnly,
|
Direction = FlowDirection.VerticalOnly,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
setBox = new BeatmapSetBox(beatmapSet)
|
setBox = new BeatmapSetBox(beatmapSet)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Size = new Vector2(collapsedWidth, -1),
|
Width = collapsedWidth,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
}
|
}
|
||||||
@ -131,7 +121,8 @@ namespace osu.Game.GameModes.Play
|
|||||||
difficulties = new FlowContainer // Deliberately not added to children
|
difficulties = new FlowContainer // Deliberately not added to children
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Size = new Vector2(1, -1),
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Width = 1,
|
||||||
Margin = new MarginPadding { Top = 5 },
|
Margin = new MarginPadding { Top = 5 },
|
||||||
Padding = new MarginPadding { Left = 75 },
|
Padding = new MarginPadding { Left = 75 },
|
||||||
Spacing = new Vector2(0, 5),
|
Spacing = new Vector2(0, 5),
|
||||||
@ -147,7 +138,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Size = new Vector2(width, -1),
|
Width = width,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
@ -161,7 +152,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BeatmapSetBox : AutoSizeContainer
|
class BeatmapSetBox : Container
|
||||||
{
|
{
|
||||||
private BeatmapSetInfo beatmapSet;
|
private BeatmapSetInfo beatmapSet;
|
||||||
private Sprite backgroundImage;
|
private Sprite backgroundImage;
|
||||||
@ -169,6 +160,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
public BeatmapSetBox(BeatmapSetInfo beatmapSet)
|
public BeatmapSetBox(BeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
this.beatmapSet = beatmapSet;
|
this.beatmapSet = beatmapSet;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
CornerRadius = 5;
|
CornerRadius = 5;
|
||||||
BorderThickness = 2;
|
BorderThickness = 2;
|
||||||
@ -191,7 +183,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
backgroundImage = new Sprite
|
backgroundImage = new Sprite
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Size = new Vector2(1, 0),
|
Width = 1,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
@ -208,6 +200,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
Direction = FlowDirection.VerticalOnly,
|
Direction = FlowDirection.VerticalOnly,
|
||||||
Spacing = new Vector2(0, 2),
|
Spacing = new Vector2(0, 2),
|
||||||
Padding = new MarginPadding { Top = 3, Left = 20, Right = 20, Bottom = 3 },
|
Padding = new MarginPadding { Top = 3, Left = 20, Right = 20, Bottom = 3 },
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
// TODO: Make these italic
|
// TODO: Make these italic
|
||||||
|
Loading…
Reference in New Issue
Block a user