mirror of https://github.com/ppy/osu
Fix `PlaylistItem` attempting to read from `OsuColour` dependency too early
This commit is contained in:
parent
e4e8390a8a
commit
494d582830
|
@ -25,8 +25,8 @@ public class PlaylistItem : OsuRearrangeableListItem<BeatmapSetInfo>, IFilterabl
|
|||
private TextFlowContainer text;
|
||||
private ITextPart titlePart;
|
||||
|
||||
private Color4 selectedColour;
|
||||
private Color4 artistColour;
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
public PlaylistItem(BeatmapSetInfo item)
|
||||
: base(item)
|
||||
|
@ -37,10 +37,8 @@ public PlaylistItem(BeatmapSetInfo item)
|
|||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, LocalisationManager localisation)
|
||||
private void load()
|
||||
{
|
||||
selectedColour = colours.Yellow;
|
||||
artistColour = colours.Gray9;
|
||||
HandleColour = colours.Gray5;
|
||||
}
|
||||
|
||||
|
@ -60,17 +58,19 @@ protected override void LoadComplete()
|
|||
private void updateSelectionState(bool instant)
|
||||
{
|
||||
foreach (Drawable s in titlePart.Drawables)
|
||||
s.FadeColour(SelectedSet.Value?.Equals(Model) == true ? selectedColour : Color4.White, instant ? 0 : FADE_DURATION);
|
||||
s.FadeColour(SelectedSet.Value?.Equals(Model) == true ? colours.Yellow : Color4.White, instant ? 0 : FADE_DURATION);
|
||||
}
|
||||
|
||||
protected override Drawable CreateContent()
|
||||
{
|
||||
text = new OsuTextFlowContainer
|
||||
protected override Drawable CreateContent() => text = new OsuTextFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
};
|
||||
|
||||
protected override void LoadAsyncComplete()
|
||||
{
|
||||
base.LoadAsyncComplete();
|
||||
|
||||
var title = new RomanisableString(Model.Metadata.TitleUnicode, Model.Metadata.Title);
|
||||
var artist = new RomanisableString(Model.Metadata.ArtistUnicode, Model.Metadata.Artist);
|
||||
|
||||
|
@ -83,11 +83,9 @@ protected override Drawable CreateContent()
|
|||
text.AddText(artist, sprite =>
|
||||
{
|
||||
sprite.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold);
|
||||
sprite.Colour = artistColour;
|
||||
sprite.Colour = colours.Gray9;
|
||||
sprite.Padding = new MarginPadding { Top = 1 };
|
||||
});
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
|
|
Loading…
Reference in New Issue