Skip to content

Commit

Permalink
添加弹幕引擎接入
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmoyue committed Aug 24, 2023
1 parent be4ed0b commit ecf01bd
Show file tree
Hide file tree
Showing 21 changed files with 1,085 additions and 153 deletions.
4 changes: 3 additions & 1 deletion BiliLite.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BiliLite.gRPC", "src\BiliLi
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{30AD97ED-AD18-4F64-8D4C-D326B3AB100D}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
document\entrance.json = document\entrance.json
document\new_version.json = document\new_version.json
nuget.config = nuget.config
README.md = README.md
.github\workflows\release.yml = .github\workflows\release.yml
.github\release-drafter.yml = .github\release-drafter.yml
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
EndProject
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "BiliLite.Packages", "src\BiliLite.Packages\BiliLite.Packages.wapproj", "{64B1CE94-6533-489A-94D4-A7152E3BE03F}"
Expand Down
6 changes: 6 additions & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
29 changes: 25 additions & 4 deletions src/BiliLite.UWP/BiliLite.UWP.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project ToolsVersion="15.0" DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
Expand Down Expand Up @@ -137,6 +139,9 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="Converters\BoolToVisibilityConverter.cs" />
<Compile Include="Extensions\ColorExtensions.cs" />
<Compile Include="Extensions\DanmakuExtensions.cs" />
<Compile Include="Models\Common\ComboBoxItemData.cs" />
<Compile Include="Models\Common\Comment\CommentItem.cs" />
<Compile Include="Models\Common\Comment\CommentMemberFansDetailModel.cs" />
<Compile Include="Models\Common\Comment\CommentMemberUserSailingCardbgFanModel.cs" />
Expand All @@ -151,6 +156,7 @@
<Compile Include="Models\Common\Comment\CommentReplyControlModel.cs" />
<Compile Include="Models\Common\Comment\DataCommentModel.cs" />
<Compile Include="Models\Common\Comment\LoadCommentInfo.cs" />
<Compile Include="Models\Common\Danmaku\CompareDanmakuItem.cs" />
<Compile Include="Models\Common\Player\ChangePlayerEngine.cs" />
<Compile Include="Models\Common\Player\PlayerOpenResult.cs" />
<Compile Include="Extensions\MapperExtensions.cs" />
Expand Down Expand Up @@ -213,13 +219,17 @@
<Compile Include="Models\Common\Anime\AnimeFallItemModel.cs" />
<Compile Include="Models\Common\Anime\AnimeRankModel.cs" />
<Compile Include="Models\Common\Anime\AnimeFallModel.cs" />
<Compile Include="Services\FrostMasterDanmakuController.cs" />
<Compile Include="Services\Interfaces\IDanmakuController.cs" />
<Compile Include="Services\NsDanmakuController.cs" />
<Compile Include="ViewModels\Home\AnimeFallViewModel.cs" />
<Compile Include="Models\Common\Anime\AnimeHomeModel.cs" />
<Compile Include="Services\CookieService.cs" />
<Compile Include="Services\GrpcService.cs" />
<Compile Include="ViewModels\Season\SeasonDetailUserStatusViewModel.cs" />
<Compile Include="ViewModels\Comment\CommentContentViewModel.cs" />
<Compile Include="ViewModels\Season\SeasonDetailViewModel.cs" />
<Compile Include="ViewModels\Video\DanmakuViewModel.cs" />
<Compile Include="ViewModels\Video\VideoDetailReqUserViewModel.cs" />
<Compile Include="ViewModels\Video\VideoDetailRelatesViewModel.cs" />
<Compile Include="ViewModels\Video\VideoDetailStatViewModel.cs" />
Expand Down Expand Up @@ -1020,6 +1030,9 @@
<PackageReference Include="AutoMapper">
<Version>10.1.1</Version>
</PackageReference>
<PackageReference Include="DanmakuFrostMaster.muyan">
<Version>1.0.1</Version>
</PackageReference>
<PackageReference Include="FFmpegInteropX">
<Version>1.0.0</Version>
</PackageReference>
Expand All @@ -1038,6 +1051,9 @@
<PackageReference Include="HtmlAgilityPack">
<Version>1.11.46</Version>
</PackageReference>
<PackageReference Include="LinqConditionalExtensions">
<Version>1.3.0</Version>
</PackageReference>
<PackageReference Include="log4net">
<Version>2.0.15</Version>
</PackageReference>
Expand Down Expand Up @@ -1074,6 +1090,9 @@
<PackageReference Include="Microsoft.UI.Xaml">
<Version>2.8.3</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
</PackageReference>
<PackageReference Include="NLog">
<Version>5.2.2</Version>
</PackageReference>
Expand Down Expand Up @@ -1128,10 +1147,12 @@
<Name>Windows Desktop Extensions for the UWP</Name>
</SDKReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<PropertyGroup
Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Import
Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
36 changes: 20 additions & 16 deletions src/BiliLite.UWP/Controls/PlayerControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
xmlns:danmaku="using:NSDanmaku.Controls"
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d"
xmlns:canvas="using:Microsoft.Graphics.Canvas.UI.Xaml"
xmlns:fa="using:FontAwesome5" xmlns:player="using:BiliLite.Modules.Player"
d:DesignHeight="800"
d:DesignWidth="1000">
Expand Down Expand Up @@ -372,27 +373,27 @@
</ToggleSwitch.Header>
</ToggleSwitch>-->
</Grid>
<TextBlock Margin="0 4 0 0">弹幕显示区域 <Run Text="{x:Bind Path=DanmuControl.DanmakuArea,Mode=OneWay,Converter={StaticResource numberToStringConvert}}"/></TextBlock>
<Slider x:Name="DanmuSettingArea" Value="{x:Bind Path=DanmuControl.DanmakuArea,Mode=TwoWay}" Minimum="0.1" Maximum="1" StepFrequency="0.1"></Slider>
<TextBlock Margin="0 4 0 0">弹幕缩放 <Run Text="{x:Bind Path=DanmuControl.DanmakuSizeZoom,Mode=OneWay,Converter={StaticResource numberToStringConvert}}"/></TextBlock>
<Slider x:Name="DanmuSettingFontZoom" Value="{x:Bind Path=DanmuControl.DanmakuSizeZoom,Mode=TwoWay}" Minimum="0.1" Maximum="2" StepFrequency="0.05"></Slider>
<TextBlock Margin="0 4 0 0">弹幕速度 <Run Text="{x:Bind Path=DanmuControl.DanmakuDuration,Mode=OneWay,Converter={StaticResource numberToStringConvert}}"/></TextBlock>
<Slider x:Name="DanmuSettingSpeed" Value="{x:Bind Path=DanmuControl.DanmakuDuration,Mode=TwoWay}" Minimum="1" Maximum="25" StepFrequency="1"></Slider>
<TextBlock Margin="0 4 0 0">弹幕透明度 <Run Text="{x:Bind Path=DanmuControl.Opacity,Mode=OneWay,Converter={StaticResource numberToStringConvert}}"/></TextBlock>
<Slider x:Name="DanmuSettingOpacity" Value="{x:Bind Path=DanmuControl.Opacity,Mode=TwoWay}" Minimum="0.1" Maximum="1" StepFrequency="0.1"></Slider>
<TextBlock Margin="0 4 0 0">弹幕顶部距离 <Run Text="{x:Bind Path=DanmuControl.Margin.Top,Mode=OneWay,Converter={StaticResource numberToStringConvert}}"/></TextBlock>
<TextBlock Margin="0 4 0 0" Visibility="{x:Bind m_danmakuController.DanmakuViewModel.ShowAreaControl}">弹幕显示区域 <Run Text="{x:Bind Path=m_danmakuController.DanmakuViewModel.Area,Mode=OneWay,Converter={StaticResource numberToStringConvert}}"/></TextBlock>
<Slider x:Name="DanmuSettingArea" Value="{x:Bind Path=m_danmakuController.DanmakuViewModel.Area,Mode=OneWay}" Minimum="0.1" Maximum="1" StepFrequency="0.1" Visibility="{x:Bind m_danmakuController.DanmakuViewModel.ShowAreaControl}"></Slider>
<TextBlock Margin="0 4 0 0">弹幕缩放 <Run Text="{x:Bind Path=m_danmakuController.DanmakuViewModel.SizeZoom,Mode=OneWay,Converter={StaticResource numberToStringConvert}}"/></TextBlock>
<Slider x:Name="DanmuSettingFontZoom" Value="{x:Bind Path=m_danmakuController.DanmakuViewModel.SizeZoom,Mode=OneWay}" Minimum="0.1" Maximum="2" StepFrequency="0.05"></Slider>
<TextBlock Margin="0 4 0 0">弹幕速度 <Run Text="{x:Bind Path=m_danmakuController.DanmakuViewModel.Speed,Mode=OneWay,Converter={StaticResource numberToStringConvert}}"/></TextBlock>
<Slider x:Name="DanmuSettingSpeed" Value="{x:Bind Path=m_danmakuController.DanmakuViewModel.Speed,Mode=OneWay}" Minimum="1" Maximum="25" StepFrequency="1"></Slider>
<TextBlock Margin="0 4 0 0">弹幕透明度 <Run Text="{x:Bind Path=m_danmakuController.DanmakuViewModel.Opacity,Mode=OneWay,Converter={StaticResource numberToStringConvert}}"/></TextBlock>
<Slider x:Name="DanmuSettingOpacity" Value="{x:Bind Path=m_danmakuController.DanmakuViewModel.Opacity,Mode=OneWay}" Minimum="0.1" Maximum="1" StepFrequency="0.1"></Slider>
<TextBlock Margin="0 4 0 0">弹幕顶部距离 <Run Text="{x:Bind Path=m_danmakuController.DanmakuViewModel.MarginTop,Mode=OneWay,Converter={StaticResource numberToStringConvert}}"/></TextBlock>
<Slider x:Name="DanmuTopMargin" Value="0" Minimum="0" Maximum="200" StepFrequency="4"></Slider>
<TextBlock Margin="0 4 0 0">弹幕每秒数量(0为不限制) <Run Text="{x:Bind Path=DanmuSettingMaxNum.Value,Mode=OneWay,Converter={StaticResource numberToStringConvert}}"/></TextBlock>
<TextBlock Margin="0 4 0 0">弹幕同屏密度(0为不限制) <Run Text="{x:Bind Path=DanmuSettingMaxNum.Value,Mode=OneWay,Converter={StaticResource numberToStringConvert}}"/></TextBlock>
<Slider x:Name="DanmuSettingMaxNum" Value="0" Minimum="0" Maximum="50" StepFrequency="1"></Slider>

