From ee1aa2be3e5ba5ff3d7c7daf7d119b39cdd18716 Mon Sep 17 00:00:00 2001 From: Space Time Date: Thu, 3 Oct 2024 18:23:00 +0800 Subject: [PATCH] =?UTF-8?q?1.1.1=20->=201.1.2=20=E7=AC=AC19=E6=AC=A1?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Consts/MainMultilangConst.Designer.cs | 95 +++++++++++++++++++++++++-- Consts/MainMultilangConst.resx | 45 ++++++++++--- Consts/MainMultilangConst.zh.resx | 39 +++++++++-- Convs/MainNoClickButtonContentConv.cs | 18 +++++ Convs/MainNoClickButtonToolTipConv.cs | 18 +++++ Preses/MainPres.cs | 3 + Wins/MainWin.xaml | 20 +++++- Wins/MainWin.xaml.cs | 66 ++++++++++++++++++- 8 files changed, 277 insertions(+), 27 deletions(-) create mode 100644 Convs/MainNoClickButtonContentConv.cs create mode 100644 Convs/MainNoClickButtonToolTipConv.cs diff --git a/Consts/MainMultilangConst.Designer.cs b/Consts/MainMultilangConst.Designer.cs index 8d494d9..d1a8f38 100644 --- a/Consts/MainMultilangConst.Designer.cs +++ b/Consts/MainMultilangConst.Designer.cs @@ -70,7 +70,7 @@ namespace Sheas_Cealer.Consts { } /// - /// 查找类似 The config cannot be recognized, check if the config contain syntax errors 的本地化字符串。 + /// 查找类似 The config cannot be recognized. Check if the config contain syntax errors 的本地化字符串。 /// public static string _ConfErrorHint { get { @@ -79,7 +79,70 @@ namespace Sheas_Cealer.Consts { } /// - /// 查找类似 The args cannot be recognized, check if the hosts contain syntax errors 的本地化字符串。 + /// 查找类似 I know you would do it, but nothing will actually happen. Whee. 的本地化字符串。 + /// + public static string _GameClickOnceMsg { + get { + return ResourceManager.GetString("_GameClickOnceMsg", resourceCulture); + } + } + + /// + /// 查找类似 Ugh, what are you doing. Please stop, I don't want to hurt anyone. Stop please, this is your last chance. Ugh, I can't control it anymore. 的本地化字符串。 + /// + public static string _GameClickThreeMsg { + get { + return ResourceManager.GetString("_GameClickThreeMsg", resourceCulture); + } + } + + /// + /// 查找类似 No no no, don't click me. Sorry, I shouldn't have lied to you, I am a cursed button, and continuing to click me will bring disaster to the entire Sheas Cealer. Please believe me, this is not a game, and there are no new features here. Listen to me and use the normal functions, okay? 的本地化字符串。 + /// + public static string _GameClickTwiceMsg { + get { + return ResourceManager.GetString("_GameClickTwiceMsg", resourceCulture); + } + } + + /// + /// 查找类似 You defeated the evil button and saved Sheas Cealer, you are hero 的本地化字符串。 + /// + public static string _GameEndingMsg { + get { + return ResourceManager.GetString("_GameEndingMsg", resourceCulture); + } + } + + /// + /// 查找类似 Button Remaining HP. 的本地化字符串。 + /// + public static string _GameGradeMsg { + get { + return ResourceManager.GetString("_GameGradeMsg", resourceCulture); + } + } + + /// + /// 查找类似 It's dead, and you're the hero of Sheas Cealer 的本地化字符串。 + /// + public static string _GameReviewEndingMsg { + get { + return ResourceManager.GetString("_GameReviewEndingMsg", resourceCulture); + } + } + + /// + /// 查找类似 No, please kill me, I...can't control myself... 的本地化字符串。 + /// + public static string _GameStartMsg { + get { + return ResourceManager.GetString("_GameStartMsg", resourceCulture); + } + } + + /// + /// 查找类似 The args cannot be recognized. Check if the hosts contain syntax errors 的本地化字符串。 /// public static string _HostErrorHint { get { @@ -88,7 +151,7 @@ namespace Sheas_Cealer.Consts { } /// - /// 查找类似 All processes of the selected browser will be closed before launching, do you want to continue? 的本地化字符串。 + /// 查找类似 All processes of the selected browser will be closed before launching. Do you want to continue? 的本地化字符串。 /// public static string _KillBrowserProcessPrompt { get { @@ -303,21 +366,39 @@ namespace Sheas_Cealer.Consts { } } + /// + /// 查找类似 Click Now 的本地化字符串。 + /// + public static string NoClickButtonIsFlashingContent { + get { + return ResourceManager.GetString("NoClickButtonIsFlashingContent", resourceCulture); + } + } + + /// + /// 查找类似 Click the button now 的本地化字符串。 + /// + public static string NoClickButtonIsFlashingToolTip { + get { + return ResourceManager.GetString("NoClickButtonIsFlashingToolTip", resourceCulture); + } + } + /// /// 查找类似 No Clicking 的本地化字符串。 /// - public static string NoClickButtonContent { + public static string NoClickButtonIsStoppedContent { get { - return ResourceManager.GetString("NoClickButtonContent", resourceCulture); + return ResourceManager.GetString("NoClickButtonIsStoppedContent", resourceCulture); } } /// /// 查找类似 Donot click the button 的本地化字符串。 /// - public static string NoClickButtonToolTip { + public static string NoClickButtonIsStoppedToolTip { get { - return ResourceManager.GetString("NoClickButtonToolTip", resourceCulture); + return ResourceManager.GetString("NoClickButtonIsStoppedToolTip", resourceCulture); } } diff --git a/Consts/MainMultilangConst.resx b/Consts/MainMultilangConst.resx index d7e8187..a431cac 100644 --- a/Consts/MainMultilangConst.resx +++ b/Consts/MainMultilangConst.resx @@ -165,12 +165,6 @@ Click to launch a local Mihomo - - No Clicking - - - Donot click the button - Stop Nginx @@ -183,6 +177,18 @@ Click to launch a local Nginx + + Click Now + + + Click the button now + + + No Clicking + + + Donot click the button + Fill in a Chromium-based browser path @@ -238,13 +244,34 @@ Browser - The config cannot be recognized, check if the config contain syntax errors + The config cannot be recognized. Check if the config contain syntax errors + + + I know you would do it, but nothing will actually happen. Whee. + + + Ugh, what are you doing. Please stop, I don't want to hurt anyone. Stop please, this is your last chance. Ugh, I can't control it anymore. + + + No no no, don't click me. Sorry, I shouldn't have lied to you, I am a cursed button, and continuing to click me will bring disaster to the entire Sheas Cealer. Please believe me, this is not a game, and there are no new features here. Listen to me and use the normal functions, okay? + + + You defeated the evil button and saved Sheas Cealer, you are hero + + + Button Remaining HP. + + + It's dead, and you're the hero of Sheas Cealer + + + No, please kill me, I...can't control myself... - The args cannot be recognized, check if the hosts contain syntax errors + The args cannot be recognized. Check if the hosts contain syntax errors - All processes of the selected browser will be closed before launching, do you want to continue? + All processes of the selected browser will be closed before launching. Do you want to continue? There is an update available. Do you want to update upstream host? If No it will only open the upstream host page for you diff --git a/Consts/MainMultilangConst.zh.resx b/Consts/MainMultilangConst.zh.resx index 30cd74e..bb35642 100644 --- a/Consts/MainMultilangConst.zh.resx +++ b/Consts/MainMultilangConst.zh.resx @@ -165,12 +165,6 @@ 点击启动本地 Mihomo - - 不要点击 - - - 不要点击这个按钮 - 停止 Nginx @@ -183,6 +177,18 @@ 点击启动本地 Nginx + + 赶紧点我 + + + 赶紧点击这个按钮 + + + 不要点我 + + + 不要点击这个按钮 + 填入任意以 Chromium 为内核的浏览器路径 @@ -240,6 +246,27 @@ 配置无法识别,请检查配置文件中是否含有语法错误 + + 就知道你会点,但其实什么事情都不会发生的。嘻嘻 + + + 呜,你在做什么。求求你不要再继续点了,我不想伤害大家。快停下,这是最后一次机会。呃,我快要控制不住了 + + + 不不不,不要点我。对不起,我不该骗你的,我是一个受诅咒的按钮,继续点我会给整个 Sheas Cealer 带来灾难的。请相信我,这不是游戏,这里也没有新功能。听我的,去用正常的功能好吗 + + + 你击败了邪恶的按钮,拯救了 Sheas Cealer,你是英雄 + + + 按钮剩余血量: + + + 它死了,你是 Sheas Cealer 的英雄 + + + 不,求你杀了我,我...控制不住自己了... + 规则无法识别,请检查伪造规则中是否含有语法错误 diff --git a/Convs/MainNoClickButtonContentConv.cs b/Convs/MainNoClickButtonContentConv.cs new file mode 100644 index 0000000..d17dd40 --- /dev/null +++ b/Convs/MainNoClickButtonContentConv.cs @@ -0,0 +1,18 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using Sheas_Cealer.Consts; + +namespace Sheas_Cealer.Convs; + +internal class MainNoClickButtonContentConv : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + bool isFlashing = (bool)value; + + return isFlashing ? MainConst.NoClickButtonIsFlashingContent : MainConst.NoClickButtonIsStoppedContent; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); +} \ No newline at end of file diff --git a/Convs/MainNoClickButtonToolTipConv.cs b/Convs/MainNoClickButtonToolTipConv.cs new file mode 100644 index 0000000..1717181 --- /dev/null +++ b/Convs/MainNoClickButtonToolTipConv.cs @@ -0,0 +1,18 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using Sheas_Cealer.Consts; + +namespace Sheas_Cealer.Convs; + +internal class MainNoClickButtonToolTipConv : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + bool isFlashing = (bool)value; + + return isFlashing ? MainConst.NoClickButtonIsFlashingToolTip : MainConst.NoClickButtonIsStoppedToolTip; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); +} \ No newline at end of file diff --git a/Preses/MainPres.cs b/Preses/MainPres.cs index def4c12..e7425a3 100644 --- a/Preses/MainPres.cs +++ b/Preses/MainPres.cs @@ -92,4 +92,7 @@ internal partial class MainPres : ObservableObject [ObservableProperty] private bool isMihomoRunning = Process.GetProcessesByName("Cealing-Mihomo").Length != 0; + + [ObservableProperty] + private bool isFlashing = false; } \ No newline at end of file diff --git a/Wins/MainWin.xaml b/Wins/MainWin.xaml index f63a8c5..0f52fff 100644 --- a/Wins/MainWin.xaml +++ b/Wins/MainWin.xaml @@ -234,8 +234,24 @@ Click="EditConfButton_Click" /> \ No newline at end of file diff --git a/Wins/MainWin.xaml.cs b/Wins/MainWin.xaml.cs index f0da9dd..b787903 100644 --- a/Wins/MainWin.xaml.cs +++ b/Wins/MainWin.xaml.cs @@ -5,11 +5,14 @@ using System.Diagnostics; using System.IO; using System.Net.Http; using System.Text.Json; +using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; +using System.Windows.Media; using System.Windows.Threading; using IWshRuntimeLibrary; +using MaterialDesignThemes.Wpf; using Microsoft.Win32; using OnaCore; using Sheas_Cealer.Consts; @@ -29,6 +32,8 @@ public partial class MainWin : Window private static readonly FileSystemWatcher HostWatcher = new(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host-*.json") { EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite }; private static readonly Dictionary CealArgsFragments = []; private static string CealArgs = string.Empty; + private static int GameClickTime = 0; + private static int GameFlashInterval = 1000; internal MainWin(string[] args) { @@ -105,7 +110,7 @@ public partial class MainWin : Window private void StartButton_Click(object sender, RoutedEventArgs e) { - if (HoldButtonTimer!.IsEnabled) + if (HoldButtonTimer == null || HoldButtonTimer.IsEnabled) StartButtonHoldTimer_Tick(null, null!); } private void StartButton_PreviewMouseDown(object sender, MouseButtonEventArgs e) @@ -116,7 +121,7 @@ public partial class MainWin : Window } private void StartButtonHoldTimer_Tick(object? sender, EventArgs e) { - HoldButtonTimer!.Stop(); + HoldButtonTimer?.Stop(); if (string.IsNullOrWhiteSpace(CealArgs)) throw new Exception(MainConst._HostErrorHint); @@ -254,9 +259,64 @@ public partial class MainWin : Window ProcessStartInfo processStartInfo = new(confPath) { UseShellExecute = true }; Process.Start(processStartInfo); } - private void NoClickButton_Click(object sender, RoutedEventArgs e) + private async void NoClickButton_Click(object sender, RoutedEventArgs e) { + if (GameFlashInterval <= 10) + { + MessageBox.Show(MainConst._GameReviewEndingMsg); + return; + } + ++GameClickTime; + + switch (GameClickTime) + { + case 1: + MessageBox.Show(MainConst._GameClickOnceMsg); + return; + case 2: + MessageBox.Show(MainConst._GameClickTwiceMsg); + return; + case 3: + MessageBox.Show(MainConst._GameClickThreeMsg); + return; + } + + if (!MainPres!.IsFlashing) + { + MessageBox.Show(MainConst._GameStartMsg); + MainPres.IsFlashing = true; + + Random random = new(); + + while (GameFlashInterval > 10) + { + Left = random.Next(0, (int)((int)SystemParameters.PrimaryScreenWidth - ActualWidth)); + Top = random.Next(0, (int)(SystemParameters.PrimaryScreenHeight - ActualHeight)); + + PaletteHelper paletteHelper = new(); + Theme newTheme = paletteHelper.GetTheme(); + + newTheme.SetPrimaryColor(Color.FromRgb((byte)random.Next(256), (byte)random.Next(256), (byte)random.Next(256))); + newTheme.SetBaseTheme(random.Next(2) == 0 ? BaseTheme.Light : BaseTheme.Dark); + paletteHelper.SetTheme(newTheme); + + await Task.Delay(GameFlashInterval); + } + + MainPres.IsFlashing = false; + MessageBox.Show(MainConst._GameEndingMsg); + } + else + { + if (GameFlashInterval > 100) + GameFlashInterval -= 150; + else if (GameFlashInterval > 10) + GameFlashInterval -= 30; + + if (GameFlashInterval > 10) + MessageBox.Show($"{MainConst._GameGradeMsg} {GameFlashInterval}"); + } } private void ProxyTimer_Tick(object? sender, EventArgs e)