This repository has been archived by the owner on Dec 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 支持合集的显示与播放 * 清理代码
- Loading branch information
Showing
21 changed files
with
3,690 additions
and
1,061 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<controls:PlayerComponent | ||
x:Class="Richasy.Bili.App.Controls.Player.Related.UgcEpisodeView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="using:Richasy.Bili.App.Controls" | ||
xmlns:converter="using:Richasy.Bili.App.Resources.Converter" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:loc="using:Richasy.Bili.Locator.Uwp" | ||
xmlns:local="using:Richasy.Bili.App.Controls.Player.Related" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" | ||
xmlns:uwp="using:Richasy.Bili.ViewModels.Uwp" | ||
xmlns:v1="using:Bilibili.App.View.V1" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400" | ||
mc:Ignorable="d"> | ||
|
||
<controls:PlayerComponent.Resources> | ||
<converter:UgcEpisodeConverter x:Key="EpisodeConverter" /> | ||
</controls:PlayerComponent.Resources> | ||
|
||
<Grid RowSpacing="8"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
<Grid ColumnSpacing="8"> | ||
<ComboBox | ||
x:Name="SectionComboBox" | ||
HorizontalAlignment="Stretch" | ||
ItemsSource="{x:Bind ViewModel.UgcSectionCollection}" | ||
SelectedItem="{x:Bind ViewModel.CurrentUgcSection, Mode=OneWay}" | ||
SelectionChanged="OnSectionComboBoxSelectionChanged"> | ||
<ComboBox.ItemTemplate> | ||
<DataTemplate x:DataType="v1:Section"> | ||
<TextBlock Text="{x:Bind Title}" /> | ||
</DataTemplate> | ||
</ComboBox.ItemTemplate> | ||
</ComboBox> | ||
</Grid> | ||
<ScrollViewer | ||
Grid.Row="1" | ||
HorizontalScrollMode="Disabled" | ||
VerticalScrollBarVisibility="Hidden" | ||
VerticalScrollMode="{x:Bind VerticalScrollMode, Mode=OneWay}"> | ||
<Grid> | ||
<controls:VerticalRepeaterView | ||
EnableDetectParentScrollViewer="False" | ||
HeaderVisibility="Collapsed" | ||
ItemOrientation="Horizontal" | ||
ItemsSource="{x:Bind ViewModel.UgcEpisodeCollection}" | ||
Loaded="OnLoadedAsync"> | ||
<controls:VerticalRepeaterView.ItemTemplate> | ||
<DataTemplate x:DataType="uwp:VideoViewModel"> | ||
<controls:VideoCard | ||
MaxHeight="120" | ||
HorizontalCoverWidth="120" | ||
IsShowAvatar="False" | ||
IsShowDanmakuCount="True" | ||
IsShowPlayCount="True" | ||
ViewModel="{x:Bind}" /> | ||
</DataTemplate> | ||
</controls:VerticalRepeaterView.ItemTemplate> | ||
</controls:VerticalRepeaterView> | ||
</Grid> | ||
</ScrollViewer> | ||
</Grid> | ||
</controls:PlayerComponent> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Richasy. All rights reserved. | ||
|
||
using Bilibili.App.View.V1; | ||
|
||
namespace Richasy.Bili.App.Controls.Player.Related | ||
{ | ||
/// <summary> | ||
/// 合集视图. | ||
/// </summary> | ||
public sealed partial class UgcEpisodeView : PlayerComponent | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="UgcEpisodeView"/> class. | ||
/// </summary> | ||
public UgcEpisodeView() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
private void OnSectionComboBoxSelectionChanged(object sender, Windows.UI.Xaml.Controls.SelectionChangedEventArgs e) | ||
{ | ||
if (SectionComboBox.SelectedItem is Section item && item != ViewModel.CurrentUgcSection) | ||
{ | ||
ViewModel.ChangeUgcSection(item); | ||
} | ||
} | ||
|
||
private async void OnLoadedAsync(object sender, Windows.UI.Xaml.RoutedEventArgs e) | ||
{ | ||
await System.Threading.Tasks.Task.Delay(200); | ||
if (ViewModel.IsShowUgcSection) | ||
{ | ||
var index = ViewModel.CurrentUgcSection.Episodes.IndexOf(ViewModel.CurrentUgcEpisode); | ||
if (index > 0) | ||
{ | ||
(sender as VerticalRepeaterView).ScrollToItem(index); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) Richasy. All rights reserved. | ||
|
||
using System; | ||
using Bilibili.App.View.V1; | ||
using Richasy.Bili.ViewModels.Uwp; | ||
using Windows.UI.Xaml.Data; | ||
|
||
namespace Richasy.Bili.App.Resources.Converter | ||
{ | ||
internal sealed class UgcEpisodeConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, string language) | ||
{ | ||
if (value is Episode ugcEpisode) | ||
{ | ||
return new VideoViewModel(ugcEpisode); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, string language) => throw new NotImplementedException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/Models/Models.gRPC/bilibili/app/archive/middleware/v1/preload.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.