diff --git a/src/Snap.Hutao/Snap.Hutao/Model/Intrinsic/QuestType.cs b/src/Snap.Hutao/Snap.Hutao/Model/Intrinsic/QuestType.cs index d11e108b12..591d59aecd 100644 --- a/src/Snap.Hutao/Snap.Hutao/Model/Intrinsic/QuestType.cs +++ b/src/Snap.Hutao/Snap.Hutao/Model/Intrinsic/QuestType.cs @@ -31,7 +31,7 @@ internal enum QuestType : uint DQ, /// - /// Indescribable Quest 不可描述的任务? + /// Interval Quest 间隔任务? /// IQ, diff --git a/src/Snap.Hutao/Snap.Hutao/Model/Metadata/Achievement/Achievement.cs b/src/Snap.Hutao/Snap.Hutao/Model/Metadata/Achievement/Achievement.cs index ba2e8cbf4a..e0e11d9c82 100644 --- a/src/Snap.Hutao/Snap.Hutao/Model/Metadata/Achievement/Achievement.cs +++ b/src/Snap.Hutao/Snap.Hutao/Model/Metadata/Achievement/Achievement.cs @@ -55,4 +55,9 @@ internal sealed class Achievement /// 版本 /// public string Version { get; set; } = default!; + + /// + /// 是否为委托成就 + /// + public bool IsDailyQuest { get; set; } } \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx index 481a4f18ee..2cd1c7cedb 100644 --- a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx +++ b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx @@ -2006,6 +2006,9 @@ 导出 + + 仅委托成就 + 从剪贴板导入 diff --git a/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/AchievementPage.xaml b/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/AchievementPage.xaml index af11aafbf2..390c766c74 100644 --- a/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/AchievementPage.xaml +++ b/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/AchievementPage.xaml @@ -328,6 +328,11 @@ Icon="{shuxm:FontIcon Glyph=}" IsChecked="{Binding IsUncompletedItemsFirst, Mode=TwoWay}" Label="{shuxm:ResourceString Name=ViewPageAchievementSortIncompletedItemsFirst}"/> + diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Achievement/AchievementViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Achievement/AchievementViewModel.cs index 71ff29c700..4a5caa3241 100644 --- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Achievement/AchievementViewModel.cs +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Achievement/AchievementViewModel.cs @@ -40,6 +40,7 @@ internal sealed partial class AchievementViewModel : Abstraction.ViewModel, INav private IAdvancedDbCollectionView? archives; private bool isUncompletedItemsFirst = true; + private bool filterDailyQuestItems; private string searchText = string.Empty; private string? finishDescription; @@ -99,6 +100,12 @@ public bool IsUncompletedItemsFirst set => SetProperty(ref isUncompletedItemsFirst, value); } + public bool FilterDailyQuestItems + { + get => filterDailyQuestItems; + set => SetProperty(ref filterDailyQuestItems, value); + } + public string? FinishDescription { get => finishDescription; @@ -374,28 +381,31 @@ private void UpdateAchievementsFilterByGoal(AchievementGoalView? goal) [Command("SearchAchievementCommand")] private void UpdateAchievementsFilterBySearch(string? search) { - if (Achievements is null) + if (Achievements is null || AchievementGoals is null) { return; } - AchievementGoals?.MoveCurrentTo(default); + AchievementGoals.MoveCurrentTo(default); if (string.IsNullOrEmpty(search)) { Achievements.Filter = default!; + AchievementGoals.Filter = default!; return; } if (uint.TryParse(search, out uint achievementId)) { Achievements.Filter = view => view.Inner.Id == achievementId; + AchievementGoals.Filter = goal => Achievements.View.FirstOrDefault(view => view.Inner.Goal == goal.Id) is not null; return; } if (VersionRegex().IsMatch(search)) { Achievements.Filter = view => view.Inner.Version == search; + AchievementGoals.Filter = goal => Achievements.View.FirstOrDefault(view => view.Inner.Goal == goal.Id) is not null; return; } @@ -404,6 +414,7 @@ private void UpdateAchievementsFilterBySearch(string? search) return view.Inner.Title.Contains(search, StringComparison.CurrentCultureIgnoreCase) || view.Inner.Description.Contains(search, StringComparison.CurrentCultureIgnoreCase); }; + AchievementGoals.Filter = goal => Achievements.View.FirstOrDefault(view => view.Inner.Goal == goal.Id) is not null; } [Command("SaveAchievementCommand")] @@ -417,4 +428,24 @@ private void SaveAchievement(AchievementView? achievement) scopeContext.AchievementService.SaveAchievement(achievement); AchievementFinishPercent.Update(this); } + + [Command("FilterDailyQuestSwitchCommand")] + private void UpdateAchievementsFilterByDailyQuest() + { + if (Achievements is null || AchievementGoals is null) + { + return; + } + + if (FilterDailyQuestItems) + { + Achievements.Filter = (AchievementView view) => view.Inner.IsDailyQuest; + AchievementGoals.Filter = goal => Achievements.View.FirstOrDefault(view => view.Inner.Goal == goal.Id) is not null; + } + else + { + Achievements.Filter = default!; + AchievementGoals.Filter = default!; + } + } } \ No newline at end of file