mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
achievement versioning
This commit is contained in:
@@ -50,4 +50,9 @@ internal sealed class Achievement
|
||||
/// 图标
|
||||
/// </summary>
|
||||
public string? Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 版本
|
||||
/// </summary>
|
||||
public string Version { get; set; } = default!;
|
||||
}
|
||||
@@ -3679,7 +3679,7 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 搜索成就名称,描述或编号 的本地化字符串。
|
||||
/// 查找类似 搜索成就名称,描述,版本或编号 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string ViewPageAchievementSearchPlaceholder {
|
||||
get {
|
||||
|
||||
@@ -1380,7 +1380,7 @@
|
||||
<value>删除当前存档</value>
|
||||
</data>
|
||||
<data name="ViewPageAchievementSearchPlaceholder" xml:space="preserve">
|
||||
<value>搜索成就名称,描述或编号</value>
|
||||
<value>搜索成就名称,描述,版本或编号</value>
|
||||
</data>
|
||||
<data name="ViewPageAchievementSortIncompletedItemsFirst" xml:space="preserve">
|
||||
<value>优先未完成</value>
|
||||
|
||||
@@ -32,7 +32,10 @@
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Background="{StaticResource CardBackgroundFillColorDefaultBrush}">
|
||||
<Grid
|
||||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||
BorderThickness="0,0,0,1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource CompatGridLength2}"/>
|
||||
<ColumnDefinition/>
|
||||
@@ -53,7 +56,7 @@
|
||||
DefaultLabelPosition="Right">
|
||||
<CommandBar.Content>
|
||||
<AutoSuggestBox
|
||||
Width="240"
|
||||
Width="300"
|
||||
Height="36"
|
||||
Margin="3,6,6,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
@@ -218,7 +221,24 @@
|
||||
<ColumnDefinition Width="32"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Inner.Title}"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Inner.Title}"/>
|
||||
<Border
|
||||
Margin="4,0,0,0"
|
||||
Padding="4,1"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Opacity="0.6" Color="{ThemeResource SystemAccentColor}"/>
|
||||
</Border.Background>
|
||||
<TextBlock
|
||||
FontSize="10"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{Binding Inner.Version}"/>
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
Margin="0,2,0,0"
|
||||
Style="{StaticResource SecondaryTextStyle}"
|
||||
|
||||
@@ -13,6 +13,7 @@ using Snap.Hutao.Service.Navigation;
|
||||
using Snap.Hutao.Service.Notification;
|
||||
using Snap.Hutao.View.Dialog;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text.RegularExpressions;
|
||||
using Windows.Storage.Pickers;
|
||||
using EntityAchievementArchive = Snap.Hutao.Model.Entity.AchievementArchive;
|
||||
using MetadataAchievement = Snap.Hutao.Model.Metadata.Achievement.Achievement;
|
||||
@@ -378,16 +379,21 @@ internal sealed partial class AchievementViewModel : Abstraction.ViewModel, INav
|
||||
if (uint.TryParse(search, out uint achievementId))
|
||||
{
|
||||
Achievements.Filter = obj => ((AchievementView)obj).Inner.Id == achievementId;
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
if (VersionRegex().IsMatch(search))
|
||||
{
|
||||
Achievements.Filter = obj =>
|
||||
{
|
||||
AchievementView view = (AchievementView)obj;
|
||||
return view.Inner.Title.Contains(search, StringComparison.CurrentCultureIgnoreCase)
|
||||
|| view.Inner.Description.Contains(search, StringComparison.CurrentCultureIgnoreCase);
|
||||
};
|
||||
Achievements.Filter = obj => ((AchievementView)obj).Inner.Version == search;
|
||||
return;
|
||||
}
|
||||
|
||||
Achievements.Filter = obj =>
|
||||
{
|
||||
AchievementView view = (AchievementView)obj;
|
||||
return view.Inner.Title.Contains(search, StringComparison.CurrentCultureIgnoreCase)
|
||||
|| view.Inner.Description.Contains(search, StringComparison.CurrentCultureIgnoreCase);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -407,4 +413,7 @@ internal sealed partial class AchievementViewModel : Abstraction.ViewModel, INav
|
||||
UpdateAchievementsFinishPercent();
|
||||
}
|
||||
}
|
||||
|
||||
[GeneratedRegex("\\d\\.\\d")]
|
||||
private static partial Regex VersionRegex();
|
||||
}
|
||||
Reference in New Issue
Block a user