Skip to content

Commit 961f0d6

Browse files
authored
Merge branch 'dev' into patch
2 parents 1790ba9 + 765bb84 commit 961f0d6

File tree

16 files changed

+510
-70
lines changed

16 files changed

+510
-70
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
name: deploy
22
on:
33
push:
4-
branches: [dev, main, master]
5-
pull_request:
6-
branches: [dev, main, master]
4+
branches: [main, master]
75

8-
env:
9-
version: 1.1.0.0
106

117
jobs:
128
deploy-to-tencent-cos:
@@ -29,8 +25,6 @@ jobs:
2925
mkdir D:\a\publish
3026
- name: Copy THUAI7
3127
run: Copy-Item -recurse D:\a\THUAI7\THUAI7\ D:\a\mirror\
32-
- name: Test
33-
run: tree D:\a\mirror
3428
- name: Remove directories not needed
3529
run: |
3630
Remove-Item -recurse -force D:\a\mirror\.git
@@ -45,15 +39,8 @@ jobs:
4539
- name: Build Client
4640
run: dotnet publish "./logic/Client/Client.csproj" -o "D:\a\mirror\logic\Client" -f net8.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true
4741
- name: Deploy to bucket
48-
run: dotnet run --project "./dependency/deploy/deploy.csproj" ${{ secrets.INSTALLER_COS_SECRET_ID }} ${{ secrets.INSTALLER_COS_SECRET_KEY }}
42+
run: dotnet run --project "./dependency/deploy/deploy.csproj" ${{ secrets.INSTALLER_COS_SECRET_ID }} ${{ secrets.INSTALLER_COS_SECRET_KEY }} "check"
4943
- name: Get installer package(No Key contained for safety)
5044
run: |
51-
$version=Get-ChildItem -Path D:\a\publish | ForEach-Object { $_.name }
52-
[Environment]::SetEnvironmentVariable("version", $version, "Machine")
53-
dotnet publish "./installer/installer.csproj" -o "D:\a\installer" -f net8.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true
54-
./dependency/7z/7za.exe a -r D:\a\publish\Installer_v${version}.zip D:\a\installer\*
55-
- name: Upload installer package
56-
uses: actions/upload-artifact@v4
57-
with:
58-
name: Installer_v${{ env.version }}.zip
59-
path: D:\a\publish\Installer_v${{ env.version }}.zip
45+
dotnet publish "./installer/installer.csproj" -o "D:\a\publish" -f net8.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true
46+
dotnet run --project "./dependency/deploy/deploy.csproj" ${{ secrets.INSTALLER_COS_SECRET_ID }} ${{ secrets.INSTALLER_COS_SECRET_KEY }} "upload"

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ GitLink 镜像地址:[THUAI7: GitLink Mirror](https://www.gitlink.org.cn/EESAS
1111

1212
## 赛题背景
1313

14-
待定
14+
![thuai7](resource/THUAI7.png)
15+
16+
在不久的未来,随着 AI 技术的飞速发展,人类探索太空的步伐也大大加快。太空安全对于国家安全的重要性与日俱增,因此,太空建设也成为了各国的重要任务。在这个全新的赛场上,由 AI 控制的高度自动化的太空舰船成为了竞技的主力。它们可以在太空中自由穿梭,执行各种任务,如资源采集、建筑建造、太空战斗等。 新领域的探索总是伴随着风险,太空中的舰船也不例外。在太空中,舰船之间的距离遥远,通讯延迟巨大,因此,舰船之间的冲突往往是在瞬息之间决定胜负。在这个竞技场上,AI 的控制能力、决策速度、战术策略等都将成为决定胜负的关键。
17+
18+
在远离地球的太空中,为了建立起牢固的防线,保卫美好的家园,一场激烈的战斗即将打响。你将扮演舰队指挥官,带领你的舰队在太空中展开一场激烈的战斗,为了最终的胜利,你需要制定合理的战术策略,部署舰船,利用资源,应对敌人的进攻,最终摧毁敌人的基地,夺取最终的胜利。
1519

1620
## 比赛规则
1721

18-
待定
22+
https://docs.eesast.com/docs/contests/THUAI7/
1923

2024
## 软件架构
2125

dependency/deploy/Program.cs

Lines changed: 62 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using installer.Services;
44
using System.Collections.Concurrent;
55
using System.Diagnostics;
6+
using System.IO.Compression;
67

78
Logger Log = LoggerProvider.FromConsole();
89

@@ -17,56 +18,74 @@
1718
d.Log.Partner.Add(Log);
1819
// 每次更新需要更新默认值
1920
d.CurrentVersion = new TVersion();
20-
File.Create(Path.Combine("D:\\a\\publish", d.CurrentVersion.InstallerVersion.ToString()));
2121

22-
if (d.CheckUpdate())
22+
switch (args[2])
2323
{
24-
foreach (var r in d.Data.MD5Update)
25-
{
26-
Log.LogInfo($"{r.state}, {r.name}");
27-
}
24+
case "check":
2825

29-
d.Data.SaveMD5Data();
30-
List<Task> l = new List<Task>();
31-
foreach (var r in d.Data.MD5Update)
32-
{
33-
var n = r.name.Replace('\\', '/');
34-
n = n.TrimStart('.').TrimStart('/');
35-
if (r.state == System.Data.DataRowState.Added || r.state == System.Data.DataRowState.Modified)
26+
if (d.CheckUpdate())
3627
{
37-
l.Add(Cloud.UploadFileAsync(Path.Combine(d.Data.Config.InstallPath, r.name), n));
28+
foreach (var r in d.Data.MD5Update)
29+
{
30+
Log.LogInfo($"{r.state}, {r.name}");
31+
}
32+
33+
d.Data.SaveMD5Data();
34+
List<Task> l = new List<Task>();
35+
foreach (var r in d.Data.MD5Update)
36+
{
37+
var n = r.name.Replace('\\', '/');
38+
n = n.TrimStart('.').TrimStart('/');
39+
if (r.state == System.Data.DataRowState.Added || r.state == System.Data.DataRowState.Modified)
40+
{
41+
l.Add(Cloud.UploadFileAsync(Path.Combine(d.Data.Config.InstallPath, r.name), n));
42+
}
43+
else if (r.state == System.Data.DataRowState.Deleted)
44+
{
45+
l.Add(Cloud.DeleteFileAsync(n));
46+
}
47+
}
48+
Task.WaitAll(l.ToArray());
3849
}
39-
else if (r.state == System.Data.DataRowState.Deleted)
50+
else
4051
{
41-
l.Add(Cloud.DeleteFileAsync(n));
52+
Log.LogInfo("Nothing to update");
4253
}
43-
}
44-
Task.WaitAll(l.ToArray());
45-
}
46-
else
47-
{
48-
Log.LogInfo("Nothing to update");
49-
}
5054

51-
d.Data.SaveMD5Data();
52-
Cloud.UploadFile(d.Data.MD5DataPath, "hash.json");
55+
d.Data.SaveMD5Data();
56+
Cloud.UploadFile(d.Data.MD5DataPath, "hash.json");
5357

54-
Cloud.UploadFile(Path.Combine(d.Data.Config.InstallPath, "CAPI", "cpp", "API", "src", "AI.cpp"),
55-
$"Templates/t.{d.CurrentVersion.TemplateVersion}.cpp");
56-
Cloud.UploadFile(Path.Combine(d.Data.Config.InstallPath, "CAPI", "python", "PyAPI", "AI.py"),
57-
$"Templates/t.{d.CurrentVersion.TemplateVersion}.py");
58-
Log.LogInfo("User code uploaded.");
58+
Cloud.UploadFile(Path.Combine(d.Data.Config.InstallPath, "CAPI", "cpp", "API", "src", "AI.cpp"),
59+
$"Templates/t.{d.CurrentVersion.TemplateVersion}.cpp");
60+
Cloud.UploadFile(Path.Combine(d.Data.Config.InstallPath, "CAPI", "python", "PyAPI", "AI.py"),
61+
$"Templates/t.{d.CurrentVersion.TemplateVersion}.py");
62+
Log.LogInfo("User code uploaded.");
5963

60-
var list = (from i in d.Data.MD5Data
61-
select i.Key.Replace(Path.DirectorySeparatorChar, '/').TrimStart('.').TrimStart('/')).ToArray();
62-
Log.LogInfo(list[0]);
63-
using (FileStream s = new FileStream(Path.Combine(d.Data.Config.InstallPath, "compress.csv"), FileMode.Create, FileAccess.Write))
64-
using (StreamWriter w = new StreamWriter(s))
65-
{
66-
foreach (var item in list)
67-
{
68-
w.WriteLine("https://thuai7-1319625962.cos.ap-beijing.myqcloud.com/" + item);
69-
}
70-
}
71-
Cloud.UploadFile(Path.Combine(d.Data.Config.InstallPath, "compress.csv"), "compress.csv");
72-
Log.LogInfo("Compress csv generated.");
64+
var list = (from i in d.Data.MD5Data
65+
select i.Key.Replace(Path.DirectorySeparatorChar, '/').TrimStart('.').TrimStart('/')).ToArray();
66+
Log.LogInfo(list[0]);
67+
using (FileStream s = new FileStream(Path.Combine(d.Data.Config.InstallPath, "compress.csv"), FileMode.Create, FileAccess.Write))
68+
using (StreamWriter w = new StreamWriter(s))
69+
{
70+
foreach (var item in list)
71+
{
72+
w.WriteLine("https://thuai7-1319625962.cos.ap-beijing.myqcloud.com/" + item);
73+
}
74+
}
75+
Cloud.UploadFile(Path.Combine(d.Data.Config.InstallPath, "compress.csv"), "compress.csv");
76+
Log.LogInfo("Compress csv generated.");
77+
break;
78+
case "upload":
79+
d.UpdateMD5();
80+
if (d.Data.FileHashData.TVersion.InstallerVersion < d.CurrentVersion.InstallerVersion)
81+
{
82+
Cloud.DownloadFile(@"D:\a\publish\Secret.csv", "Secret.csv");
83+
ZipFile.CreateFromDirectory(@"D:\a\publish", @$"D:\a\Installer_v{d.CurrentVersion.InstallerVersion}.zip", CompressionLevel.SmallestSize, false);
84+
Cloud.UploadFile(@$"D:\a\Installer_v{d.CurrentVersion.InstallerVersion}.zip", $"Setup/Installer_v{d.CurrentVersion.InstallerVersion}.zip");
85+
}
86+
else
87+
{
88+
Log.LogInfo("No installer version update found.");
89+
}
90+
break;
91+
}

