Skip to content

Commit

Permalink
Merge pull request #427 from ywmoyue/dev
Browse files Browse the repository at this point in the history
4.6.23
  • Loading branch information
ywmoyue authored Dec 10, 2023
2 parents e8ecf11 + 98995d8 commit 38a56bc
Show file tree
Hide file tree
Showing 38 changed files with 1,574 additions and 404 deletions.
Binary file added src/BiliLite.UWP/Assets/Live/RedPocket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 19 additions & 6 deletions src/BiliLite.UWP/BiliLite.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;X86</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
Expand All @@ -58,7 +58,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;ARM</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
Expand All @@ -83,7 +83,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;ARM64</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM64</PlatformTarget>
Expand All @@ -109,7 +109,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;X64</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
Expand All @@ -136,8 +136,14 @@
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<Compile Include="Extensions\QrCodeExtensions.cs" />
<Compile Include="Models\Common\Anime\ISeasonItem.cs" />
<Compile Include="Models\Common\Live\InteractWordModel.cs" />
<Compile Include="Models\Common\Live\LiveMessageHandleActionsMap.cs" />
<Compile Include="Models\Common\Live\LiveRoomEndRedPocketLotteryInfoModel.cs" />
<Compile Include="Models\Common\Live\LiveRoomRedPocketLotteryInfoModel.cs" />
<Compile Include="Models\Common\Live\RoomBlockMsgModel.cs" />
<Compile Include="Models\Common\Live\WarningOrCutOffMsgModel.cs" />
<Compile Include="Models\Common\Player\DefaultPlayerModeOptions.cs" />
<Compile Include="Models\Common\Player\LivePlayerMode.cs" />
<Compile Include="Models\Common\Player\PlayerConfig.cs" />
Expand Down Expand Up @@ -176,6 +182,7 @@
<Compile Include="Models\Common\Live\GiftMsgModel.cs" />
<Compile Include="Models\Common\Live\GuardBuyMsgModel.cs" />
<Compile Include="Models\Common\Live\RoomChangeMsgModel.cs" />
<Compile Include="Models\Common\WbiKey.cs" />
<Compile Include="Models\Exceptions\PlayerException.cs" />
<Compile Include="Models\Requests\Api\BaseApi.cs" />
<Compile Include="Player\Controllers\BasePlayerController.cs" />
Expand Down Expand Up @@ -217,14 +224,17 @@
<Compile Include="Player\States\PlayStates\PlayingPlayState.cs" />
<Compile Include="Player\States\PlayStates\PlayStateHandler.cs" />
<Compile Include="Player\States\PlayStates\StopPlayState.cs" />
<Compile Include="Services\Interfaces\IQrCodeService.cs" />
<Compile Include="Services\QrCoderQrCodeService.cs" />
<Compile Include="Services\WbiKeyService.cs" />
<Compile Include="Services\ZXingQrCodeService.cs" />
<Compile Include="ViewModels\Live\LiveDetailPageViewModel.cs" />
<Compile Include="ViewModels\Live\LiveRoomLotteryViewModel.cs" />
<Compile Include="ViewModels\Live\SuperChatMsgViewModel.cs" />
<Compile Include="Models\Common\Live\WelcomeMsgModel.cs" />
<Compile Include="Models\Common\User\HistoryCursor.cs" />
<Compile Include="Models\Common\User\UserHistory.cs" />
<Compile Include="Models\Common\User\UserHistoryItem.cs" />
<Compile Include="Models\Common\User\UserHistoryItemHistory.cs" />
<Compile Include="ViewModels\Live\LiveRoomAnchorLotteryViewModel.cs" />
<Compile Include="Models\Common\Live\LiveRoomGiftItem.cs" />
<Compile Include="Models\Common\Live\LiveRoomGuardInfoModel.cs" />
<Compile Include="Models\Common\Live\LiveRoomInfoModel.cs" />
Expand Down Expand Up @@ -1222,6 +1232,9 @@
<PackageReference Include="PropertyChanged.Fody">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="QRCoder">
<Version>1.4.3</Version>
</PackageReference>
<PackageReference Include="RestSharp">
<Version>107.3.0</Version>
</PackageReference>
Expand Down
19 changes: 19 additions & 0 deletions src/BiliLite.UWP/Extensions/QrCodeExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using BiliLite.Services;
using BiliLite.Services.Interfaces;
using Microsoft.Extensions.DependencyInjection;

