1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 18:07:25 +08:00

Reduce indents of private container methods

This commit is contained in:
Joseph Madamba 2023-10-10 18:29:18 -07:00
parent e0c6c1bc66
commit 3ad5a7c661

View File

@ -146,184 +146,182 @@ namespace osu.Game.Online.Leaderboards
modsContainer.Padding = new MarginPadding { Top = modsContainer.Children.Count > 0 ? 4 : 0 }; modsContainer.Padding = new MarginPadding { Top = modsContainer.Children.Count > 0 ? 4 : 0 };
} }
private Container createCentreContent(APIUser user) => private Container createCentreContent(APIUser user) => new Container
new Container {
Masking = true,
CornerRadius = corner_radius,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{ {
Masking = true, new Box
CornerRadius = corner_radius,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{ {
new Box RelativeSizeAxes = Axes.Both,
{ Colour = shadowColour,
RelativeSizeAxes = Axes.Both,
Colour = shadowColour,
},
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Right = 5 },
Child = new Container
{
Masking = true,
CornerRadius = corner_radius,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
foreground = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = foregroundColour
},
new UserCoverBackground
{
RelativeSizeAxes = Axes.Both,
User = score.User,
Colour = ColourInfo.GradientHorizontal(Colour4.White.Opacity(0.5f), Colour4.White.Opacity(0)),
},
new GridContainer
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new[]
{
avatar = new MaskedWrapper(
innerAvatar = new ClickableAvatar(user)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(1.1f),
Shear = -shear,
RelativeSizeAxes = Axes.Both,
})
{
RelativeSizeAxes = Axes.None,
Size = new Vector2(height)
},
new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Padding = new MarginPadding { Horizontal = corner_radius },
Children = new Drawable[]
{
flagBadgeAndDateContainer = new FillFlowContainer
{
Shear = -shear,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5),
AutoSizeAxes = Axes.Both,
Masking = true,
Children = new Drawable[]
{
new UpdateableFlag(user.CountryCode)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Size = new Vector2(24, 16),
},
new DateLabel(score.Date)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
}
}
},
nameLabel = new TruncatingSpriteText
{
RelativeSizeAxes = Axes.X,
Shear = -shear,
Text = user.Username,
Font = OsuFont.GetFont(size: 24, weight: FontWeight.SemiBold)
}
}
},
new FillFlowContainer
{
Margin = new MarginPadding { Right = 40 },
Spacing = new Vector2(25),
Shear = -shear,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Children = statisticsLabels
}
}
}
}
}
},
},
}, },
}; new Container
private FillFlowContainer createRightContent() =>
new FillFlowContainer
{
Padding = new MarginPadding { Left = 11, Right = 15 },
Y = -5,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Direction = FillDirection.Vertical,
Spacing = new Vector2(13, 0f),
Children = new Drawable[]
{ {
new Container RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Right = 5 },
Child = new Container
{ {
AutoSizeAxes = Axes.Y, Masking = true,
RelativeSizeAxes = Axes.X, CornerRadius = corner_radius,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
scoreText = new OsuSpriteText foreground = new Box
{ {
Shear = -shear, RelativeSizeAxes = Axes.Both,
Current = scoreManager.GetBindableTotalScoreString(score), Colour = foregroundColour
//Does not match figma, adjusted to allow 8 digits to fit comfortably
Font = OsuFont.GetFont(size: 28, weight: FontWeight.SemiBold, fixedWidth: false),
}, },
RankContainer = new Container new UserCoverBackground
{ {
BypassAutoSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Y = 2, User = score.User,
Shear = -shear, Colour = ColourInfo.GradientHorizontal(Colour4.White.Opacity(0.5f), Colour4.White.Opacity(0)),
Anchor = Anchor.CentreRight, },
Origin = Anchor.CentreRight, new GridContainer
AutoSizeAxes = Axes.Both, {
Children = new[] RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{ {
scoreRank = new UpdateableRank(score.Rank) new Dimension(GridSizeMode.AutoSize),
new Dimension(),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new[]
{ {
Anchor = Anchor.Centre, avatar = new MaskedWrapper(
Origin = Anchor.Centre, innerAvatar = new ClickableAvatar(user)
Size = new Vector2(32) {
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(1.1f),
Shear = -shear,
RelativeSizeAxes = Axes.Both,
})
{
RelativeSizeAxes = Axes.None,
Size = new Vector2(height)
},
new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Padding = new MarginPadding { Horizontal = corner_radius },
Children = new Drawable[]
{
flagBadgeAndDateContainer = new FillFlowContainer
{
Shear = -shear,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5),
AutoSizeAxes = Axes.Both,
Masking = true,
Children = new Drawable[]
{
new UpdateableFlag(user.CountryCode)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Size = new Vector2(24, 16),
},
new DateLabel(score.Date)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
}
}
},
nameLabel = new TruncatingSpriteText
{
RelativeSizeAxes = Axes.X,
Shear = -shear,
Text = user.Username,
Font = OsuFont.GetFont(size: 24, weight: FontWeight.SemiBold)
}
}
},
new FillFlowContainer
{
Margin = new MarginPadding { Right = 40 },
Spacing = new Vector2(25),
Shear = -shear,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Children = statisticsLabels
}
} }
} }
} }
} }
}, },
modsContainer = new FillFlowContainer<ColouredModSwitchTiny> },
},
};
private FillFlowContainer createRightContent() => new FillFlowContainer
{
Padding = new MarginPadding { Left = 11, Right = 15 },
Y = -5,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Direction = FillDirection.Vertical,
Spacing = new Vector2(13, 0f),
Children = new Drawable[]
{
new Container
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Children = new Drawable[]
{ {
Shear = -shear, scoreText = new OsuSpriteText
AutoSizeAxes = Axes.Both, {
Direction = FillDirection.Horizontal, Shear = -shear,
ChildrenEnumerable = score.Mods.Select(mod => new ColouredModSwitchTiny(mod) { Scale = new Vector2(0.375f) }) Current = scoreManager.GetBindableTotalScoreString(score),
//Does not match figma, adjusted to allow 8 digits to fit comfortably
Font = OsuFont.GetFont(size: 28, weight: FontWeight.SemiBold, fixedWidth: false),
},
RankContainer = new Container
{
BypassAutoSizeAxes = Axes.Both,
Y = 2,
Shear = -shear,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.Both,
Children = new[]
{
scoreRank = new UpdateableRank(score.Rank)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(32)
}
}
}
} }
},
modsContainer = new FillFlowContainer<ColouredModSwitchTiny>
{
Shear = -shear,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
ChildrenEnumerable = score.Mods.Select(mod => new ColouredModSwitchTiny(mod) { Scale = new Vector2(0.375f) })
} }
}; }
};
protected (CaseTransformableString, LocalisableString DisplayAccuracy)[] GetStatistics(ScoreInfo model) => new[] protected (CaseTransformableString, LocalisableString DisplayAccuracy)[] GetStatistics(ScoreInfo model) => new[]
{ {