adjust achievement UI

This commit is contained in:
DismissedLight
2023-02-06 13:45:41 +08:00
parent 6351f2b460
commit b7b1155cfc
7 changed files with 59 additions and 62 deletions

View File

@@ -645,15 +645,6 @@ namespace Snap.Hutao.Resource.Localization {
}
}
/// <summary>
/// 查找类似 尚未选择任何用户以及角色 的本地化字符串。
/// </summary>
internal static string ServiceUserAndRoleUnselected {
get {
return ResourceManager.GetString("ServiceUserAndRoleUnselected", resourceCulture);
}
}
/// <summary>
/// 查找类似 多个用户记录为选中状态 的本地化字符串。
/// </summary>
@@ -979,7 +970,7 @@ namespace Snap.Hutao.Resource.Localization {
}
/// <summary>
/// 查找类似 设置实时便笺通知 的本地化字符串。
/// 查找类似 实时便笺通知设置 的本地化字符串。
/// </summary>
internal static string ViewDialogDailyNoteNotificationTitle {
get {
@@ -1258,7 +1249,7 @@ namespace Snap.Hutao.Resource.Localization {
}
/// <summary>
/// 查找类似 该操作是不可逆的,该存档和其内的所有成就状态会丢失 的本地化字符串。
/// 查找类似 该操作是不可逆的,该存档和其内的所有成就状态会丢失 的本地化字符串。
/// </summary>
internal static string ViewModelAchievementRemoveArchiveContent {
get {
@@ -1285,7 +1276,7 @@ namespace Snap.Hutao.Resource.Localization {
}
/// <summary>
/// 查找类似 角色信息服务 [Enak API] 当前不可用 的本地化字符串。
/// 查找类似 角色信息服务 [Enka API] 当前不可用 的本地化字符串。
/// </summary>
internal static string ViewModelAvatarPropertyEnkaApiUnavailable {
get {
@@ -2293,7 +2284,7 @@ namespace Snap.Hutao.Resource.Localization {
}
/// <summary>
/// 查找类似 导入从其他 App 中导出的数据 的本地化字符串。
/// 查找类似 导入来自其它 App 的数据 的本地化字符串。
/// </summary>
internal static string ViewPageGachaLogImportDescription {
get {
@@ -2806,7 +2797,7 @@ namespace Snap.Hutao.Resource.Localization {
}
/// <summary>
/// 查找类似 设置当前帧率 的本地化字符串。
/// 查找类似 设置帧率上限 的本地化字符串。
/// </summary>
internal static string ViewPageLaunchGameSetFpsHeader {
get {

View File

@@ -312,9 +312,6 @@
<data name="ServiceMetadataRequestFailed" xml:space="preserve">
<value>元数据校验文件下载失败</value>
</data>
<data name="ServiceUserAndRoleUnselected" xml:space="preserve">
<value>尚未选择任何用户以及角色</value>
</data>
<data name="ServiceUserCurrentMultiMatched" xml:space="preserve">
<value>多个用户记录为选中状态</value>
</data>

View File

@@ -51,7 +51,7 @@ internal class GachaLogUrlStokenProvider : IGachaLogUrlProvider
}
else
{
return new(false, SH.ServiceUserAndRoleUnselected);
return new(false, SH.MustSelectUserAndUid);
}
}
}

View File

@@ -23,7 +23,7 @@
<NavigationView.MenuItems>
<NavigationViewItem
shvh:NavHelper.NavigateTo="shvp:AnnouncementPage"
Content="{shcm:ResourceString ViewAnnouncementHeader}"
Content="{shcm:ResourceString Name=ViewAnnouncementHeader}"
Icon="{shcm:BitmapIcon Source=ms-appx:///Resource/Icon/UI_BtnIcon_ActivityEntry.png}"/>
<NavigationViewItemHeader Content="{shcm:ResourceString Name=ViewToolHeader}"/>

View File

@@ -177,47 +177,49 @@
CornerRadius="{ThemeResource ControlCornerRadius}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<CheckBox
Grid.Column="1"
Margin="6,0,12,0"
Padding="16,0,0,0"
Grid.Column="0"
MinWidth="0"
MinHeight="0"
Margin="8,0"
Padding="0,0,0,0"
Command="{Binding Path=DataContext.SaveAchievementCommand, Source={StaticResource BindingProxy}}"
CommandParameter="{Binding}"
IsChecked="{Binding IsChecked, Mode=TwoWay}"
Style="{StaticResource DefaultCheckBoxStyle}">
<CheckBox.Content>
<StackPanel>
<TextBlock Text="{Binding Inner.Title}"/>
<TextBlock
Margin="0,2,0,0"
Style="{StaticResource SecondaryTextStyle}"
Text="{Binding Inner.Description}"
TextTrimming="CharacterEllipsis"/>
</StackPanel>
</CheckBox.Content>
</CheckBox>
<Grid Grid.Column="3">
IsChecked="{Binding IsChecked, Mode=TwoWay}"/>
<Grid Grid.Column="1" Margin="8,0,0,0">
<Grid.ColumnDefinitions>
<!-- text -->
<ColumnDefinition/>
<ColumnDefinition/>
<!-- time -->
<ColumnDefinition Width="auto"/>
<!-- pic -->
<ColumnDefinition Width="auto"/>
<!-- count -->
<ColumnDefinition Width="32"/>
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="{Binding Inner.Title}"/>
<TextBlock
Margin="0,2,0,0"
Style="{StaticResource SecondaryTextStyle}"
Text="{Binding Inner.Description}"
TextTrimming="CharacterEllipsis"/>
</StackPanel>
<TextBlock
Grid.Column="0"
Grid.Column="1"
Margin="12,0,12,0"
VerticalAlignment="Center"
Text="{Binding Time}"
Visibility="{Binding IsChecked, Converter={StaticResource BoolToVisibilityConverter}}"/>
<Image
Grid.Column="1"
Grid.Column="2"
Height="32"
Source="ms-appx:///Resource/Icon/UI_ItemIcon_201.png"/>
<TextBlock
Grid.Column="2"
Grid.Column="3"
Margin="12,0,0,0"
VerticalAlignment="Center"
Text="{Binding Inner.FinishReward.Count}"/>

View File

@@ -175,7 +175,7 @@
<wsc:Setting
Background="{ThemeResource SystemFillColorCriticalBackgroundBrush}"
Description="{shcm:ResourceString Name=ViewPageSettingDeleteTaskDescription}"
Header="{shcm:ResourceString ViewPageSettingDeleteTaskHeader}"
Header="{shcm:ResourceString Name=ViewPageSettingDeleteTaskHeader}"
Icon="&#xE7C4;">
<wsc:Setting.ActionContent>
<Button Command="{Binding Experimental.DeleteAllScheduleTasksCommand}" Content="{shcm:ResourceString Name=ViewPageSettingDangerousAction}"/>

View File

@@ -20,6 +20,9 @@ using Snap.Hutao.View.Dialog;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;
using Windows.Storage.Pickers;
using BindingAchievementGoal = Snap.Hutao.Model.Binding.Achievement.AchievementGoal;
using EntityAchievementArchive = Snap.Hutao.Model.Entity.AchievementArchive;
using MetadataAchievementGoal = Snap.Hutao.Model.Metadata.Achievement.AchievementGoal;
namespace Snap.Hutao.ViewModel;
@@ -42,10 +45,10 @@ internal class AchievementViewModel : Abstraction.ViewModel, INavigationRecipien
private readonly TaskCompletionSource<bool> openUICompletionSource = new();
private AdvancedCollectionView? achievements;
private List<Model.Binding.Achievement.AchievementGoal>? achievementGoals;
private Model.Binding.Achievement.AchievementGoal? selectedAchievementGoal;
private ObservableCollection<Model.Entity.AchievementArchive>? archives;
private Model.Entity.AchievementArchive? selectedArchive;
private List<BindingAchievementGoal>? achievementGoals;
private BindingAchievementGoal? selectedAchievementGoal;
private ObservableCollection<EntityAchievementArchive>? archives;
private EntityAchievementArchive? selectedArchive;
private bool isIncompletedItemsFirst = true;
private string searchText = string.Empty;
private string? finishDescription;
@@ -87,7 +90,7 @@ internal class AchievementViewModel : Abstraction.ViewModel, INavigationRecipien
/// <summary>
/// 成就存档集合
/// </summary>
public ObservableCollection<Model.Entity.AchievementArchive>? Archives
public ObservableCollection<EntityAchievementArchive>? Archives
{
get => archives;
set => SetProperty(ref archives, value);
@@ -96,7 +99,7 @@ internal class AchievementViewModel : Abstraction.ViewModel, INavigationRecipien
/// <summary>
/// 选中的成就存档
/// </summary>
public Model.Entity.AchievementArchive? SelectedArchive
public EntityAchievementArchive? SelectedArchive
{
get => selectedArchive;
set
@@ -124,7 +127,7 @@ internal class AchievementViewModel : Abstraction.ViewModel, INavigationRecipien
/// <summary>
/// 成就分类
/// </summary>
public List<Model.Binding.Achievement.AchievementGoal>? AchievementGoals
public List<BindingAchievementGoal>? AchievementGoals
{
get => achievementGoals;
set => SetProperty(ref achievementGoals, value);
@@ -133,7 +136,7 @@ internal class AchievementViewModel : Abstraction.ViewModel, INavigationRecipien
/// <summary>
/// 选中的成就分类
/// </summary>
public Model.Binding.Achievement.AchievementGoal? SelectedAchievementGoal
public BindingAchievementGoal? SelectedAchievementGoal
{
get => selectedAchievementGoal;
set
@@ -165,7 +168,11 @@ internal class AchievementViewModel : Abstraction.ViewModel, INavigationRecipien
/// <summary>
/// 完成进度描述
/// </summary>
public string? FinishDescription { get => finishDescription; set => SetProperty(ref finishDescription, value); }
public string? FinishDescription
{
get => finishDescription;
set => SetProperty(ref finishDescription, value);
}
/// <summary>
/// 打开页面命令
@@ -235,18 +242,18 @@ internal class AchievementViewModel : Abstraction.ViewModel, INavigationRecipien
{
try
{
List<Model.Binding.Achievement.AchievementGoal> sortedGoals;
ObservableCollection<Model.Entity.AchievementArchive> archives;
List<BindingAchievementGoal> sortedGoals;
ObservableCollection<EntityAchievementArchive> archives;
ThrowIfViewDisposed();
using (await DisposeLock.EnterAsync(CancellationToken).ConfigureAwait(false))
{
ThrowIfViewDisposed();
List<Model.Metadata.Achievement.AchievementGoal> goals = await metadataService.GetAchievementGoalsAsync(CancellationToken).ConfigureAwait(false);
List<MetadataAchievementGoal> goals = await metadataService.GetAchievementGoalsAsync(CancellationToken).ConfigureAwait(false);
sortedGoals = goals
.OrderBy(goal => goal.Order)
.Select(goal => new Model.Binding.Achievement.AchievementGoal(goal))
.Select(goal => new BindingAchievementGoal(goal))
.ToList();
archives = await achievementService.GetArchiveCollectionAsync().ConfigureAwait(false);
}
@@ -280,7 +287,7 @@ internal class AchievementViewModel : Abstraction.ViewModel, INavigationRecipien
if (isOk)
{
ArchiveAddResult result = await achievementService.TryAddArchiveAsync(Model.Entity.AchievementArchive.Create(name)).ConfigureAwait(false);
ArchiveAddResult result = await achievementService.TryAddArchiveAsync(EntityAchievementArchive.Create(name)).ConfigureAwait(false);
switch (result)
{
@@ -450,7 +457,7 @@ internal class AchievementViewModel : Abstraction.ViewModel, INavigationRecipien
}
}
private async Task<bool> TryImportUIAFInternalAsync(Model.Entity.AchievementArchive archive, UIAF uiaf)
private async Task<bool> TryImportUIAFInternalAsync(EntityAchievementArchive archive, UIAF uiaf)
{
if (uiaf.IsCurrentVersionSupported())
{
@@ -484,7 +491,7 @@ internal class AchievementViewModel : Abstraction.ViewModel, INavigationRecipien
}
#endregion
private async Task UpdateAchievementsAsync(Model.Entity.AchievementArchive archive)
private async Task UpdateAchievementsAsync(EntityAchievementArchive archive)
{
List<Model.Metadata.Achievement.Achievement> rawAchievements = await metadataService.GetAchievementsAsync(CancellationToken).ConfigureAwait(false);
List<Model.Binding.Achievement.Achievement> combined;
@@ -523,7 +530,7 @@ internal class AchievementViewModel : Abstraction.ViewModel, INavigationRecipien
}
}
private void UpdateAchievementsFilter(Model.Binding.Achievement.AchievementGoal? goal)
private void UpdateAchievementsFilter(BindingAchievementGoal? goal)
{
if (Achievements != null)
{
@@ -572,11 +579,11 @@ internal class AchievementViewModel : Abstraction.ViewModel, INavigationRecipien
private struct GoalAggregation
{
public readonly Model.Binding.Achievement.AchievementGoal AchievementGoal;
public readonly BindingAchievementGoal AchievementGoal;
public int Finished;
public int Count;
public GoalAggregation(Model.Binding.Achievement.AchievementGoal goal)
public GoalAggregation(BindingAchievementGoal goal)
{
AchievementGoal = goal;
}