namespace BiliLite.Extensions
{
public static class QrCodeExtensions
{
public static IServiceCollection AddQrCodeService(this IServiceCollection services)
{
#if ARM64
services.AddTransient<IQrCodeService, QrCoderQrCodeService>();
#else
services.AddTransient<IQrCodeService, ZXingQrCodeService>();
#endif
return services;
}
}
}
16 changes: 11 additions & 5 deletions src/BiliLite.UWP/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static string TraditionalToSimplified(this string input)
/// <param name="txt"></param>
/// <param name="emote"></param>
/// <returns></returns>
public static RichTextBlock ToRichTextBlock(this string txt, JObject emote, bool isLive = false)
public static RichTextBlock ToRichTextBlock(this string txt, JObject emote, bool isLive = false, string color = null, string fontWeight = "Normal")
{
var input = txt;
try
Expand All @@ -105,11 +105,14 @@ public static RichTextBlock ToRichTextBlock(this string txt, JObject emote, bool
if (!isLive) { input = HandelVideoID(input); }

//生成xaml
var xaml = string.Format(@"<RichTextBlock HorizontalAlignment=""Stretch"" TextWrapping=""Wrap"" xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
var xaml = string.Format(@"<RichTextBlock HorizontalAlignment=""Stretch"" xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" xmlns:d=""http://schemas.microsoft.com/expression/blend/2008""
xmlns:mc = ""http://schemas.openxmlformats.org/markup-compatibility/2006"" LineHeight=""{1}"">
xmlns:mc = ""http://schemas.openxmlformats.org/markup-compatibility/2006"" LineHeight=""{1}"" {2} {3}>
<Paragraph>{0}</Paragraph>
</RichTextBlock>", input, isLive ? 22 : 20);
</RichTextBlock>", input,
isLive ? 22 : 20,
color == null ? "" : $"Foreground=\"{color}\"",
$"FontWeight=\"{fontWeight}\"");
var p = (RichTextBlock)XamlReader.Load(xaml);
return p;
}
Expand Down Expand Up @@ -340,6 +343,9 @@ private static string HandelEmoji(string input, JObject emote)
return input;
}

/// <summary>
/// 处理直播黄豆表情
/// </summary>
private static string HandleLiveEmoji(string input, JObject emotes)
{
if (emotes == null) return input;
Expand All @@ -349,7 +355,7 @@ private static string HandleLiveEmoji(string input, JObject emotes)

if (!emotes.TryGetValue(emojiCode, out var emote)) continue;
var replacement = string.Format(
@"<InlineUIContainer><Border Margin=""2 -4 2 -4""><Image Source=""{0}"" Width=""{1}"" Height=""{1}"" /></Border></InlineUIContainer>",
@"<InlineUIContainer><Border Margin=""2 0 2 -4""><Image Source=""{0}"" Width=""{1}"" Height=""{1}"" /></Border></InlineUIContainer>",
emote["url"], emote["width"], emote["height"]);

input = input.Replace(emojiCode, replacement);
Expand Down
49 changes: 37 additions & 12 deletions src/BiliLite.UWP/Models/Common/Enumerates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,10 @@ public enum MessageType
/// </summary>
ConnectSuccess,

/// <summary>
/// 在线人数
/// </summary>
Online,
///// <summary>
///// 在线人数(即人气值, 已弃用)
///// </summary>
//Online,

/// <summary>
/// 弹幕
Expand All @@ -324,12 +324,12 @@ public enum MessageType
/// <summary>
/// 欢迎信息
/// </summary>
Welcome,
InteractWord,

/// <summary>
/// 系统消息
/// 系统消息 (未做实现), 先注释
/// </summary>
SystemMsg,
//SystemMsg,

/// <summary>
/// 醒目留言
Expand All @@ -346,12 +346,7 @@ public enum MessageType
/// </summary>
AnchorLotteryStart,

/// <summary>
/// 抽奖结束
/// </summary>
AnchorLotteryEnd,

/// <summary>
/// 抽奖结果
/// </summary>
AnchorLotteryAward,
Expand All @@ -370,5 +365,35 @@ public enum MessageType
/// 房间信息更新
/// </summary>
RoomChange,

/// <summary>
/// 指定观众禁言
/// </summary>
RoomBlock,

/// <summary>
/// 超管警告或切断
/// </summary>
WaringOrCutOff,

/// <summary>
/// 开始直播
/// </summary>
StartLive,

/// <summary>
/// 看过直播的人数变化(代替人气值)
/// </summary>
WatchedChange,

/// <summary>
/// 红包抽奖开始
/// </summary>
RedPocketLotteryStart,

/// <summary>
/// 红包抽奖赢家
/// </summary>
RedPocketLotteryWinner,
}
}
20 changes: 17 additions & 3 deletions src/BiliLite.UWP/Models/Common/Live/DanmuMsgModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ public class DanmuMsgModel
public string UserName { get; set; }

/// <summary>
/// 用户名颜色,默认灰色
/// 用户名颜色, 默认灰色
/// </summary>
public string UserNameColor { get; set; } = "#FF808080";

/// <summary>
/// 用户名字重, 默认Normal
/// </summary>
public string UserNameFontWeight { get; set; } = "Normal";

///// <summary>
///// 等级
///// </summary>
Expand Down Expand Up @@ -81,12 +86,21 @@ public class DanmuMsgModel
/// <summary>
/// 用户上的舰的图片
/// </summary>
public string UserCaptainImage { get; set; }
public string UserCaptainImage
{
get => UserCaptain switch
{
"舰长" => "/Assets/Live/ic_live_guard_3.png",
"提督" => "/Assets/Live/ic_live_guard_2.png",
"总督" => "/Assets/Live/ic_live_guard_1.png",
_ => null,
};
}

/// <summary>
/// 黄豆表情
/// </summary>
public JContainer Emoji { get; set; }
public JObject Emoji { get; set; }

/// <summary>
/// 各类大表情
Expand Down
21 changes: 21 additions & 0 deletions src/BiliLite.UWP/Models/Common/Live/InteractWordModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Windows.UI.Xaml;

namespace BiliLite.Models.Common.Live
{
public class InteractWordModel
{
public string UserName { get; set; }

public string UserID { get; set; }

public int MsgType { get; set; }

public string MedalName { get; set; }

public string MedalLevel { get; set; }

public string MedalColor { get; set; }

public Visibility ShowMedal { get; set; } = Visibility.Collapsed;
}
}
Loading

0 comments on commit 38a56bc

Please sign in to comment.