From 57ca01ffe906ea90942926bb12d8db1afa1a2a27 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Wed, 27 Mar 2024 18:55:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=84=E8=AE=BA=E7=83=AD?= =?UTF-8?q?=E9=97=A8=E5=9B=9E=E5=A4=8D=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Controls/CommentControl.xaml | 3 ++- src/BiliLite.UWP/Extensions/StringExtensions.cs | 12 +++++++++--- src/BiliLite.UWP/Models/Common/Comment/HotReply.cs | 13 +++++-------- src/BiliLite.UWP/Themes/Dark.xaml | 1 + src/BiliLite.UWP/Themes/Light.xaml | 1 + 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/BiliLite.UWP/Controls/CommentControl.xaml b/src/BiliLite.UWP/Controls/CommentControl.xaml index 1d854b5a..197696ad 100644 --- a/src/BiliLite.UWP/Controls/CommentControl.xaml +++ b/src/BiliLite.UWP/Controls/CommentControl.xaml @@ -195,7 +195,7 @@ @@ -408,6 +408,7 @@ ItemsSource="{x:Bind HotReplyContents,Mode=OneWay}" ItemContainerStyle="{StaticResource hotReplyStyle}" Background="{ThemeResource CardColor}" + Margin="0 0 8 0" SelectionMode="None" IsItemClickEnabled="False" ScrollViewer.VerticalScrollMode="Disabled" diff --git a/src/BiliLite.UWP/Extensions/StringExtensions.cs b/src/BiliLite.UWP/Extensions/StringExtensions.cs index 5bff2a1a..420f7116 100644 --- a/src/BiliLite.UWP/Extensions/StringExtensions.cs +++ b/src/BiliLite.UWP/Extensions/StringExtensions.cs @@ -80,7 +80,7 @@ public static string TraditionalToSimplified(this string input) /// /// /// - public static RichTextBlock ToRichTextBlock(this string txt, JObject emote, bool isLive = false, string fontColor = null, string fontWeight = "Normal") + public static RichTextBlock ToRichTextBlock(this string txt, JObject emote, bool isLive = false, string fontColor = null, string fontWeight = "Normal",string lowProfilePrefix="") { var input = txt; try @@ -105,15 +105,21 @@ public static RichTextBlock ToRichTextBlock(this string txt, JObject emote, bool //处理av号/bv号 if (!isLive) { input = HandelVideoID(input); } + if (!string.IsNullOrEmpty(lowProfilePrefix)) + { + lowProfilePrefix = $""; + } + //生成xaml var xaml = string.Format(@" - {0} + {4}{0} ", input, isLive ? 22 : 20, fontColor == null ? "" : $"Foreground=\"{fontColor}\"", - $"FontWeight=\"{fontWeight}\""); + $"FontWeight=\"{fontWeight}\"", + lowProfilePrefix); var p = (RichTextBlock)XamlReader.Load(xaml); return p; } diff --git a/src/BiliLite.UWP/Models/Common/Comment/HotReply.cs b/src/BiliLite.UWP/Models/Common/Comment/HotReply.cs index 900503e9..db182dd6 100644 --- a/src/BiliLite.UWP/Models/Common/Comment/HotReply.cs +++ b/src/BiliLite.UWP/Models/Common/Comment/HotReply.cs @@ -1,7 +1,4 @@ -using System; -using System.Linq; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Documents; +using Windows.UI.Xaml.Controls; using BiliLite.Extensions; using Newtonsoft.Json.Linq; @@ -21,12 +18,12 @@ public RichTextBlock Content { if (Message.Length <= 50) { - return $"{UserName}: {Message}" - .ToRichTextBlock(Emote); + return $"{Message}" + .ToRichTextBlock(Emote, lowProfilePrefix: $"{UserName}: "); } - return $"{UserName}: {Message.SubstringCommentText(50)}..." - .ToRichTextBlock(Emote); + return $"{Message.SubstringCommentText(50)}..." + .ToRichTextBlock(Emote, lowProfilePrefix: $"{UserName}: "); } } } diff --git a/src/BiliLite.UWP/Themes/Dark.xaml b/src/BiliLite.UWP/Themes/Dark.xaml index 3438a4ed..3a8fa8c2 100644 --- a/src/BiliLite.UWP/Themes/Dark.xaml +++ b/src/BiliLite.UWP/Themes/Dark.xaml @@ -14,6 +14,7 @@ #CC000000 #ec407a #008ac5 + Gray #FF282828 diff --git a/src/BiliLite.UWP/Themes/Light.xaml b/src/BiliLite.UWP/Themes/Light.xaml index 6d373c7e..a7db159f 100644 --- a/src/BiliLite.UWP/Themes/Light.xaml +++ b/src/BiliLite.UWP/Themes/Light.xaml @@ -14,6 +14,7 @@ #CC000000 #ec407a #008ac5 + Gray #FFF9F9F9