Skip to content

Commit

Permalink
avatar filter re-enable
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightczx committed Dec 16, 2022
1 parent bcf38fb commit 958fecd
Show file tree
Hide file tree
Showing 16 changed files with 229 additions and 245 deletions.
17 changes: 16 additions & 1 deletion src/Snap.Hutao/Snap.Hutao/Extension/EnumExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,24 @@ public static class EnumExtension
public static string GetDescription<TEnum>(this TEnum @enum)
where TEnum : struct, Enum
{
string enumName = Must.NotNull(Enum.GetName(@enum)!);
string enumName = Enum.GetName(@enum)!;
FieldInfo? field = @enum.GetType().GetField(enumName);
DescriptionAttribute? attr = field?.GetCustomAttribute<DescriptionAttribute>();
return attr?.Description ?? enumName;
}

/// <summary>
/// 获取枚举的描述
/// </summary>
/// <typeparam name="TEnum">枚举的类型</typeparam>
/// <param name="enum">枚举值</param>
/// <returns>描述</returns>
public static string? GetDescriptionOrNull<TEnum>(this TEnum @enum)
where TEnum : struct, Enum
{
string enumName = Enum.GetName(@enum)!;
FieldInfo? field = @enum.GetType().GetField(enumName);
DescriptionAttribute? attr = field?.GetCustomAttribute<DescriptionAttribute>();
return attr?.Description;
}
}
30 changes: 14 additions & 16 deletions src/Snap.Hutao/Snap.Hutao/LaunchGameWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<Window
x:Class="Snap.Hutao.LaunchGameWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
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:mxi="using:Microsoft.Xaml.Interactivity"
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
xmlns:shv="using:Snap.Hutao.ViewModel"
mc:Ignorable="d">

<Grid
Name="RootGrid"
d:DataContext="{d:DesignInstance shv:LaunchGameViewModel}">

<Grid Name="RootGrid" d:DataContext="{d:DesignInstance shv:LaunchGameViewModel}">

<mxi:Interaction.Behaviors>
<shcb:InvokeCommandOnLoadedBehavior Command="{Binding OpenUICommand}"/>
</mxi:Interaction.Behaviors>
Expand All @@ -27,17 +25,17 @@
Grid.Row="0"
Height="32">
<TextBlock
Text="选择账号并启动"
TextWrapping="NoWrap"
Style="{StaticResource CaptionTextBlockStyle}"
VerticalAlignment="Center"
Margin="12,0,0,0"/>
Margin="12,0,0,0"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
Text="选择账号并启动"
TextWrapping="NoWrap"/>
</Grid>

<ListView
Grid.Row="1"
ItemsSource="{Binding GameAccounts}"
SelectedItem="{Binding SelectedGameAccount,Mode=TwoWay}">
SelectedItem="{Binding SelectedGameAccount, Mode=TwoWay}">
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
Expand All @@ -46,18 +44,18 @@
<TextBlock
Opacity="0.8"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding AttachUid,TargetNullValue=该账号尚未绑定 UID}"/>
Text="{Binding AttachUid, TargetNullValue=该账号尚未绑定 UID}"/>
</StackPanel>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>

<Button
Margin="16"
Grid.Row="2"
Margin="16"
HorizontalAlignment="Stretch"
Content="启动游戏"
Command="{Binding LaunchCommand}"/>
Command="{Binding LaunchCommand}"
Content="启动游戏"/>
</Grid>
</Window>
8 changes: 4 additions & 4 deletions src/Snap.Hutao/Snap.Hutao/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Window
x:Class="Snap.Hutao.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
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:shv="using:Snap.Hutao.View"
mc:Ignorable="d">

<Grid>
<shv:TitleView
Margin="48,0,0,0"
x:Name="TitleBarView"
Height="44"
x:Name="TitleBarView"/>
Margin="48,0,0,0"/>

