mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix #460
This commit is contained in:
@@ -21,7 +21,7 @@ public class GachaStatistics
|
||||
/// <summary>
|
||||
/// 奔行世间
|
||||
/// </summary>
|
||||
public TypedWishSummary PermanentWish { get; set; } = default!;
|
||||
public TypedWishSummary StandardWish { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 历史卡池
|
||||
|
||||
@@ -17,7 +17,7 @@ public class GachaConfigTypeComparar : IComparer<GachaConfigType>
|
||||
{ GachaConfigType.AvatarEventWish, 0 },
|
||||
{ GachaConfigType.AvatarEventWish2, 1 },
|
||||
{ GachaConfigType.WeaponEventWish, 2 },
|
||||
{ GachaConfigType.PermanentWish, 3 },
|
||||
{ GachaConfigType.StandardWish, 3 },
|
||||
{ GachaConfigType.NoviceWish, 4 },
|
||||
}.ToImmutableDictionary();
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ internal class GachaStatisticsFactory : IGachaStatisticsFactory
|
||||
Dictionary<WeaponId, Weapon> weaponMap,
|
||||
bool isEmptyHistoryWishVisible)
|
||||
{
|
||||
TypedWishSummaryBuilder permanentWishBuilder = new(SH.ServiceGachaLogFactoryPermanentWishName, TypedWishSummaryBuilder.IsPermanentWish, 90, 10);
|
||||
TypedWishSummaryBuilder standardWishBuilder = new(SH.ServiceGachaLogFactoryPermanentWishName, TypedWishSummaryBuilder.IsPermanentWish, 90, 10);
|
||||
TypedWishSummaryBuilder avatarWishBuilder = new(SH.ServiceGachaLogFactoryAvatarWishName, TypedWishSummaryBuilder.IsAvatarEventWish, 90, 10);
|
||||
TypedWishSummaryBuilder weaponWishBuilder = new(SH.ServiceGachaLogFactoryWeaponWishName, TypedWishSummaryBuilder.IsWeaponEventWish, 80, 10);
|
||||
|
||||
@@ -103,7 +103,7 @@ internal class GachaStatisticsFactory : IGachaStatisticsFactory
|
||||
break;
|
||||
}
|
||||
|
||||
permanentWishBuilder.Track(item, avatar, isUp);
|
||||
standardWishBuilder.Track(item, avatar, isUp);
|
||||
avatarWishBuilder.Track(item, avatar, isUp);
|
||||
weaponWishBuilder.Track(item, avatar, isUp);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ internal class GachaStatisticsFactory : IGachaStatisticsFactory
|
||||
break;
|
||||
}
|
||||
|
||||
permanentWishBuilder.Track(item, weapon, isUp);
|
||||
standardWishBuilder.Track(item, weapon, isUp);
|
||||
avatarWishBuilder.Track(item, weapon, isUp);
|
||||
weaponWishBuilder.Track(item, weapon, isUp);
|
||||
}
|
||||
@@ -162,7 +162,7 @@ internal class GachaStatisticsFactory : IGachaStatisticsFactory
|
||||
BlueWeapons = blueWeaponCounter.ToStatisticsList(),
|
||||
|
||||
// typed wish summary
|
||||
PermanentWish = permanentWishBuilder.ToTypedWishSummary(),
|
||||
StandardWish = standardWishBuilder.ToTypedWishSummary(),
|
||||
AvatarWish = avatarWishBuilder.ToTypedWishSummary(),
|
||||
WeaponWish = weaponWishBuilder.ToTypedWishSummary(),
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ internal class TypedWishSummaryBuilder
|
||||
/// <summary>
|
||||
/// 常驻祈愿
|
||||
/// </summary>
|
||||
public static readonly Func<GachaConfigType, bool> IsPermanentWish = type => type is GachaConfigType.PermanentWish;
|
||||
public static readonly Func<GachaConfigType, bool> IsPermanentWish = type => type is GachaConfigType.StandardWish;
|
||||
|
||||
/// <summary>
|
||||
/// 角色活动
|
||||
|
||||
@@ -39,7 +39,7 @@ internal class GachaLogService : IGachaLogService
|
||||
private static readonly ImmutableList<GachaConfigType> QueryTypes = new List<GachaConfigType>
|
||||
{
|
||||
GachaConfigType.NoviceWish,
|
||||
GachaConfigType.PermanentWish,
|
||||
GachaConfigType.StandardWish,
|
||||
GachaConfigType.AvatarEventWish,
|
||||
GachaConfigType.WeaponEventWish,
|
||||
}.ToImmutableList();
|
||||
@@ -193,7 +193,7 @@ internal class GachaLogService : IGachaLogService
|
||||
|
||||
GachaArchive? archive = null;
|
||||
SkipOrInitArchive(ref archive, uid);
|
||||
Guid archiveId = Must.NotNull(archive!).InnerId;
|
||||
Guid archiveId = archive.InnerId;
|
||||
|
||||
long trimId = appDbContext.GachaItems
|
||||
.Where(i => i.ArchiveId == archiveId)
|
||||
|
||||
@@ -288,11 +288,16 @@
|
||||
Text="{Binding AverageOrangePullFormatted}"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,2,0,0">
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{shcm:ResourceString Name=ViewControlStatisticsCardUpAveragePullText}"/>
|
||||
<TextBlock/>
|
||||
<TextBlock
|
||||
Style="{StaticResource BodyTextBlockStyle}"
|
||||
Text="{shcm:ResourceString Name=ViewControlStatisticsCardUpAveragePullText}"
|
||||
Visibility="{x:Bind ShowUpPull, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
<TextBlock
|
||||
HorizontalAlignment="Right"
|
||||
Style="{StaticResource BodyTextBlockStyle}"
|
||||
Text="{Binding AverageUpOrangePullFormatted}"/>
|
||||
Text="{Binding AverageUpOrangePullFormatted}"
|
||||
Visibility="{x:Bind ShowUpPull, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,2,0,0">
|
||||
<TextBlock
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Snap.Hutao.Control;
|
||||
|
||||
namespace Snap.Hutao.View.Control;
|
||||
|
||||
@@ -10,6 +12,8 @@ namespace Snap.Hutao.View.Control;
|
||||
/// </summary>
|
||||
public sealed partial class StatisticsCard : UserControl
|
||||
{
|
||||
private static readonly DependencyProperty ShowUpPullProperty = Property<StatisticsCard>.Depend(nameof(ShowUpPull), true);
|
||||
|
||||
/// <summary>
|
||||
/// 构造一个新的统计卡片
|
||||
/// </summary>
|
||||
@@ -17,4 +21,13 @@ public sealed partial class StatisticsCard : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示Up抽数
|
||||
/// </summary>
|
||||
public bool ShowUpPull
|
||||
{
|
||||
get { return (bool)GetValue(ShowUpPullProperty); }
|
||||
set { SetValue(ShowUpPullProperty, value); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,13 +51,16 @@ public sealed partial class AdoptCalculatorDialog : ContentDialog
|
||||
|
||||
coreWebView2.SetCookie(user.CookieToken, user.Ltoken, null).SetMobileUserAgent();
|
||||
jsInterface = new(coreWebView2, scope.ServiceProvider);
|
||||
jsInterface.ClosePageRequested += OnClosePageRequested;
|
||||
|
||||
#if DEBUG
|
||||
coreWebView2.OpenDevToolsWindow();
|
||||
#endif
|
||||
coreWebView2.Navigate($"http://webstatic.mihoyo.com/ys/event/e20200923adopt_calculator/index.html?bbs_presentation_style=fullscreen&bbs_auth_required=true&&utm_source=bbs&utm_medium=mys&utm_campaign=GameRecord");
|
||||
}
|
||||
|
||||
private void OnClosePageRequested()
|
||||
{
|
||||
ThreadHelper.InvokeOnMainThread(Hide);
|
||||
}
|
||||
|
||||
private void OnContentDialogClosed(ContentDialog sender, ContentDialogClosedEventArgs args)
|
||||
{
|
||||
jsInterface = null;
|
||||
|
||||
@@ -102,7 +102,8 @@
|
||||
<shvc:StatisticsCard
|
||||
Grid.Column="2"
|
||||
Margin="16,16,0,16"
|
||||
DataContext="{Binding Statistics.PermanentWish}"/>
|
||||
DataContext="{Binding Statistics.StandardWish}"
|
||||
ShowUpPull="False"/>
|
||||
</Grid>
|
||||
</PivotItem>
|
||||
<PivotItem Header="{shcm:ResourceString Name=ViewPageGahcaLogPivotHistory}">
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource HyperlinkButtonStyle}" TargetType="HyperlinkButton">
|
||||
<Setter Property="MinWidth" Value="160"/>
|
||||
<Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}"/>
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource DefaultComboBoxStyle}" TargetType="ComboBox">
|
||||
<Setter Property="MinWidth" Value="160"/>
|
||||
|
||||
@@ -22,7 +22,7 @@ public enum GachaConfigType
|
||||
/// </summary>
|
||||
[Description("常驻祈愿")]
|
||||
[LocalizationKey("WebGachaConfigTypePermanentWish")]
|
||||
PermanentWish = 200,
|
||||
StandardWish = 200,
|
||||
|
||||
/// <summary>
|
||||
/// 角色1池
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
using Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient;
|
||||
using Snap.Hutao.Model.Binding.User;
|
||||
using Snap.Hutao.Web.Hoyolab.Annotation;
|
||||
using Snap.Hutao.Web.Response;
|
||||
using System.Net.Http;
|
||||
|
||||
@@ -38,10 +39,12 @@ internal class CalculateClient
|
||||
/// <param name="delta">差异</param>
|
||||
/// <param name="token">取消令牌</param>
|
||||
/// <returns>消耗结果</returns>
|
||||
[ApiInformation(Cookie = CookieType.Cookie)]
|
||||
public async Task<Response<Consumption>> ComputeAsync(Model.Entity.User user, AvatarPromotionDelta delta, CancellationToken token = default)
|
||||
{
|
||||
Response<Consumption>? resp = await httpClient
|
||||
.SetUser(user, CookieType.CookieToken)
|
||||
.SetUser(user, CookieType.Cookie)
|
||||
.SetReferer("https://webstatic.mihoyo.com/")
|
||||
.TryCatchPostAsJsonAsync<AvatarPromotionDelta, Response<Consumption>>(ApiEndpoints.CalculateCompute, delta, options, logger, token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user