mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
Compare commits
1 Commits
feat/1100
...
feat/unhel
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3dea892ed7 |
@@ -19,6 +19,7 @@ internal sealed partial class SettingEntry
|
||||
public const string AnnouncementRegion = "AnnouncementRegion";
|
||||
|
||||
public const string IsEmptyHistoryWishVisible = "IsEmptyHistoryWishVisible";
|
||||
public const string IsNeverHeldStatisticsItemVisible = "IsNeverHeldStatisticsItemVisible";
|
||||
|
||||
public const string GeetestCustomCompositeUrl = "GeetestCustomCompositeUrl";
|
||||
|
||||
|
||||
@@ -2636,6 +2636,12 @@
|
||||
<data name="ViewPageSettingKeyShortcutHeader" xml:space="preserve">
|
||||
<value>快捷键</value>
|
||||
</data>
|
||||
<data name="ViewPageSettingNeverHeldItemVisibleDescription" xml:space="preserve">
|
||||
<value>在祈愿记录页面显示或隐藏未持有过的角色或武器</value>
|
||||
</data>
|
||||
<data name="ViewPageSettingNeverHeldItemVisibleHeader" xml:space="preserve">
|
||||
<value>未持有过的角色或武器</value>
|
||||
</data>
|
||||
<data name="ViewPageSettingOfficialSiteNavigate" xml:space="preserve">
|
||||
<value>前往官网</value>
|
||||
</data>
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Snap.Hutao.Service;
|
||||
[Injection(InjectAs.Singleton)]
|
||||
internal sealed partial class AppOptions : DbStoreOptions
|
||||
{
|
||||
private bool? isNeverHeldStatisticsItemVisible;
|
||||
private bool? isEmptyHistoryWishVisible;
|
||||
private BackdropType? backdropType;
|
||||
private ElementTheme? elementTheme;
|
||||
@@ -28,6 +29,12 @@ internal sealed partial class AppOptions : DbStoreOptions
|
||||
set => SetOption(ref isEmptyHistoryWishVisible, SettingEntry.IsEmptyHistoryWishVisible, value);
|
||||
}
|
||||
|
||||
public bool IsNeverHeldStatisticsItemVisible
|
||||
{
|
||||
get => GetOption(ref isNeverHeldStatisticsItemVisible, SettingEntry.IsNeverHeldStatisticsItemVisible);
|
||||
set => SetOption(ref isNeverHeldStatisticsItemVisible, SettingEntry.IsNeverHeldStatisticsItemVisible, value);
|
||||
}
|
||||
|
||||
public List<NameValue<BackdropType>> BackdropTypes { get; } = CollectionsNameValue.FromEnum<BackdropType>(type => type >= 0);
|
||||
|
||||
public BackdropType BackdropType
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
using Snap.Hutao.Core.ExceptionService;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Metadata;
|
||||
using Snap.Hutao.Model.Metadata.Avatar;
|
||||
using Snap.Hutao.Model.Metadata.Weapon;
|
||||
using Snap.Hutao.Service.Metadata;
|
||||
@@ -10,6 +11,7 @@ using Snap.Hutao.Service.Metadata.ContextAbstraction;
|
||||
using Snap.Hutao.ViewModel.GachaLog;
|
||||
using Snap.Hutao.Web.Hoyolab.Hk4e.Event.GachaInfo;
|
||||
using Snap.Hutao.Web.Hutao.GachaLog;
|
||||
using System.Collections.Frozen;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Snap.Hutao.Service.GachaLog.Factory;
|
||||
@@ -22,6 +24,16 @@ namespace Snap.Hutao.Service.GachaLog.Factory;
|
||||
[Injection(InjectAs.Scoped, typeof(IGachaStatisticsFactory))]
|
||||
internal sealed partial class GachaStatisticsFactory : IGachaStatisticsFactory
|
||||
{
|
||||
private static readonly FrozenSet<uint> BlueStandardWeaponIdsSet = FrozenSet.ToFrozenSet(
|
||||
[
|
||||
11301U, 11302U, 11306U, 12301U, 12302U, 12305U, 13303U, 14301U, 14302U, 14304U, 15301U, 15302U, 15304U
|
||||
]);
|
||||
|
||||
private static readonly FrozenSet<uint> PurpleStandardWeaponIdsSet = FrozenSet.ToFrozenSet(
|
||||
[
|
||||
11401U, 11402U, 11403U, 11405U, 12401U, 12402U, 12403U, 12405U, 13401U, 13407U, 14401U, 14402U, 14403U, 14409U, 15401U, 15402U, 15403U, 15405U
|
||||
]);
|
||||
|
||||
private readonly IMetadataService metadataService;
|
||||
private readonly HomaGachaLogClient homaGachaLogClient;
|
||||
private readonly ITaskContext taskContext;
|
||||
@@ -33,7 +45,7 @@ internal sealed partial class GachaStatisticsFactory : IGachaStatisticsFactory
|
||||
await taskContext.SwitchToBackgroundAsync();
|
||||
|
||||
List<HistoryWishBuilder> historyWishBuilders = context.GachaEvents.SelectList(gachaEvent => new HistoryWishBuilder(gachaEvent, context));
|
||||
return CreateCore(taskContext, homaGachaLogClient, items, historyWishBuilders, context, options.IsEmptyHistoryWishVisible);
|
||||
return CreateCore(taskContext, homaGachaLogClient, items, historyWishBuilders, context, options.IsEmptyHistoryWishVisible, options.IsNeverHeldStatisticsItemVisible);
|
||||
}
|
||||
|
||||
private static GachaStatistics CreateCore(
|
||||
@@ -42,7 +54,8 @@ internal sealed partial class GachaStatisticsFactory : IGachaStatisticsFactory
|
||||
List<Model.Entity.GachaItem> items,
|
||||
List<HistoryWishBuilder> historyWishBuilders,
|
||||
in GachaLogServiceMetadataContext context,
|
||||
bool isEmptyHistoryWishVisible)
|
||||
bool isEmptyHistoryWishVisible,
|
||||
bool isNeverHeldStatisticsItemVisible)
|
||||
{
|
||||
TypedWishSummaryBuilderContext standardContext = TypedWishSummaryBuilderContext.StandardWish(taskContext, gachaLogClient);
|
||||
TypedWishSummaryBuilder standardWishBuilder = new(standardContext);
|
||||
@@ -62,6 +75,45 @@ internal sealed partial class GachaStatisticsFactory : IGachaStatisticsFactory
|
||||
Dictionary<Weapon, int> purpleWeaponCounter = [];
|
||||
Dictionary<Weapon, int> blueWeaponCounter = [];
|
||||
|
||||
if (isNeverHeldStatisticsItemVisible)
|
||||
{
|
||||
orangeAvatarCounter = context.IdAvatarMap.Values
|
||||
.Where(avatar => avatar.Quality == QualityType.QUALITY_ORANGE)
|
||||
.ToDictionary(avatar => avatar, _ => 0);
|
||||
purpleAvatarCounter = context.IdAvatarMap.Values
|
||||
.Where(avatar => avatar.Quality == QualityType.QUALITY_PURPLE)
|
||||
.ToDictionary(avatar => avatar, _ => 0);
|
||||
orangeWeaponCounter = context.IdWeaponMap.Values
|
||||
.Where(weapon => weapon.Quality == QualityType.QUALITY_ORANGE)
|
||||
.ToDictionary(weapon => weapon, _ => 0);
|
||||
|
||||
HashSet<Weapon> purpleWeapons = [];
|
||||
foreach (uint weaponId in PurpleStandardWeaponIdsSet)
|
||||
{
|
||||
purpleWeapons.Add(context.IdWeaponMap[weaponId]);
|
||||
}
|
||||
|
||||
foreach (GachaEvent gachaEvent in context.GachaEvents)
|
||||
{
|
||||
if (gachaEvent.Type is GachaType.ActivityWeapon)
|
||||
{
|
||||
foreach (uint weaponId in gachaEvent.UpPurpleList)
|
||||
{
|
||||
purpleWeapons.Add(context.IdWeaponMap[weaponId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HashSet<Weapon> blueWeapons = [];
|
||||
foreach (uint weaponId in BlueStandardWeaponIdsSet)
|
||||
{
|
||||
blueWeapons.Add(context.IdWeaponMap[weaponId]);
|
||||
}
|
||||
|
||||
purpleWeaponCounter = purpleWeapons.ToDictionary(weapon => weapon, _ => 0);
|
||||
blueWeaponCounter = blueWeapons.ToDictionary(weapon => weapon, _ => 0);
|
||||
}
|
||||
|
||||
// Pre group builders
|
||||
Dictionary<GachaType, List<HistoryWishBuilder>> historyWishBuilderMap = historyWishBuilders
|
||||
.GroupBy(b => b.ConfigType)
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cw="using:CommunityToolkit.WinUI"
|
||||
xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:cwcont="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:cwconv="using:CommunityToolkit.WinUI.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
|
||||
@@ -24,6 +25,11 @@
|
||||
</mxi:Interaction.Behaviors>
|
||||
|
||||
<Page.Resources>
|
||||
<cwconv:DoubleToObjectConverter x:Key="DoubleToOpacityConverter" GreaterThan="0">
|
||||
<cwconv:DoubleToObjectConverter.TrueValue>1.0</cwconv:DoubleToObjectConverter.TrueValue>
|
||||
<cwconv:DoubleToObjectConverter.FalseValue>0.4</cwconv:DoubleToObjectConverter.FalseValue>
|
||||
</cwconv:DoubleToObjectConverter>
|
||||
|
||||
<Flyout x:Key="HutaoCloudFlyout">
|
||||
<Grid>
|
||||
<mxi:Interaction.Behaviors>
|
||||
@@ -120,12 +126,12 @@
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||
Text="{shcm:ResourceString Name=ViewPageGachaLogHutaoCloudNotAllowed}"
|
||||
TextAlignment="Center"/>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
Command="{Binding HutaoCloudViewModel.NavigateToSpiralAbyssRecordCommand}"
|
||||
Description="{shcm:ResourceString Name=ViewPageGachaLogHutaoCloudSpiralAbyssActivityDescription}"
|
||||
Header="{shcm:ResourceString Name=ViewPageGachaLogHutaoCloudSpiralAbyssActivityHeader}"
|
||||
IsClickEnabled="True"/>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
Command="{Binding HutaoCloudViewModel.NavigateToAfdianSkuCommand}"
|
||||
Description="{shcm:ResourceString Name=ViewPageGachaLogHutaoCloudAfdianPurchaseDescription}"
|
||||
Header="{shcm:ResourceString Name=ViewPageGachaLogHutaoCloudAfdianPurchaseHeader}"
|
||||
@@ -210,6 +216,7 @@
|
||||
<shvc:ItemIcon
|
||||
Badge="{Binding Badge}"
|
||||
Icon="{Binding Icon}"
|
||||
Opacity="{Binding Count, Converter={StaticResource DoubleToOpacityConverter}}"
|
||||
Quality="{Binding Quality}"/>
|
||||
<Border
|
||||
HorizontalAlignment="Right"
|
||||
@@ -328,14 +335,14 @@
|
||||
HorizontalAlignment="Left"
|
||||
cw:Effects.Shadow="{ThemeResource CompatCardShadow}">
|
||||
<Grid HorizontalAlignment="Center" Style="{StaticResource GridCardStyle}">
|
||||
<cwc:ConstrainedBox AspectRatio="1080:533">
|
||||
<cwcont:ConstrainedBox AspectRatio="1080:533">
|
||||
<shci:CachedImage
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="{ThemeResource ControlCornerRadius}"
|
||||
Source="{Binding SelectedHistoryWish.BannerImage}"
|
||||
Stretch="UniformToFill"/>
|
||||
</cwc:ConstrainedBox>
|
||||
</cwcont:ConstrainedBox>
|
||||
<Border Grid.ColumnSpan="2" Background="{ThemeResource DarkOnlyOverlayMaskColorBrush}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
@@ -507,35 +514,35 @@
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||
Text="{shcm:ResourceString Name=ViewPageGachaLogHint}"/>
|
||||
<StackPanel Margin="0,24,0,0" Spacing="{StaticResource SettingsCardSpacing}">
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
ActionIconToolTip="{shcm:ResourceString Name=ViewPageGachaLogRefreshAction}"
|
||||
Command="{Binding RefreshBySTokenCommand}"
|
||||
Description="{shcm:ResourceString Name=ViewPageGachaLogRefreshBySTokenDescription}"
|
||||
Header="{shcm:ResourceString Name=ViewPageGachaLogRefreshBySToken}"
|
||||
HeaderIcon="{shcm:FontIcon Glyph=}"
|
||||
IsClickEnabled="True"/>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
ActionIconToolTip="{shcm:ResourceString Name=ViewPageGachaLogRefreshAction}"
|
||||
Command="{Binding RefreshByWebCacheCommand}"
|
||||
Description="{shcm:ResourceString Name=ViewPageGachaLogRefreshByWebCacheDescription}"
|
||||
Header="{shcm:ResourceString Name=ViewPageGachaLogRefreshByWebCache}"
|
||||
HeaderIcon="{shcm:FontIcon Glyph=}"
|
||||
IsClickEnabled="True"/>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
ActionIconToolTip="{shcm:ResourceString Name=ViewPageGachaLogInputAction}"
|
||||
Command="{Binding RefreshByManualInputCommand}"
|
||||
Description="{shcm:ResourceString Name=ViewPageGachaLogRefreshByManualInputDescription}"
|
||||
Header="{shcm:ResourceString Name=ViewPageGachaLogRefreshByManualInput}"
|
||||
HeaderIcon="{shcm:FontIcon Glyph=}"
|
||||
IsClickEnabled="True"/>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
ActionIconToolTip="{shcm:ResourceString Name=ViewPageGachaLogImportAction}"
|
||||
Command="{Binding ImportFromUIGFJsonCommand}"
|
||||
Description="{shcm:ResourceString Name=ViewPageGachaLogImportDescription}"
|
||||
Header="{shcm:ResourceString Name=ViewPageGachaLogImportHeader}"
|
||||
HeaderIcon="{shcm:FontIcon Glyph=}"
|
||||
IsClickEnabled="True"/>
|
||||
<cwc:SettingsCard
|
||||
<cwcont:SettingsCard
|
||||
Description="{shcm:ResourceString Name=ViewPageGachaLogRecoverFromHutaoCloudDescription}"
|
||||
FlyoutBase.AttachedFlyout="{StaticResource HutaoCloudFlyout}"
|
||||
Header="{shcm:ResourceString Name=ViewPageGachaLogHutaoCloud}"
|
||||
@@ -546,7 +553,7 @@
|
||||
<shcb:ShowAttachedFlyoutAction/>
|
||||
</mxic:EventTriggerBehavior>
|
||||
</mxi:Interaction.Behaviors>
|
||||
</cwc:SettingsCard>
|
||||
</cwcont:SettingsCard>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@@ -559,6 +559,15 @@
|
||||
OffContent="{shcm:ResourceString Name=ViewPageSettingEmptyHistoryVisibleOff}"
|
||||
OnContent="{shcm:ResourceString Name=ViewPageSettingEmptyHistoryVisibleOn}"/>
|
||||
</cwc:SettingsCard>
|
||||
<cwc:SettingsCard
|
||||
Description="{shcm:ResourceString Name=ViewPageSettingNeverHeldItemVisibleDescription}"
|
||||
Header="{shcm:ResourceString Name=ViewPageSettingNeverHeldItemVisibleHeader}"
|
||||
HeaderIcon="{shcm:FontIcon Glyph=}">
|
||||
<ToggleSwitch
|
||||
IsOn="{Binding AppOptions.IsNeverHeldStatisticsItemVisible, Mode=TwoWay}"
|
||||
OffContent="{shcm:ResourceString Name=ViewPageSettingEmptyHistoryVisibleOff}"
|
||||
OnContent="{shcm:ResourceString Name=ViewPageSettingEmptyHistoryVisibleOn}"/>
|
||||
</cwc:SettingsCard>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
Reference in New Issue
Block a user