Skip to content

在游戏版本不同的情况下尝试安装mod会显示警告 #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ModAssistant/Localisation/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
<sys:String x:Key="MainWindow:GameUpdateDialog:Line2">Please double check that the correct version is selected at the bottom left corner!</sys:String>
<sys:String x:Key="MainWindow:NoModSelected">No mod selected!</sys:String>
<sys:String x:Key="MainWindow:NoModInfoPage">{0} does not have an info page.</sys:String>
<sys:String x:Key="MainWindow:GameVersionMismatch" xml:space="preserve">The selected game version {0} is different from detected {1}!
Do you want to continue?</sys:String>
<sys:String x:Key="MainWindow:GameVersionMismatchTitle">Warning: Game Version Mismatch</sys:String>


<!-- Intro Page -->
<sys:String x:Key="Intro:Title">Intro</sys:String>
Expand Down
5 changes: 4 additions & 1 deletion ModAssistant/Localisation/zh.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ OneClick源</sys:String>
<sys:String x:Key="MainWindow:GameUpdateDialog:Line2">请确保左下角选择的版本与实际版本(地板脚印上有)相同才能安装Mod,否则会破坏你的游戏!</sys:String>
<sys:String x:Key="MainWindow:NoModSelected">没有选择Mod!</sys:String>
<sys:String x:Key="MainWindow:NoModInfoPage">{0}没有信息页。</sys:String>
<sys:String x:Key="MainWindow:GameVersionMismatch" xml:space="preserve">您选择的游戏版本 {0} 与当前检测到的游戏版本 {1} 不匹配,是否要继续安装Mod?
警告:继续安装Mod可能会破坏你的游戏,Mod需要匹配游戏版本,否则会出错。</sys:String>
<sys:String x:Key="MainWindow:GameVersionMismatchTitle">警告:游戏版本不匹配</sys:String>

<!-- Intro Page -->
<sys:String x:Key="Intro:Title">简介</sys:String>
Expand Down Expand Up @@ -270,7 +273,7 @@ OneClick窗口显示方式切换:</sys:String>
<sys:String x:Key="OneClick:DoneNotify">OneClick™ 安装完毕</sys:String>
<sys:String x:Key="OneClick:StartDownloadPlaylist">开始下载歌曲列表</sys:String>
<sys:String x:Key="OneClick:Done">执行完毕</sys:String>

<!-- Themes Class -->
<sys:String x:Key="Themes:ThemeNotFound">找不到主题,恢复为默认主题...</sys:String>
<sys:String x:Key="Themes:ThemeSet">主题设置为{0}.</sys:String>
Expand Down
19 changes: 18 additions & 1 deletion ModAssistant/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> VersionLoadStatus = new TaskCompletionSource<bool>();
public static string[] serverList = { "国际源@BeatMods", "国内源@WGzeyu", "包子源@BeatTop" };
Expand Down Expand Up @@ -129,6 +130,7 @@ private async void LoadVersionsAsync()
Dictionary<string, string[]> aliases = JsonSerializer.Deserialize<Dictionary<string, string[]>>(body);

string version = Utils.GetVersion();
GameVersionDetected = version;
if (!versions.Contains(version) && CheckAliases(versions, aliases, version) == string.Empty)
{
versions.Insert(0, version);
Expand Down Expand Up @@ -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)
Expand Down