diff --git a/ModAssistant/Localisation/en.xaml b/ModAssistant/Localisation/en.xaml index d5a7a1e9..c897bed8 100644 --- a/ModAssistant/Localisation/en.xaml +++ b/ModAssistant/Localisation/en.xaml @@ -35,6 +35,10 @@ Please double check that the correct version is selected at the bottom left corner! No mod selected! {0} does not have an info page. + The selected game version {0} is different from detected {1}! +Do you want to continue? + Warning: Game Version Mismatch + Intro diff --git a/ModAssistant/Localisation/zh.xaml b/ModAssistant/Localisation/zh.xaml index 76c13797..faac49a1 100644 --- a/ModAssistant/Localisation/zh.xaml +++ b/ModAssistant/Localisation/zh.xaml @@ -38,6 +38,9 @@ OneClick源 请确保左下角选择的版本与实际版本(地板脚印上有)相同才能安装Mod,否则会破坏你的游戏! 没有选择Mod! {0}没有信息页。 + 您选择的游戏版本 {0} 与当前检测到的游戏版本 {1} 不匹配,是否要继续安装Mod? +警告:继续安装Mod可能会破坏你的游戏,Mod需要匹配游戏版本,否则会出错。 + 警告:游戏版本不匹配 简介 @@ -270,7 +273,7 @@ OneClick窗口显示方式切换: OneClick™ 安装完毕 开始下载歌曲列表 执行完毕 - + 找不到主题,恢复为默认主题... 主题设置为{0}. diff --git a/ModAssistant/MainWindow.xaml.cs b/ModAssistant/MainWindow.xaml.cs index 05d74f0c..564f0668 100644 --- a/ModAssistant/MainWindow.xaml.cs +++ b/ModAssistant/MainWindow.xaml.cs @@ -20,6 +20,7 @@ public partial class MainWindow : Window public static bool ModsOpened = false; public static bool ModsLoading = false; public static string GameVersion; + public static string GameVersionDetected; // the real game version detected from the game public static string GameVersionOverride; public TaskCompletionSource VersionLoadStatus = new TaskCompletionSource(); public static string[] serverList = { "国际源@BeatMods", "国内源@WGzeyu", "包子源@BeatTop" }; @@ -129,6 +130,7 @@ private async void LoadVersionsAsync() Dictionary aliases = JsonSerializer.Deserialize>(body); string version = Utils.GetVersion(); + GameVersionDetected = version; if (!versions.Contains(version) && CheckAliases(versions, aliases, version) == string.Empty) { versions.Insert(0, version); @@ -281,7 +283,22 @@ private void OptionsButton_Click(object sender, RoutedEventArgs e) private void InstallButton_Click(object sender, RoutedEventArgs e) { - Mods.Instance.InstallMods(); + if (string.IsNullOrEmpty(GameVersionOverride) // game version not listed in aliases at all + && GameVersion != GameVersionDetected) // and the user manually selected a version + { + // show a waring about the version mismatch + var result = MessageBox.Show(String.Format((string) Application.Current.FindResource("MainWindow:GameVersionMismatch"), GameVersion, GameVersionDetected), + (string)Application.Current.FindResource("MainWindow:GameVersionMismatchTitle"), MessageBoxButton.OKCancel); + + if (result == MessageBoxResult.OK) + { + Mods.Instance.InstallMods(); + } + } + else + { + Mods.Instance.InstallMods(); + } } private void InfoButton_Click(object sender, RoutedEventArgs e)