diff --git a/src/Snap.Hutao/Snap.Hutao/Model/Primitive/LevelFormat.cs b/src/Snap.Hutao/Snap.Hutao/Model/Primitive/LevelFormat.cs index ac519875..0ccd2a14 100644 --- a/src/Snap.Hutao/Snap.Hutao/Model/Primitive/LevelFormat.cs +++ b/src/Snap.Hutao/Snap.Hutao/Model/Primitive/LevelFormat.cs @@ -12,4 +12,10 @@ internal static class LevelFormat { return $"Lv.{value}"; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string Format(uint value, uint extra) + { + return extra > 0 ? $"Lv.{value + extra} ({value} +{extra})" : $"Lv.{value}"; + } } diff --git a/src/Snap.Hutao/Snap.Hutao/Service/AvatarInfo/Factory/Builder/AvatarViewBuilderExtension.cs b/src/Snap.Hutao/Snap.Hutao/Service/AvatarInfo/Factory/Builder/AvatarViewBuilderExtension.cs index 60b8a410..40b669b3 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/AvatarInfo/Factory/Builder/AvatarViewBuilderExtension.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/AvatarInfo/Factory/Builder/AvatarViewBuilderExtension.cs @@ -7,6 +7,7 @@ using Snap.Hutao.Model.Metadata.Avatar; using Snap.Hutao.Model.Metadata.Converter; using Snap.Hutao.Model.Primitive; using Snap.Hutao.ViewModel.AvatarProperty; +using System.Collections.Immutable; namespace Snap.Hutao.Service.AvatarInfo.Factory.Builder; @@ -199,30 +200,29 @@ internal static class AvatarViewBuilderExtension return []; } + IReadOnlyDictionary extraLevelMap = proudSkillExtraLevelMap as IReadOnlyDictionary ?? ImmutableDictionary.Empty; Dictionary skillExtraLeveledMap = new(skillLevelMap); - if (proudSkillExtraLevelMap is not null) + foreach ((SkillGroupId groupId, SkillLevel extraLevel) in extraLevelMap) { - foreach ((SkillGroupId groupId, SkillLevel extraLevel) in proudSkillExtraLevelMap) - { - skillExtraLeveledMap.IncreaseByValue(proudSkills.Single(p => p.GroupId == groupId).Id, extraLevel); - } + skillExtraLeveledMap.IncreaseByValue(proudSkills.Single(p => p.GroupId == groupId).Id, extraLevel); } - return proudSkills.SelectList(proudableSkill => + return proudSkills.SelectList(proudSkill => { - SkillId skillId = proudableSkill.Id; + SkillId skillId = proudSkill.Id; // TODO: use builder here return new SkillView() { - Name = proudableSkill.Name, - Icon = SkillIconConverter.IconNameToUri(proudableSkill.Icon), - Description = proudableSkill.Description, + Name = proudSkill.Name, + Icon = SkillIconConverter.IconNameToUri(proudSkill.Icon), + Description = proudSkill.Description, - GroupId = proudableSkill.GroupId, + GroupId = proudSkill.GroupId, + Level = LevelFormat.Format(skillLevelMap[skillId], extraLevelMap.GetValueOrDefault(proudSkill.GroupId)), LevelNumber = skillLevelMap[skillId], - Info = DescriptionsParametersDescriptor.Convert(proudableSkill.Proud, skillExtraLeveledMap[skillId]), + Info = DescriptionsParametersDescriptor.Convert(proudSkill.Proud, skillExtraLeveledMap[skillId]), }; }); } diff --git a/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/InfoBarView.xaml b/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/InfoBarView.xaml index 63bc6137..c871b830 100644 --- a/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/InfoBarView.xaml +++ b/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/InfoBarView.xaml @@ -59,7 +59,7 @@ x:Name="InfoBarPanelTransitionHelper" DefaultEasingMode="EaseOut" DefaultEasingType="Cubic" - Duration="0:0:0.3"> + Duration="0:0:0.2"> @@ -71,7 +71,7 @@ x:Name="ShowButtonBorder" Margin="16" HorizontalAlignment="Right" - VerticalAlignment="Top" + VerticalAlignment="Bottom" clw:TransitionHelper.Id="Body" Background="{ThemeResource SystemControlAcrylicElementBrush}" CornerRadius="{ThemeResource ControlCornerRadius}"> @@ -104,17 +104,28 @@ x:Name="InfoBarItemsBorder" Margin="16" HorizontalAlignment="Right" - VerticalAlignment="Top" + VerticalAlignment="Bottom" clw:TransitionHelper.Id="Body" cw:Effects.Shadow="{ThemeResource CompatCardShadow}" Visibility="Collapsed"> - + + - + + + + + + @@ -164,15 +175,6 @@ - - - - diff --git a/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/AvatarPropertyPage.xaml b/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/AvatarPropertyPage.xaml index 1fc303ee..e981a5aa 100644 --- a/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/AvatarPropertyPage.xaml +++ b/src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/AvatarPropertyPage.xaml @@ -64,7 +64,9 @@ Source="{Binding Icon}"/> - + + + @@ -143,7 +145,7 @@ @@ -252,7 +254,7 @@ - + + Text="{Binding Level}"/> diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/AvatarProperty/SkillView.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/AvatarProperty/SkillView.cs index 1eb286dc..b7d1e9b2 100644 --- a/src/Snap.Hutao/Snap.Hutao/ViewModel/AvatarProperty/SkillView.cs +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/AvatarProperty/SkillView.cs @@ -26,7 +26,7 @@ internal sealed class SkillView : NameIconDescription, ITypedCalculableSource /// 不计算命座的技能等级字符串 /// - public string Level { get => LevelFormat.Format(LevelNumber); } + public string Level { get; set; } = default!; /// /// 技能组Id