diff --git a/src/MaaWpfGui/MaaWpfGui.csproj b/src/MaaWpfGui/MaaWpfGui.csproj
index aeaf5350b8..c7309c6676 100644
--- a/src/MaaWpfGui/MaaWpfGui.csproj
+++ b/src/MaaWpfGui/MaaWpfGui.csproj
@@ -83,6 +83,7 @@
+
diff --git a/src/MaaWpfGui/Main/AsstProxy.cs b/src/MaaWpfGui/Main/AsstProxy.cs
index 73eb9d5312..cdd6d05813 100644
--- a/src/MaaWpfGui/Main/AsstProxy.cs
+++ b/src/MaaWpfGui/Main/AsstProxy.cs
@@ -879,6 +879,11 @@ namespace MaaWpfGui.Main
toast.Show();
}
+ if (DateTime.UtcNow.ToYjDate().IsAprilFoolsDay())
+ {
+ Instances.TaskQueueViewModel.GifVisibility = true;
+ }
+
// Instances.TaskQueueViewModel.CheckAndShutdown();
Instances.TaskQueueViewModel.CheckAfterCompleted();
}
diff --git a/src/MaaWpfGui/Res/Img/EasterEgg/1.gif b/src/MaaWpfGui/Res/Img/EasterEgg/1.gif
new file mode 100644
index 0000000000..6a056f838d
Binary files /dev/null and b/src/MaaWpfGui/Res/Img/EasterEgg/1.gif differ
diff --git a/src/MaaWpfGui/Res/Img/EasterEgg/2.gif b/src/MaaWpfGui/Res/Img/EasterEgg/2.gif
new file mode 100644
index 0000000000..15dc1fd707
Binary files /dev/null and b/src/MaaWpfGui/Res/Img/EasterEgg/2.gif differ
diff --git a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs
index e2351c3693..360e7576f0 100644
--- a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs
+++ b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs
@@ -22,6 +22,8 @@ using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
using MaaWpfGui.Constants;
using MaaWpfGui.Extensions;
using MaaWpfGui.Helper;
@@ -37,8 +39,9 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Serilog;
using Stylet;
-using StyletIoC;
using Application = System.Windows.Application;
+using IContainer = StyletIoC.IContainer;
+using Point = System.Windows.Point;
using Screen = Stylet.Screen;
namespace MaaWpfGui.ViewModels.UI
@@ -2223,13 +2226,15 @@ namespace MaaWpfGui.ViewModels.UI
foreach (var type in types)
{
// 获取 Instance 字段
- if (type.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static) is PropertyInfo property)
+ if (type.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static) is not { } property)
{
- // 获取实例
- if (property.GetValue(null) is TaskViewModel instance)
- {
- yield return instance;
- }
+ continue;
+ }
+
+ // 获取实例
+ if (property.GetValue(null) is TaskViewModel instance)
+ {
+ yield return instance;
}
}
}
@@ -2242,5 +2247,90 @@ namespace MaaWpfGui.ViewModels.UI
instance.ProcSubTaskMsg(msg, details);
}
}
+
+ private static readonly string[] _gitList =
+ [
+ "/Res/Img/EasterEgg/1.gif",
+ "/Res/Img/EasterEgg/2.gif",
+ ];
+
+ private static int _gifIndex = 0;
+
+ private static string _gifPath = _gitList[_gifIndex];
+
+ public string GifPath
+ {
+ get => _gifPath;
+ set => SetAndNotify(ref _gifPath, value);
+ }
+
+ private bool _gifVisibility = false;
+
+ public bool GifVisibility
+ {
+ get => _gifVisibility;
+ set => SetAndNotify(ref _gifVisibility, value);
+ }
+
+ // ReSharper disable once UnusedMember.Global
+ public void ChangeGif()
+ {
+ if (++_gifIndex >= _gitList.Length)
+ {
+ _gifIndex = 0;
+ }
+
+ GifPath = _gitList[_gifIndex];
+ }
+
+ private static bool _isDragging = false;
+ private static Point _offset;
+
+ // ReSharper disable once UnusedMember.Global
+ public void DraggableElementMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ if (sender is not HandyControl.Controls.GifImage childElement)
+ {
+ return;
+ }
+
+ _isDragging = true;
+ _offset = e.GetPosition(childElement);
+ childElement.CaptureMouse();
+ }
+
+ public void DraggableElementMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+ {
+ if (sender is not HandyControl.Controls.GifImage childElement)
+ {
+ return;
+ }
+
+ _isDragging = false;
+ childElement.ReleaseMouseCapture();
+ }
+
+ // ReSharper disable once UnusedMember.Global
+ public void DraggableElementMouseMove(object sender, MouseEventArgs e)
+ {
+ if (!_isDragging || sender is not HandyControl.Controls.GifImage { Parent: Grid parentElement } childElement)
+ {
+ return;
+ }
+
+ Point currentPosition = e.GetPosition(parentElement);
+
+ // 计算偏移量
+ double newX = currentPosition.X - _offset.X;
+ double newY = currentPosition.Y - _offset.Y;
+
+ // 确保元素在父元素范围内
+ newX = Math.Max(0, Math.Min(newX, parentElement.ActualWidth - childElement.ActualWidth - 10));
+ newY = Math.Max(0, Math.Min(newY, parentElement.ActualHeight - childElement.ActualHeight - 10));
+
+ childElement.HorizontalAlignment = HorizontalAlignment.Left;
+ childElement.VerticalAlignment = VerticalAlignment.Top;
+ childElement.Margin = new(newX, newY, 0, 0);
+ }
}
}
diff --git a/src/MaaWpfGui/Views/UI/TaskQueueView.xaml b/src/MaaWpfGui/Views/UI/TaskQueueView.xaml
index e497b5b74d..4923b992f4 100644
--- a/src/MaaWpfGui/Views/UI/TaskQueueView.xaml
+++ b/src/MaaWpfGui/Views/UI/TaskQueueView.xaml
@@ -350,5 +350,17 @@
+