From 9c1917a72f94cd049cbcf4c12c5d74410e361eb6 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 4 Sep 2022 22:26:09 +0800 Subject: [PATCH] Will start fill the text after BDL loaded, so there's no need to add schedule in the child class. --- .../UserInterfaceV2/LyricSelector.cs | 17 ++++++-------- .../LabelledReferenceLyricSelector.cs | 21 ++++++++--------- .../RearrangeableTextFlowListContainer.cs | 9 +++++++- .../Graphics/UserInterfaceV2/FontSelector.cs | 23 ++++++++----------- 4 files changed, 34 insertions(+), 36 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Edit/Components/UserInterfaceV2/LyricSelector.cs b/osu.Game.Rulesets.Karaoke/Edit/Components/UserInterfaceV2/LyricSelector.cs index 6ddd46ff8..81f11bf1c 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Components/UserInterfaceV2/LyricSelector.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Components/UserInterfaceV2/LyricSelector.cs @@ -129,16 +129,13 @@ protected override void CreateDisplayContent(OsuTextFlowContainer textFlowContai } else { - Schedule(() => - { - // display the lyric order. - textFlowContainer.AddText($"#{model.Order}", x => x.Colour = colours.Yellow); - textFlowContainer.AddText(" "); - - // main text - textFlowContainer.AddText(model.Text); - textFlowContainer.AddText(" "); - }); + // display the lyric order. + textFlowContainer.AddText($"#{model.Order}", x => x.Colour = colours.Yellow); + textFlowContainer.AddText(" "); + + // main text + textFlowContainer.AddText(model.Text); + textFlowContainer.AddText(" "); } } } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Reference/LabelledReferenceLyricSelector.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Reference/LabelledReferenceLyricSelector.cs index 3d14ce860..7e0651abf 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Reference/LabelledReferenceLyricSelector.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Reference/LabelledReferenceLyricSelector.cs @@ -147,24 +147,21 @@ protected override bool OnClick(ClickEvent e) protected override void CreateDisplayContent(OsuTextFlowContainer textFlowContainer, Lyric? model) { + // should have disable style if lyric is not selectable. + textFlowContainer.Alpha = selectable(model) ? 1 : 0.5f; + base.CreateDisplayContent(textFlowContainer, model); if (model == null) return; - Schedule(() => - { - // should have disable style if lyric is not selectable. - textFlowContainer.Alpha = selectable(model) ? 1 : 0.5f; - - // add reference text at the end of the text. - int referenceLyricsAmount = EditorBeatmapUtils.GetAllReferenceLyrics(editorBeatmap, model).Count(); + // add reference text at the end of the text. + int referenceLyricsAmount = EditorBeatmapUtils.GetAllReferenceLyrics(editorBeatmap, model).Count(); - if (referenceLyricsAmount > 0) - { - textFlowContainer.AddText($"({referenceLyricsAmount} reference)", x => x.Colour = colours.Red); - } - }); + if (referenceLyricsAmount > 0) + { + textFlowContainer.AddText($"({referenceLyricsAmount} reference)", x => x.Colour = colours.Red); + } } private bool selectable(Lyric? lyric) diff --git a/osu.Game.Rulesets.Karaoke/Graphics/UserInterface/RearrangeableTextFlowListContainer.cs b/osu.Game.Rulesets.Karaoke/Graphics/UserInterface/RearrangeableTextFlowListContainer.cs index 2a2033907..0a3548725 100644 --- a/osu.Game.Rulesets.Karaoke/Graphics/UserInterface/RearrangeableTextFlowListContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Graphics/UserInterface/RearrangeableTextFlowListContainer.cs @@ -95,7 +95,14 @@ protected override void LoadComplete() { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - }.With(x => CreateDisplayContent(x, Model)); + }.With(x => + { + Schedule(() => + { + // should create the text after BDL loaded. + CreateDisplayContent(x, Model); + }); + }); protected override bool OnClick(ClickEvent e) { diff --git a/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/FontSelector.cs b/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/FontSelector.cs index fe1a3b9d5..316fdea7b 100644 --- a/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/FontSelector.cs +++ b/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/FontSelector.cs @@ -271,21 +271,18 @@ public DrawableFontFamilyListItem(string item) protected override void CreateDisplayContent(OsuTextFlowContainer textFlowContainer, string model) { textFlowContainer.TextAnchor = Anchor.BottomLeft; - Schedule(() => - { - textFlowContainer.AddText(model); + textFlowContainer.AddText(model); - var matchedFormat = fontManager.Fonts - .Where(x => x.Family == Model).Select(x => x.FontFormat) - .Distinct() - .ToArray(); + var matchedFormat = fontManager.Fonts + .Where(x => x.Family == Model).Select(x => x.FontFormat) + .Distinct() + .ToArray(); - foreach (var format in matchedFormat) - { - textFlowContainer.AddText(" "); - textFlowContainer.AddArbitraryDrawable(new FontFormatBadge(format)); - } - }); + foreach (var format in matchedFormat) + { + textFlowContainer.AddText(" "); + textFlowContainer.AddArbitraryDrawable(new FontFormatBadge(format)); + } } } }