diff --git a/Q&A.md b/Q&A.md
index ae5b9c1..06109fb 100644
--- a/Q&A.md
+++ b/Q&A.md
@@ -14,3 +14,22 @@ A:
python -m pip install --upgrade pip
(pip 版本最好为23.1)
+Q: Windows找不到文件:\CAPI\cpp\x64\Debug\APl.exe?
+
+A:
+解决办法:打开CAPI\cpp目录,在里面打开CAPI.sln,然后点击生成,对代码进行编译
+
+Q: 怎么开始游戏?
+
+A:
+需要确保学生阵营和捣蛋鬼阵营的人数都达到Server.cmd中设定的值。现有代码只能保证一个Client对应一个阵营,如果想要两侧同时运行,有三种办法:对于C++,可以先对一个阵营编译,然后修改API.exe的文件名,然后再更改AI.cpp中指定的阵营,对另一个阵营编译,最后修改RunCpp.cmd中的目标文件;对于Python,可以将整个python接口复制一份(CAPI\python文件夹),在第二份代码中修改阵营,然后同样修改RunPython.cmd中的目标文件;也可以打开WPF,方法是参考问题4中的教程,修改RunGUIClient.cmd的参数,然后运行RunGUIClient.cmd,这样可以通过WPF运行部分客户端,来达到人数限制。
+
+Q: Mac怎么用?
+
+A:
+解决办法:安装Windows虚拟机
+
+Q: 怎么修改.cmd参数?
+
+A:
+见选手包中的使用文档部分
diff --git a/installer/Installer/MainWindow.xaml b/installer/Installer/MainWindow.xaml
index c298ff1..4e74b10 100644
--- a/installer/Installer/MainWindow.xaml
+++ b/installer/Installer/MainWindow.xaml
@@ -39,7 +39,7 @@
-
+
@@ -88,7 +88,7 @@
-
+
diff --git a/installer/Installer/Model.cs b/installer/Installer/Model.cs
index 0a52066..da6488c 100644
--- a/installer/Installer/Model.cs
+++ b/installer/Installer/Model.cs
@@ -31,6 +31,8 @@ using WebConnect;
using System.IO.Compression;
using ICSharpCode.SharpZipLib.Tar;
using ICSharpCode.SharpZipLib.GZip;
+using static System.Net.WebRequestMethods;
+using File = System.IO.File;
namespace starter.viewmodel.settings
{
@@ -656,6 +658,7 @@ namespace Downloader
//Console.WriteLine(filename + "下载完毕!" + Environment.NewLine);
updateFile++;
}
+ UpdatePlanned = false;
}
catch (CosClientException clientEx)
{
@@ -808,6 +811,16 @@ namespace Downloader
sw.Write(JsonConvert.SerializeObject(dict));
Check();
Download();
+ if (File.Exists(Data.FilePath + "/THUAI6/AI.cpp"))
+ {
+ FileInfo userCpp = new FileInfo((Data.FilePath + "/THUAI6/AI.cpp").Replace("/", "\\"));
+ userCpp.MoveTo(Data.FilePath + "/THUAI6/win/CAPI/cpp/API/src/AI.cpp", true);
+ }
+ if (File.Exists(Data.FilePath + "/THUAI6/AI.py"))
+ {
+ FileInfo userCpp = new FileInfo((Data.FilePath + "/THUAI6/AI.py").Replace("/", "\\"));
+ userCpp.MoveTo(Data.FilePath + "/THUAI6/win/CAPI/python/PyAPI/AI.cpp", true);
+ }
}
public static void Change_all_hash(string topDir, Dictionary jsonDict) // 更改HASH
@@ -887,7 +900,7 @@ namespace Downloader
public static int DeleteAll()
{
- DirectoryInfo di = new DirectoryInfo(Data.FilePath);
+ DirectoryInfo di = new DirectoryInfo(Data.FilePath + "/THUAI6");
//DirectoryInfo player = new DirectoryInfo(System.IO.Path.GetFullPath(System.IO.Path.Combine(Data.FilePath, playerFolder)));
FileInfo[] allfile = di.GetFiles();
try
@@ -902,10 +915,16 @@ namespace Downloader
//}
file.Delete();
}
+ FileInfo userFileCpp = new FileInfo(Data.FilePath + "/THUAI6/win/CAPI/cpp/API/src/AI.cpp");
+ FileInfo userFilePy = new FileInfo(Data.FilePath + "/THUAI6/win/CAPI/python/PyAPI/AI.py");
+ userFileCpp.MoveTo(System.IO.Path.Combine(Data.FilePath + "/THUAI6", System.IO.Path.GetFileName(userFileCpp.FullName)));
+ userFilePy.MoveTo(System.IO.Path.Combine(Data.FilePath + "/THUAI6", System.IO.Path.GetFileName(userFilePy.FullName)));
foreach (DirectoryInfo subdi in di.GetDirectories())
{
subdi.Delete(true);
}
+ FileInfo hashFile = new FileInfo(Data.FilePath + "/hash.json");
+ hashFile.Delete();
}
catch (UnauthorizedAccessException)
{
diff --git a/installer/Installer/ViewModel.cs b/installer/Installer/ViewModel.cs
index 115286c..8b735be 100644
--- a/installer/Installer/ViewModel.cs
+++ b/installer/Installer/ViewModel.cs
@@ -12,6 +12,7 @@ using System.ComponentModel;
using Installer;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using System.IO;
+using System.Windows.Automation.Provider;
namespace starter.viewmodel.settings
{
@@ -250,6 +251,20 @@ namespace starter.viewmodel.settings
}
}
}
+ public string AbortOrSelLanguage
+ {
+ get
+ {
+ string ans = "";
+ if (obj.UploadReady)
+ ans = "放弃上传";
+ else if (obj.launchLanguage == SettingsModel.LaunchLanguage.cpp)
+ ans = "语言:c++";
+ else if (obj.launchLanguage == SettingsModel.LaunchLanguage.python)
+ ans = "语言:python";
+ return ans;
+ }
+ }
public int PlayerNum
{
get
@@ -504,10 +519,18 @@ namespace starter.viewmodel.settings
}
else if (type == "File")
{
- var openFileDialog = new Microsoft.Win32.OpenFileDialog()
+
+ var openFileDialog = new Microsoft.Win32.OpenFileDialog();
+ if (obj.launchLanguage == SettingsModel.LaunchLanguage.cpp)
+ {
+ openFileDialog.InitialDirectory = (Route + "/THUAI6/win/CAPI/cpp/API/src/").Replace("/", "\\");
+ openFileDialog.Filter = "c++ Source Files (.cpp)|*.cpp|c++ Header File (.h)|*.h|python Source File (.py)|*.py";
+ }
+ else if (obj.launchLanguage == SettingsModel.LaunchLanguage.python)
{
- Filter = "c++ Source Files (.cpp)|*.cpp|c++ Header File (.h)|*.h|python Source File (.py)|*.py"
- };
+ openFileDialog.InitialDirectory = (Route + "/THUAI6/win/CAPI/python/PyAPI/").Replace("/", "\\");
+ openFileDialog.Filter = "python Source File (.py)|*.py|c++ Source Files (.cpp)|*.cpp|c++ Header File (.h)|*.h";
+ }
var result = openFileDialog.ShowDialog();
if (result == true)
{
@@ -658,7 +681,7 @@ namespace starter.viewmodel.settings
break;
case 0:
Status = SettingsModel.Status.newUser;
- MessageBox.Show($"删除成功!player文件夹中的文件已经放在{Downloader.Program.ProgramName}的根目录下", "", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
+ MessageBox.Show($"删除成功!player文件夹中的文件已经放在{Downloader.Program.Data.FilePath}/{Downloader.Program.ProgramName}的根目录下", "", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
break;
default:
Status = SettingsModel.Status.error;
@@ -833,6 +856,7 @@ namespace starter.viewmodel.settings
this.RaisePropertyChanged("UploadBtnCont");
this.RaisePropertyChanged("UploadReadyVis");
this.RaisePropertyChanged("CoverVis");
+ this.RaisePropertyChanged("AbortOrSelLanguage");
}
}
else
@@ -845,6 +869,7 @@ namespace starter.viewmodel.settings
this.RaisePropertyChanged("UploadReadyVis");
this.RaisePropertyChanged("CodeName");
this.RaisePropertyChanged("CoverVis");
+ this.RaisePropertyChanged("AbortOrSelLanguage");
}
else
{
@@ -856,24 +881,38 @@ namespace starter.viewmodel.settings
return clickUploadCommand;
}
}
- private BaseCommand clickReselectCommand;
- public BaseCommand ClickReselectCommand
+ private BaseCommand clickAboutUploadCommand;
+ public BaseCommand ClickAboutUploadCommand
{
get
{
- if (clickReselectCommand == null)
+ if (clickAboutUploadCommand == null)
{
- clickReselectCommand = new BaseCommand(new Action