Skip to content

Commit d9cf28b

Browse files
committed
修复颂愿的某些展示问题
1 parent 682640f commit d9cf28b

File tree

13 files changed

+518
-52
lines changed

13 files changed

+518
-52
lines changed

src/Snap.Hutao.Remastered/Snap.Hutao.Remastered/Model/Metadata/Item/BeyondItem.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Snap.Hutao.Remastered.Model.Intrinsic;
22
using Snap.Hutao.Remastered.Model.Metadata.Abstraction;
3+
using Snap.Hutao.Remastered.Model.Metadata.Avatar;
34
using Snap.Hutao.Remastered.Model.Metadata.Converter;
45
using Snap.Hutao.Remastered.Model.Primitive;
56
using Snap.Hutao.Remastered.ViewModel.GachaLog;
@@ -9,15 +10,16 @@ namespace Snap.Hutao.Remastered.Model.Metadata.Item;
910
public partial class BeyondItem :
1011
IDefaultIdentity<BeyondItemId>,
1112
ISummaryItemConvertible,
12-
IStatisticsItemConvertible
13+
IStatisticsItemConvertible,
14+
IItemConvertible
1315
{
1416
public required BeyondItemId Id { get; init; }
1517

1618
public required QualityType RankLevel { get; init; }
1719

18-
public string? Icon { get; set; }
20+
public string Icon { get; set; } = string.Empty;
1921

20-
public string? Name { get; set; }
22+
public string Name { get; set; } = string.Empty;
2123

2224
public string? Description { get; set; }
2325

@@ -55,4 +57,17 @@ public StatisticsItem ToStatisticsItem(int count)
5557
Count = count,
5658
};
5759
}
60+
61+
public TItem ToItem<TItem>()
62+
where TItem : Model.Item, new()
63+
{
64+
return new()
65+
{
66+
Id = Id,
67+
Name = Name,
68+
Icon = BeyondItemNameIconConverter.IconNameToUri(Icon),
69+
Badge = BeyondItemNameIconConverter.IconNameToUri(Icon),
70+
Quality = Quality,
71+
};
72+
}
5873
}

src/Snap.Hutao.Remastered/Snap.Hutao.Remastered/Resource/Localization/SH.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@
228228
<data name="ModelBindingGachaTypedWishSummaryAveragePull" xml:space="preserve">
229229
<value>{0:f2} 抽</value>
230230
</data>
231+
<data name="ViewControlStatisticsCardToLastBlueText" xml:space="preserve">
232+
<value>距上个三星</value>
233+
</data>
231234
<data name="ModelBindingGachaTypedWishSummaryMaxOrangePull" xml:space="preserve">
232235
<value>最非 {0} 抽</value>
233236
</data>

src/Snap.Hutao.Remastered/Snap.Hutao.Remastered/Service/GachaLog/BeyondGachaLogFetchContext.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
using Snap.Hutao.Remastered.Core.Database;
55
using Snap.Hutao.Remastered.Model.Entity;
6+
using Snap.Hutao.Remastered.Model.Metadata.Abstraction;
67
using Snap.Hutao.Remastered.Service.GachaLog.QueryProvider;
8+
using Snap.Hutao.Remastered.Service.Metadata.ContextAbstraction;
79
using Snap.Hutao.Remastered.Web.Hoyolab.Hk4e.Event.GachaInfo;
810
using System.Collections.Immutable;
911

@@ -72,8 +74,7 @@ public void AddItem(BeyondGachaLogItem item)
7274
{
7375
ArgumentNullException.ThrowIfNull(TargetArchive);
7476
ItemsToAdd.Add(BeyondGachaItem.From(TargetArchive.InnerId, item));
75-
// For beyond gacha items, we don't have a direct way to get the item from serviceContext
76-
// So we'll add a placeholder item or skip adding to status
77+
Status.Items.Add(serviceContext.GetBeyondItem(uint.Parse(item.ItemId)).GetOrCreateItem());
7778
TypedQueryOptions.EndId = item.Id;
7879
}
7980

src/Snap.Hutao.Remastered/Snap.Hutao.Remastered/Service/GachaLog/Factory/TypedWishSummaryBuilder.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@ public TypedWishSummary ToTypedWishSummary(AsyncBarrier barrier)
184184
LastOrangePull = lastOrangePullTracker,
185185
GuaranteeOrangeThreshold = context.GuaranteeOrangeThreshold,
186186
LastPurplePull = lastPurplePullTracker,
187+
LastBluePull = lastBluePullTracker,
187188
GuaranteePurpleThreshold = context.GuaranteePurpleThreshold,
189+
GuaranteeBlueThreshold = context.GuaranteeBlueThreshold,
188190
TotalOrangePull = totalOrangePullTracker,
189191
TotalPurplePull = totalPurplePullTracker,
190192
TotalBluePull = totalBluePullTracker,

