Skip to content

Commit

Permalink
自己和主播的chat特殊处理
Browse files Browse the repository at this point in the history
  • Loading branch information
GD-Slime committed May 27, 2024
1 parent 3a0ba22 commit 328bd45
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/BiliLite.UWP/Models/Common/Live/LiveMessageHandleActionsMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,21 @@ private void WatchedChange(LiveRoomViewModel viewModel, object message)
private void Danmu(LiveRoomViewModel viewModel, object message)
{
var m = message as DanmuMsgModel;
if (viewModel.Messages.Count >= viewModel.CleanCount)

// 自己的消息和主播的消息特殊处理
if (m.Uid == SettingService.Account.UserID.ToString() || m.Uid == viewModel.AnchorUid.ToString())
{
viewModel.Messages.RemoveAt(0);
// 暂时借用了直播间标题修改的颜色... 找不到好看的颜色了
m.CardColor = new SolidColorBrush(Color.FromArgb(255, 228, 255, 233));
m.RichText = m.Text.ToRichTextBlock(m.Emoji, true, fontWeight: "Medium", fontColor: "#ff1e653a");
if (m.Uid == viewModel.AnchorUid.ToString())
{
m.Role = "主播";
m.ShowAdmin = Visibility.Visible;
}
}

if (viewModel.Messages.Count >= viewModel.CleanCount) viewModel.Messages.RemoveAt(0);
viewModel.Messages.Add(m);
AddNewDanmu?.Invoke(null, m);
}
Expand Down

0 comments on commit 328bd45

Please sign in to comment.