mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
Compare commits
1 Commits
refactor/h
...
fix/chroni
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
544a2d7c6a |
@@ -19,7 +19,7 @@ internal sealed class HutaoStatisticsFactory
|
||||
private readonly GachaEvent avatarEvent;
|
||||
private readonly GachaEvent avatarEvent2;
|
||||
private readonly GachaEvent weaponEvent;
|
||||
private readonly GachaEvent chronicledEvent;
|
||||
private readonly GachaEvent? chronicledEvent;
|
||||
|
||||
public HutaoStatisticsFactory(in HutaoStatisticsFactoryMetadataContext context)
|
||||
{
|
||||
@@ -32,7 +32,7 @@ internal sealed class HutaoStatisticsFactory
|
||||
avatarEvent = context.GachaEvents.Single(g => g.From < now && g.To > now && g.Type == GachaType.ActivityAvatar);
|
||||
avatarEvent2 = context.GachaEvents.Single(g => g.From < now && g.To > now && g.Type == GachaType.SpecialActivityAvatar);
|
||||
weaponEvent = context.GachaEvents.Single(g => g.From < now && g.To > now && g.Type == GachaType.ActivityWeapon);
|
||||
chronicledEvent = context.GachaEvents.Single(g => g.From < now && g.To > now && g.Type == GachaType.ActivityCity);
|
||||
chronicledEvent = context.GachaEvents.SingleOrDefault(g => g.From < now && g.To > now && g.Type == GachaType.ActivityCity);
|
||||
}
|
||||
|
||||
public HutaoStatistics Create(GachaEventStatistics raw)
|
||||
@@ -42,7 +42,7 @@ internal sealed class HutaoStatisticsFactory
|
||||
AvatarEvent = CreateWishSummary(avatarEvent, raw.AvatarEvent),
|
||||
AvatarEvent2 = CreateWishSummary(avatarEvent2, raw.AvatarEvent2),
|
||||
WeaponEvent = CreateWishSummary(weaponEvent, raw.WeaponEvent),
|
||||
Chronicled = CreateWishSummary(chronicledEvent, raw.Chronicled),
|
||||
Chronicled = chronicledEvent is null ? null : CreateWishSummary(chronicledEvent, raw.Chronicled),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -151,6 +151,7 @@
|
||||
<None Remove="View\Control\DescParamComboBox.xaml" />
|
||||
<None Remove="View\Control\Elevation.xaml" />
|
||||
<None Remove="View\Control\HutaoStatisticsCard.xaml" />
|
||||
<None Remove="View\Control\HutaoStatisticsPanel.xaml" />
|
||||
<None Remove="View\Control\ItemIcon.xaml" />
|
||||
<None Remove="View\Control\LaunchGameResourceExpander.xaml" />
|
||||
<None Remove="View\Control\LoadingView.xaml" />
|
||||
@@ -350,6 +351,11 @@
|
||||
<ItemGroup>
|
||||
<None Include="..\.editorconfig" Link=".editorconfig" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="View\Control\HutaoStatisticsPanel.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="View\Dialog\LaunchGameConfigurationFixDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<shcp:HorizontalEqualPanel
|
||||
x:Class="Snap.Hutao.View.Control.HutaoStatisticsPanel"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:shcp="using:Snap.Hutao.Control.Panel"
|
||||
xmlns:shvc="using:Snap.Hutao.View.Control"
|
||||
mc:Ignorable="d">
|
||||
<shvc:HutaoStatisticsCard DataContext="{x:Bind Statistics.AvatarEvent}"/>
|
||||
<shvc:HutaoStatisticsCard DataContext="{x:Bind Statistics.AvatarEvent2}"/>
|
||||
<shvc:HutaoStatisticsCard DataContext="{x:Bind Statistics.WeaponEvent}"/>
|
||||
</shcp:HorizontalEqualPanel>
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.UI.Xaml;
|
||||
using Snap.Hutao.Control.Panel;
|
||||
using Snap.Hutao.ViewModel.GachaLog;
|
||||
|
||||
namespace Snap.Hutao.View.Control;
|
||||
|
||||
[DependencyProperty("Statistics", typeof(HutaoStatistics), default, nameof(OnStatisticsChanged))]
|
||||
internal sealed partial class HutaoStatisticsPanel : HorizontalEqualPanel
|
||||
{
|
||||
public HutaoStatisticsPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (DataContext is HutaoStatistics statistics && statistics.Chronicled is { } chronicled)
|
||||
{
|
||||
Children.Add(new HutaoStatisticsCard
|
||||
{
|
||||
DataContext = chronicled,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnStatisticsChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
HutaoStatisticsPanel panel = (HutaoStatisticsPanel)obj;
|
||||
|
||||
if (args.NewValue is HutaoStatistics { Chronicled: { } chronicled })
|
||||
{
|
||||
panel.Children.Add(new HutaoStatisticsCard
|
||||
{
|
||||
DataContext = chronicled,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -468,24 +468,15 @@
|
||||
Margin="16"
|
||||
CornerRadius="{ThemeResource ControlCornerRadius}"
|
||||
IsLoading="{Binding HutaoCloudStatisticsViewModel.IsInitialized, Converter={StaticResource BoolNegationConverter}}"/>
|
||||
<Grid
|
||||
<shvc:HutaoStatisticsPanel
|
||||
Margin="16"
|
||||
ColumnSpacing="16"
|
||||
Spacing="16"
|
||||
Statistics="{Binding HutaoCloudStatisticsViewModel.Statistics}"
|
||||
Visibility="{Binding HutaoCloudStatisticsViewModel.IsInitialized, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<mxi:Interaction.Behaviors>
|
||||
<shcb:InvokeCommandOnLoadedBehavior Command="{Binding HutaoCloudStatisticsViewModel.OpenUICommand}"/>
|
||||
</mxi:Interaction.Behaviors>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<shvc:HutaoStatisticsCard Grid.Column="0" DataContext="{Binding HutaoCloudStatisticsViewModel.Statistics.AvatarEvent}"/>
|
||||
<shvc:HutaoStatisticsCard Grid.Column="1" DataContext="{Binding HutaoCloudStatisticsViewModel.Statistics.AvatarEvent2}"/>
|
||||
<shvc:HutaoStatisticsCard Grid.Column="2" DataContext="{Binding HutaoCloudStatisticsViewModel.Statistics.WeaponEvent}"/>
|
||||
<shvc:HutaoStatisticsCard Grid.Column="3" DataContext="{Binding HutaoCloudStatisticsViewModel.Statistics.Chronicled}"/>
|
||||
</Grid>
|
||||
</shvc:HutaoStatisticsPanel>
|
||||
</Grid>
|
||||
</PivotItem>
|
||||
</Pivot>
|
||||
|
||||
@@ -26,5 +26,5 @@ internal sealed class HutaoStatistics
|
||||
/// <summary>
|
||||
/// 集录祈愿
|
||||
/// </summary>
|
||||
public HutaoWishSummary Chronicled { get; set; } = default!;
|
||||
public HutaoWishSummary? Chronicled { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user