installer/Data/MD5FileData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class TVersion
3232
public Version TemplateVersion = new Version(1, 0, 0, 3);
3333
// 本体版本
3434
[JsonInclude]
35-
public Version InstallerVersion = new Version(1, 1, 0, 0);
35+
public Version InstallerVersion = new Version(1, 1, 0, 2);
3636
public static bool operator <(TVersion l, TVersion r)
3737
{
3838
return l.LibVersion < r.LibVersion || l.TemplateVersion < r.TemplateVersion || l.InstallerVersion < r.InstallerVersion;

installer/ViewModel/DebugViewModel.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,14 @@ private void ServerExited(object? sender, EventArgs e)
273273
protected Process? server;
274274
public event EventHandler? OnServerLaunched;
275275
public event EventHandler? OnServerExited;
276+
276277
public bool LaunchServer()
277278
{
278279
server = Process.Start(new ProcessStartInfo()
279280
{
280281
FileName = Downloader.Data.Config.DevServerPath ?? Path.Combine(Downloader.Data.Config.InstallPath, "logic", "Server", "Server.exe"),
281282
Arguments = $"--ip 0.0.0.0 --port {Port} --teamCount {TeamCount} --shipNum {ShipCount}",
283+
WorkingDirectory = Downloader.Data.Config.InstallPath
282284
});
283285
if (server is null)
284286
{
@@ -296,7 +298,6 @@ public bool LaunchServer()
296298
return true;
297299
}
298300

299-
300301
public bool LaunchClient(int team, int player, int ship)
301302
{
302303
Downloader.Data.Config.Commands.TeamID = team;
@@ -313,6 +314,7 @@ public bool LaunchClient(int team, int player, int ship)
313314
var client = Process.Start(new ProcessStartInfo()
314315
{
315316
FileName = Downloader.Data.Config.DevClientPath ?? Path.Combine(Downloader.Data.Config.InstallPath, "logic", "Client", "Client.exe"),
317+
WorkingDirectory = Downloader.Data.Config.InstallPath
316318
});
317319
if (client is null)
318320
{
@@ -341,7 +343,8 @@ public bool LaunchCppAPI(int team, int player)
341343
var cpp = Process.Start(new ProcessStartInfo()
342344
{
343345
FileName = Downloader.Data.Config.DevCppPath ?? exe,
344-
Arguments = $"-I {IP} -P {Port} -t {team} -p {player} -o"
346+
Arguments = $"-I {IP} -P {Port} -t {team} -p {player} -o -d",
347+
WorkingDirectory = Downloader.Data.Config.InstallPath
345348
});
346349
if (cpp is null)
347350
{
@@ -379,7 +382,8 @@ public bool LaunchPyAPI(int team, int player)
379382
FileName = "cmd.exe",
380383
Arguments = "/c python "
381384
+ (Downloader.Data.Config.DevPyPath ?? Path.Combine(Downloader.Data.Config.InstallPath, "CAPI", "python", "PyAPI", "main.py"))
382-
+ $" -I {IP} -P {Port} -t {team} -p {player} -o"
385+
+ $" -I {IP} -P {Port} -t {team} -p {player} -o -d",
386+
WorkingDirectory = Downloader.Data.Config.InstallPath
383387
});
384388
if (py is null)
385389
{

interface/interface_playback/Assets/Plugins.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

interface/interface_playback/Assets/Scripts/Playback.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)