mirror of
https://github.com/ppy/osu.git
synced 2025-01-07 21:32:57 +08:00
Move text size/padding out of constructor
This commit is contained in:
parent
0237153c27
commit
7b8094d731
@ -15,19 +15,33 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
private readonly OsuSpriteText statusText;
|
private readonly OsuSpriteText statusText;
|
||||||
|
|
||||||
private BeatmapSetOnlineStatus status;
|
private BeatmapSetOnlineStatus status;
|
||||||
|
|
||||||
public BeatmapSetOnlineStatus Status
|
public BeatmapSetOnlineStatus Status
|
||||||
{
|
{
|
||||||
get => status;
|
get => status;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == status) return;
|
if (status == value)
|
||||||
|
return;
|
||||||
status = value;
|
status = value;
|
||||||
|
|
||||||
statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant();
|
statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapSetOnlineStatusPill(float textSize, MarginPadding textPadding)
|
public float TextSize
|
||||||
|
{
|
||||||
|
get => statusText.TextSize;
|
||||||
|
set => statusText.TextSize = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MarginPadding TextPadding
|
||||||
|
{
|
||||||
|
get => statusText.Padding;
|
||||||
|
set => statusText.Padding = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeatmapSetOnlineStatusPill()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
@ -45,8 +59,6 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
TextSize = textSize,
|
|
||||||
Padding = textPadding,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -230,10 +230,12 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
Spacing = new Vector2(10),
|
Spacing = new Vector2(10),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
onlineStatusPill = new BeatmapSetOnlineStatusPill(14, new MarginPadding { Horizontal = 25, Vertical = 8 })
|
onlineStatusPill = new BeatmapSetOnlineStatusPill
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
|
TextSize = 14,
|
||||||
|
TextPadding = new MarginPadding { Horizontal = 25, Vertical = 8 }
|
||||||
},
|
},
|
||||||
Details = new Details(),
|
Details = new Details(),
|
||||||
},
|
},
|
||||||
|
@ -217,8 +217,10 @@ namespace osu.Game.Overlays.Direct
|
|||||||
statusContainer.Add(new IconPill(FontAwesome.fa_image));
|
statusContainer.Add(new IconPill(FontAwesome.fa_image));
|
||||||
}
|
}
|
||||||
|
|
||||||
statusContainer.Add(new BeatmapSetOnlineStatusPill(12, new MarginPadding { Horizontal = 10, Vertical = 5 })
|
statusContainer.Add(new BeatmapSetOnlineStatusPill
|
||||||
{
|
{
|
||||||
|
TextSize = 12,
|
||||||
|
TextPadding = new MarginPadding { Horizontal = 10, Vertical = 5 },
|
||||||
Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,
|
Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -217,8 +217,10 @@ namespace osu.Game.Screens.Select
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
StatusPill = new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 })
|
StatusPill = new BeatmapSetOnlineStatusPill
|
||||||
{
|
{
|
||||||
|
TextSize = 11,
|
||||||
|
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
|
||||||
Status = beatmapInfo.Status,
|
Status = beatmapInfo.Status,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,11 +85,13 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
Margin = new MarginPadding { Top = 5 },
|
Margin = new MarginPadding { Top = 5 },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 })
|
new BeatmapSetOnlineStatusPill
|
||||||
{
|
{
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Margin = new MarginPadding{ Right = 5 },
|
Margin = new MarginPadding{ Right = 5 },
|
||||||
|
TextSize = 11,
|
||||||
|
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
|
||||||
Status = beatmapSet.Status
|
Status = beatmapSet.Status
|
||||||
},
|
},
|
||||||
new FillFlowContainer<FilterableDifficultyIcon>
|
new FillFlowContainer<FilterableDifficultyIcon>
|
||||||
|
Loading…
Reference in New Issue
Block a user