Reduce nesting and usage of GridContainer

This commit is contained in:
Dean Herbert 2022-04-20 15:57:45 +09:00
parent 1032dc235d
commit 2ee37aeceb

View File

@ -32,54 +32,50 @@ namespace osu.Game.Overlays.Mods
private DifficultyMultiplierDisplay multiplierDisplay; private DifficultyMultiplierDisplay multiplierDisplay;
private ModSettingsArea modSettingsArea; private ModSettingsArea modSettingsArea;
private FillFlowContainer<ModColumn> columnFlow; private FillFlowContainer<ModColumn> columnFlow;
private GridContainer grid;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
AddRange(new Drawable[]
{
new ClickToReturnContainer
{
RelativeSizeAxes = Axes.Both,
HandleMouse = { BindTarget = customisationVisible },
OnClicked = () => customisationVisible.Value = false
},
modSettingsArea = new ModSettingsArea
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Height = 0
}
});
MainAreaContent.AddRange(new Drawable[] MainAreaContent.AddRange(new Drawable[]
{ {
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, Anchor = Anchor.TopRight,
Children = new Drawable[] Origin = Anchor.TopRight,
{
grid = new GridContainer
{
RelativeSizeAxes = Axes.Both,
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
},
Content = new[]
{
new Drawable[]
{
new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
RelativePositionAxes = Axes.X,
X = 0.3f,
Height = DifficultyMultiplierDisplay.HEIGHT, Height = DifficultyMultiplierDisplay.HEIGHT,
Margin = new MarginPadding Margin = new MarginPadding
{ {
Horizontal = 100, Horizontal = 100,
Vertical = 10
}, },
Child = multiplierDisplay = new DifficultyMultiplierDisplay Child = multiplierDisplay = new DifficultyMultiplierDisplay
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre Origin = Anchor.Centre
} }
}
}, },
new Drawable[]
{
new Container new Container
{ {
Margin = new MarginPadding
{
Vertical = DifficultyMultiplierDisplay.HEIGHT + 10,
},
Depth = float.MaxValue, Depth = float.MaxValue,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both, RelativePositionAxes = Axes.Both,
@ -111,11 +107,6 @@ namespace osu.Game.Overlays.Mods
} }
} }
} }
},
}
},
}
},
}); });
Footer.Add(new ShearedToggleButton(200) Footer.Add(new ShearedToggleButton(200)
@ -126,22 +117,6 @@ namespace osu.Game.Overlays.Mods
Text = "Mod Customisation", Text = "Mod Customisation",
Active = { BindTarget = customisationVisible } Active = { BindTarget = customisationVisible }
}); });
AddRange(new Drawable[]
{
new ClickToReturnContainer
{
RelativeSizeAxes = Axes.Both,
HandleMouse = { BindTarget = customisationVisible },
OnClicked = () => customisationVisible.Value = false
},
modSettingsArea = new ModSettingsArea
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Height = 0
}
});
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -206,7 +181,7 @@ namespace osu.Game.Overlays.Mods
{ {
const double transition_duration = 300; const double transition_duration = 300;
grid.FadeColour(customisationVisible.Value ? Colour4.Gray : Colour4.White, transition_duration, Easing.InOutCubic); MainAreaContent.FadeColour(customisationVisible.Value ? Colour4.Gray : Colour4.White, transition_duration, Easing.InOutCubic);
float modAreaHeight = customisationVisible.Value ? ModSettingsArea.HEIGHT : 0; float modAreaHeight = customisationVisible.Value ? ModSettingsArea.HEIGHT : 0;