feat: 版本号彩蛋

This commit is contained in:
枫雨
2023-04-22 01:30:43 +08:00
parent cd6b290c64
commit ddd7e9a8dc
2 changed files with 62 additions and 0 deletions

View File

@@ -94,6 +94,7 @@
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
PreviewMouseDown="EasterEggs"
Subject="{DynamicResource Version}"
Status="{Binding VersionId, Mode=OneWay}"
Color="#6969AA"/>

View File

@@ -11,6 +11,13 @@
// but WITHOUT ANY WARRANTY
// </copyright>
using System;
using System.Windows.Input;
using System.Windows.Threading;
using HandyControl.Controls;
using HandyControl.Data;
using MaaWpfGui.Helper;
namespace MaaWpfGui.Views.UserControl
{
/// <summary>
@@ -24,6 +31,60 @@ namespace MaaWpfGui.Views.UserControl
public VersionUpdateSettingsUserControl()
{
InitializeComponent();
timer.Tick += (s, e1) =>
{
count = 0;
timer.IsEnabled = false;
};
}
private const int ClickCount = 1;
private int count = 0;
private readonly DispatcherTimer timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 2, 0), };
private void EasterEggs(object sender, MouseButtonEventArgs e)
{
count += 1;
timer.IsEnabled = true;
if (count % ClickCount == 0)
{
count = 0;
timer.IsEnabled = false;
var growinfo = new GrowlInfo
{
IsCustom = true,
Message = LocalizationHelper.GetString("HelloWorld"),
IconKey = "InfoGeometry",
IconBrushKey = "PallasBrush",
};
switch (new Random().Next(0, 5))
{
case 1:
growinfo.Message = LocalizationHelper.GetString("BuyWineOnAprilFoolsDay");
growinfo.IconKey = "HangoverGeometry";
break;
case 2:
growinfo.Message = LocalizationHelper.GetString("Burping");
growinfo.IconKey = "DrunkAndStaggeringGeometry";
break;
case 3:
growinfo.Message = LocalizationHelper.GetString("DrunkAndStaggering");
growinfo.IconKey = "DrunkAndStaggeringGeometry";
break;
case 4:
growinfo.Message = LocalizationHelper.GetString("Hangover");
growinfo.IconKey = "HangoverGeometry";
break;
default:
// case 0
growinfo.IconBrushKey = "InfoBrush";
break;
}
Growl.Info(growinfo);
}
}
}
}