mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
minor fix
This commit is contained in:
@@ -4,12 +4,11 @@
|
||||
using CommunityToolkit.WinUI.Controls;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Snap.Hutao.Control.SuggestBox;
|
||||
using System.Collections.Frozen;
|
||||
|
||||
namespace Snap.Hutao.View.Control;
|
||||
|
||||
[DependencyProperty("FilterCommand", typeof(ICommand))]
|
||||
[DependencyProperty("AvailableTokens", typeof(FrozenDictionary<string, SearchToken>))]
|
||||
[DependencyProperty("AvailableTokens", typeof(IReadOnlyDictionary<string, SearchToken>))]
|
||||
internal sealed partial class AutoSuggestTokenBox : TokenizingTextBox
|
||||
{
|
||||
public AutoSuggestTokenBox()
|
||||
@@ -54,7 +53,7 @@ internal sealed partial class AutoSuggestTokenBox : TokenizingTextBox
|
||||
return;
|
||||
}
|
||||
|
||||
args.Item = AvailableTokens[args.TokenText];
|
||||
args.Item = AvailableTokens.GetValueOrDefault(args.TokenText) ?? new SearchToken(args.TokenText, SearchTokenKind.Others);
|
||||
}
|
||||
|
||||
private void OnTokenItemModified(TokenizingTextBox sender, object args)
|
||||
|
||||
@@ -11,6 +11,7 @@ internal enum SearchTokenKind
|
||||
ElementNames,
|
||||
FightProperties,
|
||||
ItemQualities,
|
||||
Others,
|
||||
Weapons,
|
||||
WeaponTypes,
|
||||
}
|
||||
@@ -11,4 +11,6 @@ internal static class KnownColors
|
||||
public static readonly Color Orange = StructMarshal.Color(0xFFBC6932);
|
||||
public static readonly Color Purple = StructMarshal.Color(0xFFA156E0);
|
||||
public static readonly Color Blue = StructMarshal.Color(0xFF5180CB);
|
||||
public static readonly Color Green = StructMarshal.Color(0xFF2A8F72);
|
||||
public static readonly Color White = StructMarshal.Color(0xFF72778B);
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
using Microsoft.UI;
|
||||
using Snap.Hutao.Control;
|
||||
using Snap.Hutao.Control.Theme;
|
||||
using Snap.Hutao.Model.Intrinsic;
|
||||
using Snap.Hutao.Win32;
|
||||
using System.Collections.Frozen;
|
||||
using Windows.UI;
|
||||
|
||||
@@ -35,11 +35,11 @@ internal sealed class QualityColorConverter : ValueConverter<QualityType, Color>
|
||||
{
|
||||
return quality switch
|
||||
{
|
||||
QualityType.QUALITY_WHITE => StructMarshal.Color(0xFF72778B),
|
||||
QualityType.QUALITY_GREEN => StructMarshal.Color(0xFF2A8F72),
|
||||
QualityType.QUALITY_BLUE => StructMarshal.Color(0xFF5180CB),
|
||||
QualityType.QUALITY_PURPLE => StructMarshal.Color(0xFFA156E0),
|
||||
QualityType.QUALITY_ORANGE or QualityType.QUALITY_ORANGE_SP => StructMarshal.Color(0xFFBC6932),
|
||||
QualityType.QUALITY_WHITE => KnownColors.White,
|
||||
QualityType.QUALITY_GREEN => KnownColors.Green,
|
||||
QualityType.QUALITY_BLUE => KnownColors.Blue,
|
||||
QualityType.QUALITY_PURPLE => KnownColors.Purple,
|
||||
QualityType.QUALITY_ORANGE or QualityType.QUALITY_ORANGE_SP => KnownColors.Orange,
|
||||
_ => Colors.Transparent,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -70,7 +70,8 @@ internal static class AvatarFilter
|
||||
matches.Add(tokens.Contains(avatar.Name));
|
||||
break;
|
||||
default:
|
||||
throw Must.NeverHappen();
|
||||
matches.Add(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,8 @@ internal static class WeaponFilter
|
||||
matches.Add(tokens.Contains(weapon.Name));
|
||||
break;
|
||||
default:
|
||||
throw Must.NeverHappen();
|
||||
matches.Add(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user