<Grid Margin="0 4 0 0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" >
<StackPanel Grid.Column="1" Visibility="{x:Bind m_danmakuController.DanmakuViewModel.ShowBoldStyleControl}">
<TextBlock Margin="0 4">弹幕样式</TextBlock>
<ComboBox x:Name="DanmuSettingStyle" Foreground="White" SelectedIndex="{x:Bind Path=DanmuControl.DanmakuStyle,Converter={StaticResource styleConvert},Mode=TwoWay}">
<ComboBox x:Name="DanmuSettingStyle" Foreground="White" SelectedIndex="{x:Bind Path=m_danmakuController.DanmakuViewModel.BolderStyle,Converter={StaticResource styleConvert},Mode=TwoWay}">
<ComboBox.Items>
<ComboBoxItem>重叠</ComboBoxItem>
<ComboBoxItem>无边</ComboBoxItem>
Expand All @@ -401,7 +402,7 @@
</ComboBox.Items>
</ComboBox>
</StackPanel>
<ToggleSwitch x:Name="DanmuSettingBold" Foreground="White" Margin="0 4 0 0" IsOn="{x:Bind Path=DanmuControl.DanmakuBold,Mode=TwoWay}">
<ToggleSwitch x:Name="DanmuSettingBold" Foreground="White" Margin="0 4 0 0" IsOn="{x:Bind Path=m_danmakuController.DanmakuViewModel.Bold,Mode=TwoWay}" Visibility="{x:Bind m_danmakuController.DanmakuViewModel.ShowBoldControl}">
<ToggleSwitch.Header>
<TextBlock Foreground="White" >字体加粗</TextBlock>
</ToggleSwitch.Header>
Expand Down Expand Up @@ -583,6 +584,9 @@
<Grid>
<danmaku:Danmaku x:Name="DanmuControl"/>
</Grid>
<Grid>
<canvas:CanvasAnimatedControl x:Name="DanmakuCanvas"/>
</Grid>
<!--亮度-->
<Grid x:Name="BrightnessShield" Tapped="Grid_Tapped" Background="#99000000" Opacity="0"></Grid>
<Border
Expand Down Expand Up @@ -722,11 +726,11 @@
<Button x:Name="BottomBtnSelctSubtitle" Visibility="Collapsed" Foreground="White" Background="Transparent" Padding="8" Width="48" Height="48">
<fa:FontAwesome Icon="Solid_ClosedCaptioning" FontSize="20"></fa:FontAwesome>
</Button>
<Button x:Name="TopBtnOpenDanmaku" Click="TopBtnOpenDanmaku_Click" Visibility="{x:Bind Path=DanmuControl.Visibility,Mode=OneWay,Converter={StaticResource display}}" Background="Transparent" Padding="0" Width="48" Height="48">
<Button x:Name="TopBtnOpenDanmaku" Click="TopBtnOpenDanmaku_Click" Visibility="{x:Bind Path=m_danmakuController.DanmakuViewModel.IsHide,Mode=OneWay}" Background="Transparent" Padding="0" Width="48" Height="48">
<Image Width="28" Height="28" Source="/Assets/Icon/icon_danmaku_open.png" ></Image>
</Button>
<Button x:Name="TopBtnCloseDanmaku" Click="TopBtnCloseDanmaku_Click" Visibility="{x:Bind Path=DanmuControl.Visibility,Mode=OneWay}" Background="Transparent" Padding="0" Width="48" Height="48">

<Button x:Name="TopBtnCloseDanmaku" Click="TopBtnCloseDanmaku_Click" Visibility="{x:Bind convert:BoolToVisibilityConverter.AntiConvert(m_danmakuController.DanmakuViewModel.IsHide) ,Mode=OneWay}" Background="Transparent" Padding="0" Width="48" Height="48">
<Image Width="28" Height="28" Source="/Assets/Icon/icon_danmaku_close.png" ></Image>
</Button>

Expand Down
Loading

0 comments on commit ecf01bd

Please sign in to comment.