mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Allow different sizing modes for OverlinedDisplay
This commit is contained in:
@ -15,6 +15,26 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
{
|
{
|
||||||
protected readonly Container Content;
|
protected readonly Container Content;
|
||||||
|
|
||||||
|
public override Axes RelativeSizeAxes
|
||||||
|
{
|
||||||
|
get => base.RelativeSizeAxes;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
base.RelativeSizeAxes = value;
|
||||||
|
updateDimensions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Axes AutoSizeAxes
|
||||||
|
{
|
||||||
|
get => base.AutoSizeAxes;
|
||||||
|
protected set
|
||||||
|
{
|
||||||
|
base.AutoSizeAxes = value;
|
||||||
|
updateDimensions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected string Details
|
protected string Details
|
||||||
{
|
{
|
||||||
set => details.Text = value;
|
set => details.Text = value;
|
||||||
@ -22,14 +42,12 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
|
|
||||||
private readonly Circle line;
|
private readonly Circle line;
|
||||||
private readonly OsuSpriteText details;
|
private readonly OsuSpriteText details;
|
||||||
|
private readonly GridContainer grid;
|
||||||
|
|
||||||
protected OverlinedDisplay(string title)
|
protected OverlinedDisplay(string title)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
InternalChild = grid = new GridContainer
|
||||||
|
|
||||||
InternalChild = new GridContainer
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
@ -62,19 +80,12 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
},
|
},
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
{
|
||||||
Content = new Container
|
Content = new Container { Margin = new MarginPadding { Top = 5 } }
|
||||||
{
|
|
||||||
Margin = new MarginPadding { Top = 5 },
|
|
||||||
RelativeSizeAxes = Axes.Both
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
RowDimensions = new[]
|
|
||||||
{
|
|
||||||
new Dimension(GridSizeMode.AutoSize),
|
|
||||||
new Dimension(GridSizeMode.AutoSize),
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
updateDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -83,5 +94,25 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
line.Colour = colours.Yellow;
|
line.Colour = colours.Yellow;
|
||||||
details.Colour = colours.Yellow;
|
details.Colour = colours.Yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateDimensions()
|
||||||
|
{
|
||||||
|
grid.RowDimensions = new[]
|
||||||
|
{
|
||||||
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
|
new Dimension(AutoSizeAxes.HasFlag(Axes.Y) ? GridSizeMode.AutoSize : GridSizeMode.Distributed),
|
||||||
|
};
|
||||||
|
|
||||||
|
grid.AutoSizeAxes = Axes.None;
|
||||||
|
grid.RelativeSizeAxes = Axes.None;
|
||||||
|
grid.AutoSizeAxes = AutoSizeAxes;
|
||||||
|
grid.RelativeSizeAxes = ~AutoSizeAxes;
|
||||||
|
|
||||||
|
Content.AutoSizeAxes = Axes.None;
|
||||||
|
Content.RelativeSizeAxes = Axes.None;
|
||||||
|
Content.AutoSizeAxes = grid.AutoSizeAxes;
|
||||||
|
Content.RelativeSizeAxes = grid.RelativeSizeAxes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Right = 5 },
|
Padding = new MarginPadding { Right = 5 },
|
||||||
Child = new OverlinedParticipants()
|
Child = new OverlinedParticipants { RelativeSizeAxes = Axes.Both }
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
@ -122,6 +122,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
Padding = new MarginPadding { Horizontal = 5 },
|
Padding = new MarginPadding { Horizontal = 5 },
|
||||||
Child = new OverlinedPlaylist(true) // Temporarily always allow selection
|
Child = new OverlinedPlaylist(true) // Temporarily always allow selection
|
||||||
{
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
SelectedItem = { BindTarget = SelectedItem }
|
SelectedItem = { BindTarget = SelectedItem }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user