<shv:MainView/>
</Grid>
</Window>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ namespace Snap.Hutao.Model.Binding.Cultivation;
/// </summary>
public class CultivateEntry : ItemBase
{
/// <summary>
/// 构造一个新的养成清单入口
/// </summary>
/// <param name="entry">实体入口</param>
/// <param name="itemBase">对应物品</param>
/// <param name="items">物品列表</param>
public CultivateEntry(Entity.CultivateEntry entry, ItemBase itemBase, List<CultivateItem> items)
{
Id = entry.Id;
EntryId = entry.InnerId;
Name = itemBase.Name;
Icon = itemBase.Icon;
Badge = itemBase.Badge;
Quality = itemBase.Quality;
Items = items;
}

/// <summary>
/// Id
/// </summary>
Expand Down
9 changes: 9 additions & 0 deletions src/Snap.Hutao/Snap.Hutao/Model/Intrinsic/AssociationType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ public enum AssociationType
/// <summary>
/// 蒙德
/// </summary>
[Description("蒙德")]
ASSOC_TYPE_MONDSTADT,

/// <summary>
/// 璃月
/// </summary>
[Description("璃月")]
ASSOC_TYPE_LIYUE,

/// <summary>
Expand All @@ -31,35 +33,42 @@ public enum AssociationType
/// <summary>
/// 愚人众
/// </summary>
[Description("愚人众")]
ASSOC_TYPE_FATUI,

/// <summary>
/// 稻妻
/// </summary>
[Description("稻妻")]
ASSOC_TYPE_INAZUMA,

/// <summary>
/// 游侠
/// </summary>
[Description("游侠")]
ASSOC_TYPE_RANGER,

/// <summary>
/// 须弥
/// </summary>
[Description("须弥")]
ASSOC_TYPE_SUMERU,

/// <summary>
/// 枫丹
/// </summary>
[Description("枫丹")]
ASSOC_TYPE_FONTAINE,

/// <summary>
/// 纳塔
/// </summary>
[Description("纳塔")]
ASSOC_TYPE_NATLAN,

/// <summary>
/// 至冬
/// </summary>
[Description("至冬")]
ASSOC_TYPE_SNEZHNAYA,
}
5 changes: 5 additions & 0 deletions src/Snap.Hutao/Snap.Hutao/Model/Intrinsic/BodyType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,30 @@ public enum BodyType
/// <summary>
/// 男孩
/// </summary>
[Description("少男")]
BODY_BOY,

/// <summary>
/// 女孩
/// </summary>
[Description("少女")]
BODY_GIRL,

/// <summary>
/// 成女
/// </summary>
[Description("成女")]
BODY_LADY,

/// <summary>
/// 成男
/// </summary>
[Description("成男")]
BODY_MALE,

/// <summary>
/// 萝莉
/// </summary>
[Description("萝莉")]
BODY_LOLI,
}
6 changes: 6 additions & 0 deletions src/Snap.Hutao/Snap.Hutao/Model/Intrinsic/ItemQuality.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,36 @@ public enum ItemQuality
/// <summary>
/// 一星
/// </summary>
[Description("一星")]
QUALITY_WHITE = 1,

/// <summary>
/// 二星
/// </summary>
[Description("二星")]
QUALITY_GREEN = 2,

/// <summary>
/// 三星
/// </summary>
[Description("三星")]
QUALITY_BLUE = 3,

/// <summary>
/// 四星
/// </summary>
[Description("四星")]
QUALITY_PURPLE = 4,

/// <summary>
/// 五星
/// </summary>
[Description("五星")]
QUALITY_ORANGE = 5,

/// <summary>
/// 限定五星
/// </summary>
[Description("限定五星")]
QUALITY_ORANGE_SP = 105,
}
5 changes: 5 additions & 0 deletions src/Snap.Hutao/Snap.Hutao/Model/Intrinsic/WeaponType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public enum WeaponType
/// <summary>
/// 单手剑
/// </summary>
[Description("单手剑")]
WEAPON_SWORD_ONE_HAND = 1,

#region Not Used
Expand Down Expand Up @@ -73,20 +74,24 @@ public enum WeaponType
/// <summary>
/// 法器
/// </summary>
[Description("单手剑")]
WEAPON_CATALYST = 10,

/// <summary>
/// 双手剑
/// </summary>
[Description("单手剑")]
WEAPON_CLAYMORE = 11,

/// <summary>
/// 弓
/// </summary>
[Description("单手剑")]
WEAPON_BOW = 12,

/// <summary>
/// 长柄武器
/// </summary>
[Description("单手剑")]
WEAPON_POLE = 13,
}
49 changes: 0 additions & 49 deletions src/Snap.Hutao/Snap.Hutao/Model/Selectable.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Snap.Hutao/Snap.Hutao/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Identity
Name="7f0db578-026f-4e0b-a75b-d5d06bb0a74d"
Publisher="CN=DGP Studio"
Version="1.2.10.0" />
Version="1.2.12.0" />

<Properties>
<DisplayName>胡桃</DisplayName>
Expand Down
Loading

0 comments on commit 958fecd

Please sign in to comment.