src/Snap.Hutao.Remastered/Snap.Hutao.Remastered/Service/GachaLog/Factory/TypedWishSummaryBuilderContext.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public readonly struct TypedWishSummaryBuilderContext
1515
public readonly string Name;
1616
public readonly int GuaranteeOrangeThreshold;
1717
public readonly int GuaranteePurpleThreshold;
18+
public readonly int GuaranteeBlueThreshold;
1819
public readonly Func<GachaType, bool> TypeEvaluator;
1920
public readonly GachaDistributionType DistributionType;
2021
public readonly bool SummarizePurple;
@@ -32,6 +33,7 @@ public TypedWishSummaryBuilderContext(
3233
string name,
3334
int guaranteeOrangeThreshold,
3435
int guaranteePurpleThreshold,
36+
int guaranteeBlueThreshold,
3537
Func<GachaType, bool> typeEvaluator,
3638
GachaDistributionType distributionType,
3739
bool summarizePurple = false,
@@ -42,6 +44,7 @@ public TypedWishSummaryBuilderContext(
4244
Name = name;
4345
GuaranteeOrangeThreshold = guaranteeOrangeThreshold;
4446
GuaranteePurpleThreshold = guaranteePurpleThreshold;
47+
GuaranteeBlueThreshold = guaranteeBlueThreshold;
4548
TypeEvaluator = typeEvaluator;
4649
DistributionType = distributionType;
4750
SummarizePurple = summarizePurple;
@@ -50,32 +53,32 @@ public TypedWishSummaryBuilderContext(
5053

5154
public static TypedWishSummaryBuilderContext StandardWish(GachaStatisticsFactoryContext context)
5255
{
53-
return new(context.ServiceProvider, SH.ServiceGachaLogFactoryPermanentWishName, 90, 10, IsStandardWish, GachaDistributionType.Standard);
56+
return new(context.ServiceProvider, SH.ServiceGachaLogFactoryPermanentWishName, 90, 10, 0, IsStandardWish, GachaDistributionType.Standard);
5457
}
5558

5659
public static TypedWishSummaryBuilderContext AvatarEventWish(GachaStatisticsFactoryContext context)
5760
{
58-
return new(context.ServiceProvider, SH.ServiceGachaLogFactoryAvatarWishName, 90, 10, IsAvatarEventWish, GachaDistributionType.AvatarEvent);
61+
return new(context.ServiceProvider, SH.ServiceGachaLogFactoryAvatarWishName, 90, 10, 0, IsAvatarEventWish, GachaDistributionType.AvatarEvent);
5962
}
6063

6164
public static TypedWishSummaryBuilderContext WeaponEventWish(GachaStatisticsFactoryContext context)
6265
{
63-
return new(context.ServiceProvider, SH.ServiceGachaLogFactoryWeaponWishName, 80, 10, IsWeaponEventWish, GachaDistributionType.WeaponEvent);
66+
return new(context.ServiceProvider, SH.ServiceGachaLogFactoryWeaponWishName, 80, 10, 0, IsWeaponEventWish, GachaDistributionType.WeaponEvent);
6467
}
6568

6669
public static TypedWishSummaryBuilderContext ChronicledWish(GachaStatisticsFactoryContext context)
6770
{
68-
return new(context.ServiceProvider, SH.ServiceGachaLogFactoryChronicledWishName, 90, 10, IsChronicledWish, GachaDistributionType.Chronicled);
71+
return new(context.ServiceProvider, SH.ServiceGachaLogFactoryChronicledWishName, 90, 10, 0, IsChronicledWish, GachaDistributionType.Chronicled);
6972
}
7073

7174
public static TypedWishSummaryBuilderContext BeyondStandardWish(GachaStatisticsFactoryContext context)
7275
{
73-
return new(context.ServiceProvider, SH.ServiceGachaLogFactoryBeyondPermanentWishName, int.MaxValue, 70, IsBeyondStandardWish, GachaDistributionType.BeyondStandard, true, true);
76+
return new(context.ServiceProvider, SH.ServiceGachaLogFactoryBeyondPermanentWishName, int.MaxValue, 90, 10, IsBeyondStandardWish, GachaDistributionType.BeyondStandard, true, true);
7477
}
7578

7679
public static TypedWishSummaryBuilderContext BeyondEventWish(GachaStatisticsFactoryContext context)
7780
{
78-
return new(context.ServiceProvider, SH.ServiceGachaLogFactoryBeyondEventWishName, 90, 10, IsBeyondEventWish, GachaDistributionType.BeyondEvent, true);
81+
return new(context.ServiceProvider, SH.ServiceGachaLogFactoryBeyondEventWishName, 90, 10, 0, IsBeyondEventWish, GachaDistributionType.BeyondEvent, true);
7982
}
8083

8184
public TypedWishSummaryBuilder CreateBuilder()

src/Snap.Hutao.Remastered/Snap.Hutao.Remastered/Snap.Hutao.Remastered.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,5 +317,8 @@
317317
<None Update="Snap.Hutao.Remastered.Deployment.exe">
318318
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
319319
</None>
320+
<Page Update="UI\Xaml\View\Specialized\BeyondStandardStatisticsCard.xaml">
321+
<Generator>MSBuild:Compile</Generator>
322+
</Page>
320323
</ItemGroup>
321324
</Project>

src/Snap.Hutao.Remastered/Snap.Hutao.Remastered/UI/Xaml/View/Page/GachaLogPage.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,9 @@
444444
DataContext="{Binding Statistics.ChronicledWish}"
445445
ShowUpPull="False"
446446
Visibility="{Binding DataContext.IsBeyondMode, ElementName=RootPage, Converter={StaticResource BoolNegationToVisibilityConverter}}"/>
447-
<shuxvs:StatisticsCard
447+
<shuxvs:BeyondStatisticsCard
448448
DataContext="{Binding Statistics.BeyondStandardWish}"
449449
Visibility="{Binding DataContext.IsBeyondMode, ElementName=RootPage, Converter={StaticResource BoolToVisibilityConverter}}"
450-
ShowOrange="False"
451450
ShowUpPull="False"/>
452451
<shuxvs:StatisticsCard
453452
DataContext="{Binding Statistics.BeyondEventWish}"

0 commit comments

Comments
 (0)