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 ModSettingsArea modSettingsArea;
private FillFlowContainer<ModColumn> columnFlow;
private GridContainer grid;
[BackgroundDependencyLoader]
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[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
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,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.X,
RelativePositionAxes = Axes.X,
X = 0.3f,
Height = DifficultyMultiplierDisplay.HEIGHT,
Margin = new MarginPadding
{
Horizontal = 100,
Vertical = 10
},
Child = multiplierDisplay = new DifficultyMultiplierDisplay
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
}
}
},
new Drawable[]
{
new Container
{
Margin = new MarginPadding
{
Vertical = DifficultyMultiplierDisplay.HEIGHT + 10,
},
Depth = float.MaxValue,
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both,
@ -111,11 +107,6 @@ namespace osu.Game.Overlays.Mods
}
}
}
},
}
},
}
},
});
Footer.Add(new ShearedToggleButton(200)
@ -126,22 +117,6 @@ namespace osu.Game.Overlays.Mods
Text = "Mod Customisation",
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()
@ -206,7 +181,7 @@ namespace osu.Game.Overlays.Mods
{
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;