diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index c4781d379b..cef04006dd 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -335,6 +335,8 @@ You can cancel this popup by clicking the Settings - About Us - Issue Reporting Do you also want to order a bar in a bar? I'm sure I haven't selected the wrong one Okay, I will choose again + The emulator path does not exist + The emulator path is empty, 「{0}」 and 「{1}」 check states have been reset Select Replace ADB Touch Mode diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index 76327ee818..233fa97da2 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -335,6 +335,8 @@ バーでバーを注文したいですか? 確かに間違って選択していないと思います はい、もう一度選択します + エミュレータのパスが存在しません + エミュレータのパスが空です。「{0}」 と 「{1}」 のチェック状態がリセットされました 選択 ADB強制置き換え タッチモード diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index a5d08e4ae6..7086c5d3b1 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -335,6 +335,8 @@ 바에서 바를 주문하고 싶습니까? 잘못 선택한 것이 확실히 아닙니다 다시 선택하겠습니다 + 에뮬레이터 경로가 존재하지 않습니다 + 에뮬레이터 경로가 비어 있습니다. 「{0}」 및 「{1}」 선택 상태가 초기화되었습니다 선택 ADB 강제 교체 터치 수행 방식 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 0b97cdc283..d93e38173a 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -335,6 +335,8 @@ 你也想在酒吧里点酒吧? 我确定没选错 好的,我会重新选择 + 模拟器路径不存在 + 模拟器路径为空,「{0}」与「{1}」勾选状态已被还原 选择 强制替换 ADB 触控模式 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index 014cc177fe..67fb336c86 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -335,6 +335,8 @@ 你也想在酒吧裡點酒吧? 我確定沒選錯 好的,我會重新選擇 + 模擬器路徑不存在 + 模擬器路徑為空,「{0}」與「{1}」勾選狀態已被還原 選擇 強制替換 ADB 觸控模式 diff --git a/src/MaaWpfGui/ViewModels/UserControl/Settings/StartSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/Settings/StartSettingsUserControlModel.cs index fd7c62594a..951e092f09 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/Settings/StartSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/Settings/StartSettingsUserControlModel.cs @@ -22,6 +22,7 @@ using System.Management; using System.Runtime.InteropServices.ComTypes; using System.Threading; using System.Windows; +using HandyControl.Controls; using MaaWpfGui.Constants; using MaaWpfGui.Helper; using MaaWpfGui.Main; @@ -116,6 +117,16 @@ public class StartSettingsUserControlModel : PropertyChangedBase get => _openEmulatorAfterLaunch; set { + if (string.IsNullOrEmpty(SettingsViewModel.StartSettings.EmulatorPath)) + { + MessageBoxHelper.Show( + LocalizationHelper.GetString("RetryOnDisconnectedEmulatorPathEmptyError"), + LocalizationHelper.GetString("Tip"), + MessageBoxButton.OK, + MessageBoxImage.Warning); + value = false; + } + SetAndNotify(ref _openEmulatorAfterLaunch, value); ConfigurationHelper.SetValue(ConfigurationKeys.StartEmulator, value.ToString()); if (SettingsViewModel.GameSettings.ClientType == string.Empty && _runningState.GetIdle()) @@ -135,7 +146,15 @@ public class StartSettingsUserControlModel : PropertyChangedBase get => _emulatorPath; set { - if (Path.GetFileName(value).ToLower().Contains("maa")) + value = value.Trim(); + + // 这里不用 SetAndNotify 判断 + if (value == _emulatorPath) + { + return; + } + + if (Path.GetFileName(value).Contains("maa", StringComparison.OrdinalIgnoreCase)) { int count = 3; while (count-- > 0) @@ -154,6 +173,24 @@ public class StartSettingsUserControlModel : PropertyChangedBase } } + if (string.IsNullOrEmpty(value)) + { + if (ConnectSettings.RetryOnDisconnected || OpenEmulatorAfterLaunch) + { + ConnectSettings.RetryOnDisconnected = false; + OpenEmulatorAfterLaunch = false; + Growl.Warning( + string.Format( + LocalizationHelper.GetString("EmulatorPathEmptyWarning"), + LocalizationHelper.GetString("RetryOnDisconnected"), + LocalizationHelper.GetString("OpenEmulatorAfterLaunch"))); + } + } + else if (!File.Exists(EmulatorPath)) + { + Growl.Warning(LocalizationHelper.GetString("EmulatorPathNotExist")); + } + SetAndNotify(ref _emulatorPath, value); ConfigurationHelper.SetValue(ConfigurationKeys.EmulatorPath, value); }