diff --git a/src/App/Controls/Player/BiliPlayerTransportControls/BiliPlayerTransportControls.Properties.cs b/src/App/Controls/Player/BiliPlayerTransportControls/BiliPlayerTransportControls.Properties.cs index 43182ae66..66286e148 100644 --- a/src/App/Controls/Player/BiliPlayerTransportControls/BiliPlayerTransportControls.Properties.cs +++ b/src/App/Controls/Player/BiliPlayerTransportControls/BiliPlayerTransportControls.Properties.cs @@ -59,6 +59,7 @@ public partial class BiliPlayerTransportControls private const string PreviousEpisodeButtonName = "PreviousEpisodeButton"; private const string NextEpisodeButtonName = "NextEpisodeButton"; private const string ScreenshotButtonName = "ScreenshotButton"; + private const string PlaybackRateNodeComboBoxName = "PlaybackRateNodeComboBox"; private readonly Dictionary> _danmakuDictionary; @@ -90,6 +91,7 @@ public partial class BiliPlayerTransportControls private TextBlock _subtitleBlock; private Grid _tempMessageContainer; private TextBlock _tempMessageBlock; + private ComboBox _playbackRateNodeComboBox; private int _segmentIndex; private double _cursorStayTime; private double _tempMessageHoldSeconds; diff --git a/src/App/Controls/Player/BiliPlayerTransportControls/BiliPlayerTransportControls.cs b/src/App/Controls/Player/BiliPlayerTransportControls/BiliPlayerTransportControls.cs index fd04b91f9..092b0e3c0 100644 --- a/src/App/Controls/Player/BiliPlayerTransportControls/BiliPlayerTransportControls.cs +++ b/src/App/Controls/Player/BiliPlayerTransportControls/BiliPlayerTransportControls.cs @@ -88,6 +88,7 @@ protected override void OnApplyTemplate() _subtitleBlock = GetTemplateChild(SubtitleBlockName) as TextBlock; _tempMessageContainer = GetTemplateChild(TempMessageContaienrName) as Grid; _tempMessageBlock = GetTemplateChild(TempMessageBlockName) as TextBlock; + _playbackRateNodeComboBox = GetTemplateChild(PlaybackRateNodeComboBoxName) as ComboBox; _fullWindowPlayModeButton.Click += OnPlayModeButtonClick; _fullScreenPlayModeButton.Click += OnPlayModeButtonClick; @@ -107,6 +108,7 @@ protected override void OnApplyTemplate() _previousEpisodeButton.Click += OnPreviousEpisodeButtonClickAsync; _nextEpisodeButton.Click += OnNextEpisodeButtonClickAsync; _screenshotButton.Click += OnScreenshotButtonClickAsync; + _playbackRateNodeComboBox.SelectionChanged += OnPlaybackRateNodeComboBoxSelectionChanged; if (_formatListView != null) { @@ -877,6 +879,16 @@ private void OnInteractionControlManipulationStarted(object sender, Manipulation } } + private void OnPlaybackRateNodeComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e) + { + var item = _playbackRateNodeComboBox.SelectedItem; + if (item is double rate) + { + ViewModel.PlaybackRate = rate; + _playbackRateNodeComboBox.SelectedItem = null; + } + } + private void ShowTempMessage(string message) { _tempMessageContainer.Visibility = Visibility.Visible; diff --git a/src/App/Controls/Player/BiliPlayerTransportControls/BiliPlayerTransportControls.xaml b/src/App/Controls/Player/BiliPlayerTransportControls/BiliPlayerTransportControls.xaml index 6104ffd1c..b78d59ddd 100644 --- a/src/App/Controls/Player/BiliPlayerTransportControls/BiliPlayerTransportControls.xaml +++ b/src/App/Controls/Player/BiliPlayerTransportControls/BiliPlayerTransportControls.xaml @@ -651,6 +651,20 @@ + + + + + + + + + + 加入清晰度后缀 + + 快速选择 + 排行榜 diff --git a/src/Models/Models.Enums/App/LanguageNames.cs b/src/Models/Models.Enums/App/LanguageNames.cs index 93a6c3374..72dcc7e38 100644 --- a/src/Models/Models.Enums/App/LanguageNames.cs +++ b/src/Models/Models.Enums/App/LanguageNames.cs @@ -439,6 +439,7 @@ public enum LanguageNames GlobalPlaybackRateDescription, MyFavoriteAnime, FirstClickTagTip, + QuickSelection, #pragma warning restore SA1602 // Enumeration items should be documented } } diff --git a/src/ViewModels/ViewModels.Uwp/Common/PlayerViewModel/PlayerViewModel.Methods.cs b/src/ViewModels/ViewModels.Uwp/Common/PlayerViewModel/PlayerViewModel.Methods.cs index 4685250cc..1f2e20598 100644 --- a/src/ViewModels/ViewModels.Uwp/Common/PlayerViewModel/PlayerViewModel.Methods.cs +++ b/src/ViewModels/ViewModels.Uwp/Common/PlayerViewModel/PlayerViewModel.Methods.cs @@ -1,6 +1,7 @@ // Copyright (c) Richasy. All rights reserved. using System; +using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Net; @@ -1000,6 +1001,15 @@ private void InitializePlaybackRateProperties() MaxPlaybackRate = isEnhancement ? 6d : 3d; PlaybackRateStep = isEnhancement ? 0.2 : 0.1; + PlaybackRateNodeCollection.Clear(); + var defaultList = new List { 0.5, 0.75, 1.0, 1.25, 1.5, 2.0 }; + if (isEnhancement) + { + defaultList = defaultList.Union(new List { 2.5, 3.0, 3.5, 5.0 }).ToList(); + } + + defaultList.ForEach(p => PlaybackRateNodeCollection.Add(p)); + var isGlobal = _settingsToolkit.ReadLocalSetting(SettingNames.GlobalPlaybackRate, false); if (!isGlobal) { diff --git a/src/ViewModels/ViewModels.Uwp/Common/PlayerViewModel/PlayerViewModel.Properties.cs b/src/ViewModels/ViewModels.Uwp/Common/PlayerViewModel/PlayerViewModel.Properties.cs index 727655956..8a97a71d5 100644 --- a/src/ViewModels/ViewModels.Uwp/Common/PlayerViewModel/PlayerViewModel.Properties.cs +++ b/src/ViewModels/ViewModels.Uwp/Common/PlayerViewModel/PlayerViewModel.Properties.cs @@ -306,6 +306,11 @@ public partial class PlayerViewModel /// public ObservableCollection ChoiceCollection { get; } + /// + /// 播放速率节点集合. + /// + public ObservableCollection PlaybackRateNodeCollection { get; } + /// /// 当前分P. /// diff --git a/src/ViewModels/ViewModels.Uwp/Common/PlayerViewModel/PlayerViewModel.cs b/src/ViewModels/ViewModels.Uwp/Common/PlayerViewModel/PlayerViewModel.cs index 6aa22a88a..e9a138329 100644 --- a/src/ViewModels/ViewModels.Uwp/Common/PlayerViewModel/PlayerViewModel.cs +++ b/src/ViewModels/ViewModels.Uwp/Common/PlayerViewModel/PlayerViewModel.cs @@ -45,6 +45,7 @@ public PlayerViewModel() StaffCollection = new ObservableCollection(); ChoiceCollection = new ObservableCollection(); TagCollection = new ObservableCollection(); + PlaybackRateNodeCollection = new ObservableCollection(); _audioList = new List(); _videoList = new List(); _subtitleList = new List();