mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
Compare commits
2 Commits
fix/minor
...
feat/wikis
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b86783493 | ||
|
|
e3adc2e595 |
@@ -15,7 +15,7 @@
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.2.1" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.2.1" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.1">
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -41,12 +41,14 @@ internal class ScopedPage : Page
|
||||
/// 应当在 InitializeComponent() 前调用
|
||||
/// </summary>
|
||||
/// <typeparam name="TViewModel">视图模型类型</typeparam>
|
||||
protected void InitializeWith<TViewModel>()
|
||||
protected TViewModel InitializeWith<TViewModel>()
|
||||
where TViewModel : class, IViewModel
|
||||
{
|
||||
IViewModel viewModel = currentScope.ServiceProvider.GetRequiredService<TViewModel>();
|
||||
viewModel.CancellationToken = viewCancellationTokenSource.Token;
|
||||
DataContext = viewModel;
|
||||
|
||||
return (TViewModel)viewModel;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -25,7 +25,6 @@ internal static partial class IocHttpClientConfiguration
|
||||
.ConfigurePrimaryHttpMessageHandler((handler, provider) =>
|
||||
{
|
||||
HttpClientHandler clientHandler = (HttpClientHandler)handler;
|
||||
clientHandler.AllowAutoRedirect = true;
|
||||
clientHandler.UseProxy = true;
|
||||
clientHandler.Proxy = provider.GetRequiredService<DynamicHttpProxy>();
|
||||
});
|
||||
|
||||
@@ -41,30 +41,6 @@
|
||||
"Equatable": true,
|
||||
"EqualityOperators": true
|
||||
},
|
||||
{
|
||||
"Name": "FurnitureId",
|
||||
"Documentation": "家具 Id",
|
||||
"Equatable": true,
|
||||
"EqualityOperators": true
|
||||
},
|
||||
{
|
||||
"Name": "FurnitureMakeId",
|
||||
"Documentation": "家具配方 Id",
|
||||
"Equatable": true,
|
||||
"EqualityOperators": true
|
||||
},
|
||||
{
|
||||
"Name": "FurnitureSuiteId",
|
||||
"Documentation": "家具套装 Id",
|
||||
"Equatable": true,
|
||||
"EqualityOperators": true
|
||||
},
|
||||
{
|
||||
"Name": "FurnitureTypeId",
|
||||
"Documentation": "家具分类 Id",
|
||||
"Equatable": true,
|
||||
"EqualityOperators": true
|
||||
},
|
||||
{
|
||||
"Name": "Level",
|
||||
"Documentation": "等级 1 - 90",
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Model.Intrinsic;
|
||||
|
||||
internal enum FurnitureDeploySurfaceType
|
||||
{
|
||||
Ground = 0,
|
||||
Wall = 1,
|
||||
Ceil = 2,
|
||||
StackObjPlane = 3,
|
||||
Door = 4,
|
||||
Chandelier = 5,
|
||||
Floor = 6,
|
||||
WallBody = 7,
|
||||
Carpet = 8,
|
||||
LegoRockery = 9,
|
||||
Stair = 10,
|
||||
NPC = 11,
|
||||
Animal = 12,
|
||||
Apartment = 13,
|
||||
FurnitureSuite = 14,
|
||||
Road = 15,
|
||||
Terrain = 16,
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Model.Intrinsic;
|
||||
|
||||
internal enum FurnitureDeployType
|
||||
{
|
||||
Interior,
|
||||
Exterior,
|
||||
InteriorRoom,
|
||||
InteriorHall,
|
||||
Skybox,
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Model.Intrinsic;
|
||||
|
||||
internal enum GroupRecordType
|
||||
{
|
||||
None,
|
||||
Racing,
|
||||
Balloon,
|
||||
Stake,
|
||||
Seek,
|
||||
Explosion,
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.Model.Intrinsic;
|
||||
|
||||
internal enum SpecialFurnitureType
|
||||
{
|
||||
NormalFurniture,
|
||||
BlockDependent,
|
||||
FarmField,
|
||||
TeleportPoint,
|
||||
Fishpond,
|
||||
Npc,
|
||||
Apartment,
|
||||
FurnitureSuite,
|
||||
Paimon,
|
||||
Fish,
|
||||
CustomBaseFurniture,
|
||||
CustomNodeFurniture,
|
||||
VirtualFurniture,
|
||||
GroupFurniture,
|
||||
CoopPictureFrame,
|
||||
ChangeBgmFurniture,
|
||||
ServerGadget,
|
||||
Fishtank,
|
||||
}
|
||||
@@ -8,4 +8,15 @@ namespace Snap.Hutao.Model.Metadata.Achievement;
|
||||
/// <summary>
|
||||
/// 奖励
|
||||
/// </summary>
|
||||
internal sealed class Reward : IdCount;
|
||||
internal sealed class Reward
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
public MaterialId Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public uint Count { get; set; }
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Primitive;
|
||||
|
||||
namespace Snap.Hutao.Model.Metadata.Furniture;
|
||||
|
||||
internal sealed class Furniture
|
||||
{
|
||||
public List<FurnitureTypeId> Types { get; set; } = default!;
|
||||
|
||||
public FurnitureDeploySurfaceType SurfaceType { get; set; }
|
||||
|
||||
public bool IsSpecial { get; set; }
|
||||
|
||||
public SpecialFurnitureType SpecialType { get; set; }
|
||||
|
||||
public uint Comfort { get; set; }
|
||||
|
||||
public uint Cost { get; set; }
|
||||
|
||||
public uint DiscountCost { get; set; }
|
||||
|
||||
public bool CanFloat { get; set; }
|
||||
|
||||
public bool IsUnique { get; set; }
|
||||
|
||||
public string? ItemIcon { get; set; }
|
||||
|
||||
public string? EffectIcon { get; set; }
|
||||
|
||||
public QualityType RankLevel { get; set; }
|
||||
|
||||
public List<FurnitureId> GruopUnits { get; set; } = default!;
|
||||
|
||||
public GroupRecordType GroupRecordType { get; set; }
|
||||
|
||||
public List<string> SourceTexts { get; set; } = default!;
|
||||
|
||||
public FurnitureId Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = default!;
|
||||
|
||||
public string Description { get; set; } = default!;
|
||||
|
||||
public string? Icon { get; set; }
|
||||
|
||||
public uint Rank { get; set; }
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Primitive;
|
||||
|
||||
namespace Snap.Hutao.Model.Metadata.Furniture;
|
||||
|
||||
internal sealed class FurnitureMake
|
||||
{
|
||||
public FurnitureMakeId Id { get; set; }
|
||||
|
||||
public FurnitureId ItemId { get; set; }
|
||||
|
||||
public uint Experience { get; set; }
|
||||
|
||||
public List<IdCount> Materials { get; set; } = default!;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Primitive;
|
||||
|
||||
namespace Snap.Hutao.Model.Metadata.Furniture;
|
||||
|
||||
internal sealed class FurnitureSuite
|
||||
{
|
||||
public FurnitureSuiteId Id { get; set; }
|
||||
|
||||
public List<FurnitureTypeId> Types { get; set; } = default!;
|
||||
|
||||
public string Name { get; set; } = default!;
|
||||
|
||||
public string Description { get; set; } = default!;
|
||||
|
||||
public string ItemIcon { get; set; } = default!;
|
||||
|
||||
public string? MapIcon { get; set; }
|
||||
|
||||
public List<AvatarId>? FavoriteNpcs { get; set; }
|
||||
|
||||
public List<FurnitureId> Units { get; set; } = default!;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Primitive;
|
||||
|
||||
namespace Snap.Hutao.Model.Metadata.Furniture;
|
||||
|
||||
internal sealed class FurnitureType
|
||||
{
|
||||
public FurnitureTypeId Id { get; set; }
|
||||
|
||||
public uint Category { get; set; }
|
||||
|
||||
public string Name { get; set; } = default!;
|
||||
|
||||
public string Name2 { get; set; } = default!;
|
||||
|
||||
public string TabIcon { get; set; } = default!;
|
||||
|
||||
public FurnitureDeployType SceneType { get; set; }
|
||||
|
||||
public bool BagPageOnly { get; set; }
|
||||
|
||||
public bool IsShowInBag { get; set; }
|
||||
|
||||
public uint Sort { get; set; }
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Primitive;
|
||||
|
||||
namespace Snap.Hutao.Model.Metadata;
|
||||
|
||||
internal class IdCount
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
public MaterialId Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public uint Count { get; set; }
|
||||
}
|
||||
@@ -2895,7 +2895,7 @@
|
||||
<value>〓活动时间〓.*?\d\.\d版本期间持续开放</value>
|
||||
</data>
|
||||
<data name="WebAnnouncementMatchTransientActivityTime" xml:space="preserve">
|
||||
<value>(?:〓活动时间〓|祈愿时间|【上架时间】|〓折扣时间〓).*?(\d\.\d版本更新后).*?~.*?&lt;t class="t_(?:gl|lc)".*?&gt;(.*?)&lt;/t&gt;</value>
|
||||
<value>(?:〓活动时间〓|祈愿时间|【上架时间】).*?(\d\.\d版本更新后).*?~.*?&lt;t class="t_(?:gl|lc)".*?&gt;(.*?)&lt;/t&gt;</value>
|
||||
</data>
|
||||
<data name="WebAnnouncementMatchVersionUpdateTime" xml:space="preserve">
|
||||
<value>〓更新时间〓.+?&lt;t class=\"t_(?:gl|lc)\".*?&gt;(.*?)&lt;/t&gt;</value>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 5.5 KiB |
@@ -85,13 +85,8 @@ internal sealed partial class AnnouncementService : IAnnouncementService
|
||||
{
|
||||
foreach (ref readonly Announcement item in CollectionsMarshal.AsSpan(listWrapper.List))
|
||||
{
|
||||
item.Subtitle = new StringBuilder(item.Subtitle)
|
||||
.Replace("\r<br>", string.Empty)
|
||||
.Replace("<br />", string.Empty)
|
||||
.ToString();
|
||||
item.Content = AnnouncementRegex
|
||||
.XmlTimeTagRegex()
|
||||
.Replace(item.Content, x => x.Groups[1].Value);
|
||||
item.Subtitle = new StringBuilder(item.Subtitle).Replace("\r<br>", string.Empty).ToString();
|
||||
item.Content = AnnouncementRegex.XmlTimeTagRegex().Replace(item.Content, x => x.Groups[1].Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,13 +28,13 @@ internal sealed partial class BackgroundImageService : IBackgroundImageService
|
||||
|
||||
private HashSet<string> currentBackgroundPathSet;
|
||||
|
||||
public async ValueTask<ValueResult<bool, BackgroundImage?>> GetNextBackgroundImageAsync(BackgroundImage? previous)
|
||||
public async ValueTask<ValueResult<bool, BackgroundImage>> GetNextBackgroundImageAsync(BackgroundImage? previous)
|
||||
{
|
||||
HashSet<string> backgroundSet = await SkipOrInitBackgroundAsync().ConfigureAwait(false);
|
||||
|
||||
if (backgroundSet.Count <= 0)
|
||||
{
|
||||
return new(true, default!);
|
||||
return new(false, default!);
|
||||
}
|
||||
|
||||
string path = System.Random.Shared.GetItems([..backgroundSet], 1)[0];
|
||||
@@ -109,9 +109,6 @@ internal sealed partial class BackgroundImageService : IBackgroundImageService
|
||||
case BackgroundImageType.HutaoOfficialLauncher:
|
||||
await SetCurrentBackgroundPathSetAsync(client => client.GetLauncherWallpaperAsync()).ConfigureAwait(false);
|
||||
break;
|
||||
default:
|
||||
currentBackgroundPathSet = [];
|
||||
break;
|
||||
}
|
||||
|
||||
currentBackgroundPathSet ??= [];
|
||||
|
||||
@@ -5,5 +5,5 @@ namespace Snap.Hutao.Service.BackgroundImage;
|
||||
|
||||
internal interface IBackgroundImageService
|
||||
{
|
||||
ValueTask<ValueResult<bool, BackgroundImage?>> GetNextBackgroundImageAsync(BackgroundImage? previous);
|
||||
ValueTask<ValueResult<bool, BackgroundImage>> GetNextBackgroundImageAsync(BackgroundImage? previous);
|
||||
}
|
||||
@@ -41,33 +41,39 @@ internal sealed partial class DiscordService : IDiscordService, IDisposable
|
||||
|
||||
private bool IsSupported()
|
||||
{
|
||||
// Actually requires a discord client to be running on Windows platform.
|
||||
// If not, discord core creation code will throw.
|
||||
Process[] discordProcesses = Process.GetProcessesByName("Discord");
|
||||
|
||||
if (discordProcesses.Length <= 0)
|
||||
try
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Actually requires a discord client to be running on Windows platform.
|
||||
// If not, discord core creation code will throw.
|
||||
Process[] discordProcesses = Process.GetProcessesByName("Discord");
|
||||
|
||||
foreach (Process process in discordProcesses)
|
||||
{
|
||||
try
|
||||
if (discordProcesses.Length <= 0)
|
||||
{
|
||||
_ = process.Handle;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (!isInitialized)
|
||||
{
|
||||
isInitialized = true;
|
||||
infoBarService.Warning(SH.ServiceDiscordActivityElevationRequiredHint);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
foreach (Process process in discordProcesses)
|
||||
{
|
||||
try
|
||||
{
|
||||
_ = process.Handle;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (!isInitialized)
|
||||
{
|
||||
infoBarService.Warning(SH.ServiceDiscordActivityElevationRequiredHint);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
isInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,15 +23,8 @@ internal sealed class LaunchExecutionBetterGenshinImpactAutomationHandlder : ILa
|
||||
Uri betterGenshinImpactUri = "bettergi://start".ToUri();
|
||||
if (await Launcher.QueryUriSupportAsync(betterGenshinImpactUri, LaunchQuerySupportType.Uri) is LaunchQuerySupportStatus.Available)
|
||||
{
|
||||
try
|
||||
{
|
||||
context.Logger.LogInformation("Waiting game window to be ready");
|
||||
context.Process.WaitForInputIdle();
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
context.Logger.LogInformation("Waiting game window to be ready");
|
||||
context.Process.WaitForInputIdle();
|
||||
|
||||
context.Logger.LogInformation("Launching BetterGI");
|
||||
await Launcher.LaunchUriAsync(betterGenshinImpactUri);
|
||||
|
||||
@@ -298,6 +298,7 @@
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.0.240109" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.Segmented" Version="8.0.240109" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.0.240109" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.TokenizingTextBox" Version="8.0.240109" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.0.240109" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Notifications" Version="7.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.2" />
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Control;
|
||||
using Snap.Hutao.Core.Windowing;
|
||||
|
||||
namespace Snap.Hutao.View.Converter.Specialized;
|
||||
|
||||
internal sealed class BackdropTypeToOpacityConverter : ValueConverter<BackdropType, double>
|
||||
{
|
||||
public override double Convert(BackdropType from)
|
||||
{
|
||||
return from is BackdropType.None ? 1 : 0;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
xmlns:shch="using:Snap.Hutao.Control.Helper"
|
||||
xmlns:shcm="using:Snap.Hutao.Control.Markup"
|
||||
xmlns:shv="using:Snap.Hutao.View"
|
||||
xmlns:shvcs="using:Snap.Hutao.View.Converter.Specialized"
|
||||
xmlns:shvh="using:Snap.Hutao.View.Helper"
|
||||
xmlns:shvm="using:Snap.Hutao.ViewModel"
|
||||
xmlns:shvp="using:Snap.Hutao.View.Page"
|
||||
@@ -28,16 +27,9 @@
|
||||
<Thickness x:Key="NavigationViewContentGridBorderThickness">0,1,0,0</Thickness>
|
||||
<x:Double x:Key="NavigationViewItemOnLeftIconBoxHeight">24</x:Double>
|
||||
<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="Transparent"/>
|
||||
<shvcs:BackdropTypeToOpacityConverter x:Key="BackdropTypeToOpacityConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<!-- Background="{ThemeResource SolidBackgroundFillColorBaseBrush}" -->
|
||||
<Grid Transitions="{ThemeResource EntranceThemeTransitions}">
|
||||
<Border Background="{ThemeResource SolidBackgroundFillColorBaseBrush}" Opacity="{Binding AppOptions.BackdropType, Converter={StaticResource BackdropTypeToOpacityConverter}, Mode=OneWay}">
|
||||
<Border.OpacityTransition>
|
||||
<ScalarTransition Duration="0:0:1"/>
|
||||
</Border.OpacityTransition>
|
||||
</Border>
|
||||
|
||||
<Image
|
||||
x:Name="BackgroundImagePresenter"
|
||||
HorizontalAlignment="Center"
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.Animations;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media.Animation;
|
||||
using Snap.Hutao.Control.Animation;
|
||||
using Snap.Hutao.Control.Theme;
|
||||
using Snap.Hutao.Service.BackgroundImage;
|
||||
using Snap.Hutao.Service.Navigation;
|
||||
using Snap.Hutao.View.Page;
|
||||
using Snap.Hutao.ViewModel;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:mxic="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:shc="using:Snap.Hutao.Control"
|
||||
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
|
||||
xmlns:shci="using:Snap.Hutao.Control.Image"
|
||||
@@ -73,6 +72,10 @@
|
||||
</shct:DescriptionTextBlock>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="SuggestionTemplate">
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding}"/>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="AvatarListTemplate">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -265,22 +268,20 @@
|
||||
</CommandBar.Content>
|
||||
<!--<AppBarButton Icon="{shcm:FontIcon Glyph=}" Label="搜索提示"/>-->
|
||||
<AppBarElementContainer>
|
||||
<AutoSuggestBox
|
||||
Width="240"
|
||||
Height="36"
|
||||
Margin="6,6,6,0"
|
||||
<cwc:TokenizingTextBox
|
||||
x:Name="AvatarSuggestBox"
|
||||
Width="520"
|
||||
Margin="6,0,6,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalContentAlignment="Center"
|
||||
ItemsSource="{Binding FilterTokens, Mode=TwoWay}"
|
||||
MaximumTokens="5"
|
||||
PlaceholderText="{shcm:ResourceString Name=ViewPageWiKiAvatarAutoSuggestBoxPlaceHolder}"
|
||||
QueryIcon="{shcm:FontIcon Glyph=}"
|
||||
Style="{StaticResource DefaultAutoSuggestBoxStyle}"
|
||||
Text="{Binding FilterText, Mode=TwoWay}">
|
||||
<mxi:Interaction.Behaviors>
|
||||
<mxic:EventTriggerBehavior EventName="QuerySubmitted">
|
||||
<mxic:InvokeCommandAction Command="{Binding FilterCommand}" CommandParameter="{Binding FilterText}"/>
|
||||
</mxic:EventTriggerBehavior>
|
||||
</mxi:Interaction.Behaviors>
|
||||
</AutoSuggestBox>
|
||||
QueryIcon="{cw:FontIconSource Glyph=}"
|
||||
SuggestedItemTemplate="{StaticResource SuggestionTemplate}"
|
||||
SuggestedItemsSource="{Binding AvailableQueries}"
|
||||
Text="{Binding FilterToken, Mode=TwoWay}"
|
||||
TokenItemTemplate="{StaticResource SuggestionTemplate}"/>
|
||||
</AppBarElementContainer>
|
||||
<AppBarButton
|
||||
Command="{Binding CultivateCommand}"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.Controls;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Snap.Hutao.Control;
|
||||
using Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
@@ -17,7 +19,19 @@ internal sealed partial class WikiAvatarPage : ScopedPage
|
||||
/// </summary>
|
||||
public WikiAvatarPage()
|
||||
{
|
||||
InitializeWith<WikiAvatarViewModel>();
|
||||
WikiAvatarViewModel viewModel = InitializeWith<WikiAvatarViewModel>();
|
||||
InitializeComponent();
|
||||
|
||||
viewModel.Initialize(new TokenizingTextBoxAccessor(AvatarSuggestBox));
|
||||
}
|
||||
|
||||
private class TokenizingTextBoxAccessor : ITokenizingTextBoxAccessor
|
||||
{
|
||||
public TokenizingTextBoxAccessor(TokenizingTextBox tokenizingTextBox)
|
||||
{
|
||||
TokenizingTextBox = tokenizingTextBox;
|
||||
}
|
||||
|
||||
public TokenizingTextBox TokenizingTextBox { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
Source="{Binding Converter={StaticResource PropertyDescriptor}}"/>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="SuggestionTemplate">
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding}"/>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="WeaponListTemplate">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -131,21 +135,21 @@
|
||||
LocalSettingKeySuffixForCurrent="WikiWeaponPage.Weapons"/>
|
||||
</CommandBar.Content>
|
||||
<AppBarElementContainer>
|
||||
<AutoSuggestBox
|
||||
Width="240"
|
||||
Height="36"
|
||||
Margin="16,6,6,0"
|
||||
<cwc:TokenizingTextBox
|
||||
x:Name="WeaponSuggestBox"
|
||||
Width="520"
|
||||
Margin="16,0,6,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalContentAlignment="Center"
|
||||
ItemTemplate="{StaticResource SuggestionTemplate}"
|
||||
ItemsSource="{Binding FilterTokens, Mode=TwoWay}"
|
||||
MaximumTokens="5"
|
||||
PlaceholderText="{shcm:ResourceString Name=ViewPageWiKiWeaponAutoSuggestBoxPlaceHolder}"
|
||||
QueryIcon="{shcm:FontIcon Glyph=}"
|
||||
Text="{Binding FilterText, Mode=TwoWay}">
|
||||
<mxi:Interaction.Behaviors>
|
||||
<mxic:EventTriggerBehavior EventName="QuerySubmitted">
|
||||
<mxic:InvokeCommandAction Command="{Binding FilterCommand}" CommandParameter="{Binding FilterText}"/>
|
||||
</mxic:EventTriggerBehavior>
|
||||
</mxi:Interaction.Behaviors>
|
||||
</AutoSuggestBox>
|
||||
QueryIcon="{cw:FontIconSource Glyph=}"
|
||||
SuggestedItemTemplate="{StaticResource SuggestionTemplate}"
|
||||
SuggestedItemsSource="{Binding AvailableQueries}"
|
||||
Text="{Binding FilterToken, Mode=TwoWay}"
|
||||
TokenItemTemplate="{StaticResource SuggestionTemplate}"/>
|
||||
</AppBarElementContainer>
|
||||
<AppBarButton
|
||||
Command="{Binding CultivateCommand}"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.Controls;
|
||||
using Snap.Hutao.Control;
|
||||
using Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
@@ -17,7 +18,19 @@ internal sealed partial class WikiWeaponPage : ScopedPage
|
||||
/// </summary>
|
||||
public WikiWeaponPage()
|
||||
{
|
||||
InitializeWith<WikiWeaponViewModel>();
|
||||
WikiWeaponViewModel viewModel = InitializeWith<WikiWeaponViewModel>();
|
||||
InitializeComponent();
|
||||
|
||||
viewModel.Initialize(new TokenizingTextBoxAccessor(WeaponSuggestBox));
|
||||
}
|
||||
|
||||
private class TokenizingTextBoxAccessor : ITokenizingTextBoxAccessor
|
||||
{
|
||||
public TokenizingTextBoxAccessor(TokenizingTextBox tokenizingTextBox)
|
||||
{
|
||||
TokenizingTextBox = tokenizingTextBox;
|
||||
}
|
||||
|
||||
public TokenizingTextBox TokenizingTextBox { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,10 +76,9 @@ internal sealed class DownloadSummary : ObservableObject
|
||||
{
|
||||
HttpResponseMessage response = await httpClient.GetAsync(fileUrl, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);
|
||||
|
||||
if (response.Content.Headers.ContentType?.MediaType is not ("application/octet-stream" or "application/zip"))
|
||||
if (response.Content.Headers.ContentType?.MediaType is not "application/octet-stream")
|
||||
{
|
||||
logger.LogWarning("Download Static Zip failed, Content-Type is {Type}", response.Content.Headers.ContentType);
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
Description = SH.ViewModelWelcomeDownloadSummaryContentTypeNotMatch;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -8,9 +8,7 @@ using Microsoft.UI.Xaml.Media.Animation;
|
||||
using Snap.Hutao.Control.Animation;
|
||||
using Snap.Hutao.Control.Theme;
|
||||
using Snap.Hutao.Message;
|
||||
using Snap.Hutao.Service;
|
||||
using Snap.Hutao.Service.BackgroundImage;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Snap.Hutao.ViewModel;
|
||||
|
||||
@@ -19,15 +17,11 @@ namespace Snap.Hutao.ViewModel;
|
||||
internal sealed partial class MainViewModel : Abstraction.ViewModel, IMainViewModelInitialization, IRecipient<BackgroundImageTypeChangedMessage>
|
||||
{
|
||||
private readonly IBackgroundImageService backgroundImageService;
|
||||
private readonly ILogger<MainViewModel> logger;
|
||||
private readonly ITaskContext taskContext;
|
||||
private readonly AppOptions appOptions;
|
||||
|
||||
private BackgroundImage? previousBackgroundImage;
|
||||
private Image? backgroundImagePresenter;
|
||||
|
||||
public AppOptions AppOptions { get => appOptions; }
|
||||
|
||||
public void Initialize(IBackgroundImagePresenterAccessor accessor)
|
||||
{
|
||||
backgroundImagePresenter = accessor.BackgroundImagePresenter;
|
||||
@@ -46,9 +40,9 @@ internal sealed partial class MainViewModel : Abstraction.ViewModel, IMainViewMo
|
||||
return;
|
||||
}
|
||||
|
||||
(bool shouldRefresh, BackgroundImage? backgroundImage) = await backgroundImageService.GetNextBackgroundImageAsync(previousBackgroundImage).ConfigureAwait(false);
|
||||
(bool isOk, BackgroundImage backgroundImage) = await backgroundImageService.GetNextBackgroundImageAsync(previousBackgroundImage).ConfigureAwait(false);
|
||||
|
||||
if (shouldRefresh)
|
||||
if (isOk)
|
||||
{
|
||||
previousBackgroundImage = backgroundImage;
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
@@ -63,18 +57,8 @@ internal sealed partial class MainViewModel : Abstraction.ViewModel, IMainViewMo
|
||||
.StartAsync(backgroundImagePresenter)
|
||||
.ConfigureAwait(true);
|
||||
|
||||
backgroundImagePresenter.Source = backgroundImage?.ImageSource;
|
||||
double targetOpacity = backgroundImage is not null
|
||||
? ThemeHelper.IsDarkMode(backgroundImagePresenter.ActualTheme)
|
||||
? 1 - backgroundImage.Luminance
|
||||
: backgroundImage.Luminance
|
||||
: 0;
|
||||
|
||||
logger.LogInformation(
|
||||
"Background image: [Accent color: {AccentColor}] [Luminance: {Luminance}] [Opacity: {TargetOpacity}]",
|
||||
backgroundImage?.AccentColor.ToString(CultureInfo.CurrentCulture),
|
||||
backgroundImage?.Luminance,
|
||||
targetOpacity);
|
||||
backgroundImagePresenter.Source = backgroundImage.ImageSource;
|
||||
double targetOpacity = ThemeHelper.IsDarkMode(backgroundImagePresenter.ActualTheme) ? 1 - backgroundImage.Luminance : backgroundImage.Luminance;
|
||||
|
||||
await AnimationBuilder
|
||||
.Create()
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.Controls;
|
||||
using Snap.Hutao.Control;
|
||||
|
||||
namespace Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
internal interface ITokenizingTextBoxAccessor : IXamlElementAccessor
|
||||
{
|
||||
TokenizingTextBox TokenizingTextBox { get; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
namespace Snap.Hutao.ViewModel.Wiki;
|
||||
|
||||
internal interface IWikiViewModelInitialization
|
||||
{
|
||||
void Initialize(ITokenizingTextBoxAccessor accessor);
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.Controls;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Snap.Hutao.Control.Collection.AdvancedCollectionView;
|
||||
using Snap.Hutao.Factory.ContentDialog;
|
||||
using Snap.Hutao.Model.Calculable;
|
||||
using Snap.Hutao.Model.Entity.Primitive;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Intrinsic.Frozen;
|
||||
using Snap.Hutao.Model.Metadata;
|
||||
using Snap.Hutao.Model.Metadata.Avatar;
|
||||
using Snap.Hutao.Model.Metadata.Item;
|
||||
@@ -17,6 +20,8 @@ using Snap.Hutao.Service.Notification;
|
||||
using Snap.Hutao.Service.User;
|
||||
using Snap.Hutao.View.Dialog;
|
||||
using Snap.Hutao.Web.Response;
|
||||
using System.Collections.Frozen;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using CalculateAvatarPromotionDelta = Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate.AvatarPromotionDelta;
|
||||
using CalculateClient = Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate.CalculateClient;
|
||||
@@ -32,7 +37,7 @@ namespace Snap.Hutao.ViewModel.Wiki;
|
||||
[HighQuality]
|
||||
[ConstructorGenerated]
|
||||
[Injection(InjectAs.Scoped)]
|
||||
internal sealed partial class WikiAvatarViewModel : Abstraction.ViewModel
|
||||
internal sealed partial class WikiAvatarViewModel : Abstraction.ViewModel, IWikiViewModelInitialization
|
||||
{
|
||||
private readonly IContentDialogFactory contentDialogFactory;
|
||||
private readonly ICultivationService cultivationService;
|
||||
@@ -45,10 +50,12 @@ internal sealed partial class WikiAvatarViewModel : Abstraction.ViewModel
|
||||
|
||||
private AdvancedCollectionView<Avatar>? avatars;
|
||||
private Avatar? selected;
|
||||
private string? filterText;
|
||||
private ObservableCollection<string>? filterTokens;
|
||||
private string? filterToken;
|
||||
private BaseValueInfo? baseValueInfo;
|
||||
private Dictionary<Level, Dictionary<GrowCurveType, float>>? levelAvatarCurveMap;
|
||||
private List<Promote>? promotes;
|
||||
private FrozenSet<string> availableQueries;
|
||||
|
||||
/// <summary>
|
||||
/// 角色列表
|
||||
@@ -75,9 +82,21 @@ internal sealed partial class WikiAvatarViewModel : Abstraction.ViewModel
|
||||
public BaseValueInfo? BaseValueInfo { get => baseValueInfo; set => SetProperty(ref baseValueInfo, value); }
|
||||
|
||||
/// <summary>
|
||||
/// 筛选文本
|
||||
/// 保存的筛选标志
|
||||
/// </summary>
|
||||
public string? FilterText { get => filterText; set => SetProperty(ref filterText, value); }
|
||||
public ObservableCollection<string>? FilterTokens { get => filterTokens; set => SetProperty(ref filterTokens, value); }
|
||||
|
||||
public string? FilterToken { get => filterToken; set => SetProperty(ref filterToken, value); }
|
||||
|
||||
public FrozenSet<string>? AvailableQueries { get => availableQueries; }
|
||||
|
||||
public void Initialize(ITokenizingTextBoxAccessor accessor)
|
||||
{
|
||||
accessor.TokenizingTextBox.TextChanged += OnFilterSuggestionRequested;
|
||||
accessor.TokenizingTextBox.QuerySubmitted += OnQuerySubmitted;
|
||||
accessor.TokenizingTextBox.TokenItemAdded += OnTokenItemModified;
|
||||
accessor.TokenizingTextBox.TokenItemRemoved += OnTokenItemModified;
|
||||
}
|
||||
|
||||
protected override async ValueTask<bool> InitializeUIAsync()
|
||||
{
|
||||
@@ -101,6 +120,18 @@ internal sealed partial class WikiAvatarViewModel : Abstraction.ViewModel
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
Avatars = new(list, true);
|
||||
Selected = Avatars.View.ElementAtOrDefault(0);
|
||||
FilterTokens = [];
|
||||
|
||||
availableQueries = FrozenSet.ToFrozenSet<string>(
|
||||
[
|
||||
.. avatars.Select(a => a.Name),
|
||||
.. IntrinsicFrozen.AssociationTypes,
|
||||
.. IntrinsicFrozen.BodyTypes,
|
||||
.. IntrinsicFrozen.ElementNames,
|
||||
.. IntrinsicFrozen.ItemQualities,
|
||||
.. IntrinsicFrozen.WeaponTypes,
|
||||
]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -202,21 +233,53 @@ internal sealed partial class WikiAvatarViewModel : Abstraction.ViewModel
|
||||
BaseValueInfo = new(avatar.MaxLevel, propertyCurveValues, levelAvatarCurveMap, avatarPromoteMap);
|
||||
}
|
||||
|
||||
[Command("FilterCommand")]
|
||||
private void ApplyFilter(string? input)
|
||||
private void OnFilterSuggestionRequested(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
|
||||
{
|
||||
if (Avatars is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(input))
|
||||
if (string.IsNullOrWhiteSpace(FilterToken))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
|
||||
{
|
||||
sender.ItemsSource = availableQueries.Where(q => q.Contains(FilterToken, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
|
||||
{
|
||||
if (args.ChosenSuggestion is not null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
private void OnTokenItemModified(TokenizingTextBox sender, object args)
|
||||
{
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
private void ApplyFilter()
|
||||
{
|
||||
if (Avatars is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (FilterTokens.IsNullOrEmpty())
|
||||
{
|
||||
Avatars.Filter = default!;
|
||||
return;
|
||||
}
|
||||
|
||||
Avatars.Filter = AvatarFilter.Compile(input);
|
||||
Avatars.Filter = AvatarFilter.Compile(string.Join(' ', FilterTokens));
|
||||
|
||||
if (Selected is not null && Avatars.Contains(Selected))
|
||||
{
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using CommunityToolkit.WinUI.Controls;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Snap.Hutao.Control.Collection.AdvancedCollectionView;
|
||||
using Snap.Hutao.Factory.ContentDialog;
|
||||
using Snap.Hutao.Model.Calculable;
|
||||
using Snap.Hutao.Model.Entity.Primitive;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Model.Intrinsic.Frozen;
|
||||
using Snap.Hutao.Model.Metadata;
|
||||
using Snap.Hutao.Model.Metadata.Item;
|
||||
using Snap.Hutao.Model.Metadata.Weapon;
|
||||
@@ -17,6 +20,7 @@ using Snap.Hutao.Service.Notification;
|
||||
using Snap.Hutao.Service.User;
|
||||
using Snap.Hutao.View.Dialog;
|
||||
using Snap.Hutao.Web.Response;
|
||||
using System.Collections.Frozen;
|
||||
using System.Runtime.InteropServices;
|
||||
using CalculateAvatarPromotionDelta = Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate.AvatarPromotionDelta;
|
||||
using CalculateClient = Snap.Hutao.Web.Hoyolab.Takumi.Event.Calculate.CalculateClient;
|
||||
@@ -29,7 +33,7 @@ namespace Snap.Hutao.ViewModel.Wiki;
|
||||
/// </summary>
|
||||
[ConstructorGenerated]
|
||||
[Injection(InjectAs.Scoped)]
|
||||
internal sealed partial class WikiWeaponViewModel : Abstraction.ViewModel
|
||||
internal sealed partial class WikiWeaponViewModel : Abstraction.ViewModel, IWikiViewModelInitialization
|
||||
{
|
||||
private readonly IContentDialogFactory contentDialogFactory;
|
||||
private readonly CalculateClient calculateClient;
|
||||
@@ -42,10 +46,12 @@ internal sealed partial class WikiWeaponViewModel : Abstraction.ViewModel
|
||||
|
||||
private AdvancedCollectionView<Weapon>? weapons;
|
||||
private Weapon? selected;
|
||||
private string? filterText;
|
||||
private List<string>? filterTokens;
|
||||
private string? filterToken;
|
||||
private BaseValueInfo? baseValueInfo;
|
||||
private Dictionary<Level, Dictionary<GrowCurveType, float>>? levelWeaponCurveMap;
|
||||
private List<Promote>? promotes;
|
||||
private FrozenSet<string> availableQueries;
|
||||
|
||||
/// <summary>
|
||||
/// 角色列表
|
||||
@@ -72,9 +78,21 @@ internal sealed partial class WikiWeaponViewModel : Abstraction.ViewModel
|
||||
public BaseValueInfo? BaseValueInfo { get => baseValueInfo; set => SetProperty(ref baseValueInfo, value); }
|
||||
|
||||
/// <summary>
|
||||
/// 筛选文本
|
||||
/// 保存的筛选标志
|
||||
/// </summary>
|
||||
public string? FilterText { get => filterText; set => SetProperty(ref filterText, value); }
|
||||
public List<string>? FilterTokens { get => filterTokens; set => SetProperty(ref filterTokens, value); }
|
||||
|
||||
public string? FilterToken { get => filterToken; set => SetProperty(ref filterToken, value); }
|
||||
|
||||
public FrozenSet<string> AvailableQueries { get => availableQueries; }
|
||||
|
||||
public void Initialize(ITokenizingTextBoxAccessor accessor)
|
||||
{
|
||||
accessor.TokenizingTextBox.TextChanged += OnFilterSuggestionRequested;
|
||||
accessor.TokenizingTextBox.QuerySubmitted += OnQuerySubmitted;
|
||||
accessor.TokenizingTextBox.TokenItemAdded += OnTokenItemModified;
|
||||
accessor.TokenizingTextBox.TokenItemRemoved += OnTokenItemModified;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override async Task OpenUIAsync()
|
||||
@@ -98,6 +116,15 @@ internal sealed partial class WikiWeaponViewModel : Abstraction.ViewModel
|
||||
|
||||
Weapons = new(list, true);
|
||||
Selected = Weapons.View.ElementAtOrDefault(0);
|
||||
FilterTokens = [];
|
||||
|
||||
availableQueries = FrozenSet.ToFrozenSet(
|
||||
[
|
||||
.. weapons.Select(w => w.Name),
|
||||
.. IntrinsicFrozen.ItemQualities,
|
||||
.. IntrinsicFrozen.FightProperties,
|
||||
.. IntrinsicFrozen.WeaponTypes,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,21 +214,53 @@ internal sealed partial class WikiWeaponViewModel : Abstraction.ViewModel
|
||||
BaseValueInfo = new(weapon.MaxLevel, propertyCurveValues, levelWeaponCurveMap, weaponPromoteMap);
|
||||
}
|
||||
|
||||
[Command("FilterCommand")]
|
||||
private void ApplyFilter(string? input)
|
||||
private void OnFilterSuggestionRequested(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
|
||||
{
|
||||
if (Weapons is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(input))
|
||||
if (string.IsNullOrWhiteSpace(FilterToken))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
|
||||
{
|
||||
sender.ItemsSource = availableQueries.Where(q => q.Contains(FilterToken, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
|
||||
{
|
||||
if (args.ChosenSuggestion is not null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
private void OnTokenItemModified(TokenizingTextBox sender, object args)
|
||||
{
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
private void ApplyFilter()
|
||||
{
|
||||
if (Weapons is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (FilterTokens.IsNullOrEmpty())
|
||||
{
|
||||
Weapons.Filter = default!;
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons.Filter = WeaponFilter.Compile(input);
|
||||
Weapons.Filter = WeaponFilter.Compile(string.Join(' ', FilterTokens));
|
||||
|
||||
if (Selected is not null && Weapons.Contains(Selected))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user