-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
1,560 additions
and
515 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/Snap.Hutao/Snap.Hutao/Control/Panel/PanelSelector.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<UserControl | ||
x:Class="Snap.Hutao.Control.Panel.PanelSelector" | ||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:shcm="using:Snap.Hutao.Control.Markup" | ||
mc:Ignorable="d"> | ||
|
||
<SplitButton Padding="0,6" Click="SplitButtonClick" Loaded="SplitButtonLoaded"> | ||
<SplitButton.Content> | ||
<FontIcon Name="IconPresenter" Glyph=""/> | ||
</SplitButton.Content> | ||
<SplitButton.Flyout> | ||
<MenuFlyout> | ||
<RadioMenuFlyoutItem | ||
Tag="List" | ||
Click="RadioMenuFlyoutItemClick" | ||
Icon="{shcm:FontIcon Glyph=}" | ||
Text="列表"/> | ||
<RadioMenuFlyoutItem | ||
Tag="Grid" | ||
Click="RadioMenuFlyoutItemClick" | ||
Icon="{shcm:FontIcon Glyph=}" | ||
Text="网格"/> | ||
</MenuFlyout> | ||
</SplitButton.Flyout> | ||
</SplitButton> | ||
</UserControl> |
82 changes: 82 additions & 0 deletions
82
src/Snap.Hutao/Snap.Hutao/Control/Panel/PanelSelector.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright (c) DGP Studio. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
using Snap.Hutao.Core; | ||
using Snap.Hutao.Web.Hutao.Model; | ||
|
||
namespace Snap.Hutao.Control.Panel; | ||
|
||
/// <summary> | ||
/// 面板选择器 | ||
/// </summary> | ||
public sealed partial class PanelSelector : UserControl | ||
{ | ||
private static readonly DependencyProperty CurrentProperty = Property<PanelSelector>.Depend(nameof(Current), "List"); | ||
|
||
/// <summary> | ||
/// 构造一个新的面板选择器 | ||
/// </summary> | ||
public PanelSelector() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
/// <summary> | ||
/// 当前选择 | ||
/// </summary> | ||
public string Current | ||
{ | ||
get { return (string)GetValue(CurrentProperty); } | ||
set { SetValue(CurrentProperty, value); } | ||
} | ||
|
||
private void SplitButtonLoaded(object sender, RoutedEventArgs e) | ||
{ | ||
MenuFlyout menuFlyout = (MenuFlyout)((SplitButton)sender).Flyout; | ||
((RadioMenuFlyoutItem)menuFlyout.Items[0]).IsChecked = true; | ||
} | ||
|
||
private void SplitButtonClick(SplitButton sender, SplitButtonClickEventArgs args) | ||
{ | ||
MenuFlyout menuFlyout = (MenuFlyout)sender.Flyout; | ||
int i = 0; | ||
for (; i < menuFlyout.Items.Count; i++) | ||
{ | ||
RadioMenuFlyoutItem current = (RadioMenuFlyoutItem)menuFlyout.Items[i]; | ||
if (current.IsChecked) | ||
{ | ||
break; | ||
} | ||
} | ||
|
||
i++; | ||
|
||
if (i > menuFlyout.Items.Count) | ||
{ | ||
i = 1; | ||
} | ||
|
||
if (i == menuFlyout.Items.Count) | ||
{ | ||
i = 0; | ||
} | ||
|
||
RadioMenuFlyoutItem item = (RadioMenuFlyoutItem)menuFlyout.Items[i]; | ||
item.IsChecked = true; | ||
UpdateState(item); | ||
} | ||
|
||
private void RadioMenuFlyoutItemClick(object sender, RoutedEventArgs e) | ||
{ | ||
RadioMenuFlyoutItem item = (RadioMenuFlyoutItem)sender; | ||
UpdateState(item); | ||
} | ||
|
||
private void UpdateState(RadioMenuFlyoutItem item) | ||
{ | ||
Current = (string)item.Tag; | ||
IconPresenter.Glyph = ((FontIcon)item.Icon).Glyph; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/Snap.Hutao/Snap.Hutao/Model/Binding/AvatarProperty/AffixScore.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) DGP Studio. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
namespace Snap.Hutao.Model.Binding.AvatarProperty; | ||
|
||
/// <summary> | ||
/// 词条评分 | ||
/// </summary> | ||
public struct AffixScore | ||
{ | ||
/// <summary> | ||
/// 构造一个新的圣遗物评分 | ||
/// </summary> | ||
/// <param name="score">评分</param> | ||
/// <param name="weight">最大值</param> | ||
public AffixScore(double score, double weight) | ||
{ | ||
Score = score; | ||
Weight = weight; | ||
} | ||
|
||
/// <summary> | ||
/// 评分 | ||
/// </summary> | ||
public double Score { get; } | ||
|
||
/// <summary> | ||
/// 权重 | ||
/// </summary> | ||
public double Weight { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/Snap.Hutao/Snap.Hutao/Model/Binding/AvatarProperty/ReliquarySubProperty.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) DGP Studio. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
namespace Snap.Hutao.Model.Binding.AvatarProperty; | ||
|
||
/// <summary> | ||
/// 圣遗物副词条 | ||
/// </summary> | ||
public class ReliquarySubProperty | ||
{ | ||
/// <summary> | ||
/// 构造副属性 | ||
/// </summary> | ||
/// <param name="name">名称</param> | ||
/// <param name="value">值</param> | ||
/// <param name="score">评分</param> | ||
public ReliquarySubProperty(string name, string value, double score) | ||
{ | ||
Name = name; | ||
Value = value; | ||
Score = score; | ||
|
||
// only 0.2 | 0.4 | 0.6 | 0.8 | 1.0 | ||
Opacity = score switch | ||
{ | ||
< 25 => 0.25, | ||
< 50 => 0.5, | ||
< 75 => 0.75, | ||
_ => 1, | ||
}; | ||
} | ||
|
||
/// <summary> | ||
/// 名称 | ||
/// </summary> | ||
public string Name { get; } | ||
|
||
/// <summary> | ||
/// 值 | ||
/// </summary> | ||
public string Value { get; } | ||
|
||
/// <summary> | ||
/// 评分 | ||
/// </summary> | ||
public double Score { get; } | ||
|
||
/// <summary> | ||
/// 透明度 | ||
/// </summary> | ||
public double Opacity { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,4 +136,4 @@ public SummaryItem ToSummaryItem(int lastPull, DateTimeOffset time, bool isUp) | |
IsUp = isUp, | ||
}; | ||
} | ||
} | ||
} |
Oops, something went wrong.