From e3cc4561abcc0b8a7ec9b0c53e36c3339cb8c6a9 Mon Sep 17 00:00:00 2001 From: Gagah Pangeran Rosfatiputra Date: Fri, 30 Apr 2021 10:35:40 +0700 Subject: [PATCH] add bullet marker in OsuMarkdownListItem --- .../Containers/Markdown/OsuMarkdownListItem.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs index 501da7721e..6b35321617 100644 --- a/osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs +++ b/osu.Game/Graphics/Containers/Markdown/OsuMarkdownListItem.cs @@ -1,8 +1,10 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Containers.Markdown; using osuTK; namespace osu.Game.Graphics.Containers.Markdown @@ -11,6 +13,9 @@ namespace osu.Game.Graphics.Containers.Markdown { private const float default_left_padding = 20; + [Resolved] + private IMarkdownTextComponent parentTextComponent { get; set; } + public FillFlowContainer Content { get; } public OsuMarkdownListItem() @@ -30,5 +35,18 @@ namespace osu.Game.Graphics.Containers.Markdown } }; } + + [BackgroundDependencyLoader] + private void load() + { + var marker = parentTextComponent.CreateSpriteText(); + marker.Text = "●"; + marker.Font = OsuFont.GetFont(size: marker.Font.Size / 2); + marker.Origin = Anchor.Centre; + marker.X = -default_left_padding / 2; + marker.Y = marker.Font.Size; + + AddInternal(marker); + } } }