Skip to content

Commit 8c26c78

Browse files
committed
Merge branch 'dev' of ssh://ssh.github.com:443/hhzzff/THUAI7 into dev
2 parents dd1d7b7 + b79b6ea commit 8c26c78

File tree

167 files changed

+4718
-2027
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+4718
-2027
lines changed

.github/workflows/debug.yml.disabled

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: CI
2+
on: [push]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- name: Setup .NET Core
9+
uses: actions/setup-dotnet@v4
10+
with:
11+
dotnet-version: 8.0.x
12+
- name: Setup tmate session
13+
uses: mxschmitt/action-tmate@v3

.github/workflows/deploy.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: deploy
2+
on:
3+
push:
4+
branches: [main, master]
5+
6+
7+
jobs:
8+
deploy-to-tencent-cos:
9+
runs-on: windows-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Setup .NET Core
13+
uses: actions/setup-dotnet@v4
14+
with:
15+
dotnet-version: 8.0.x
16+
- name: Setup dotnet-script
17+
run: dotnet tool install --global dotnet-script
18+
- name: Pre-Process
19+
run: dotnet script .github/preProcess/MauiEnvConfig.csx
20+
- name: Install Workloads
21+
run: dotnet workload install maui-windows
22+
- name: Create Folders need
23+
run: |
24+
mkdir D:\a\installer
25+
mkdir D:\a\publish
26+
- name: Copy THUAI7
27+
run: Copy-Item -recurse D:\a\THUAI7\THUAI7\ D:\a\mirror\
28+
- name: Remove directories not needed
29+
run: |
30+
Remove-Item -recurse -force D:\a\mirror\.git
31+
Remove-Item -recurse D:\a\mirror\.github
32+
Remove-Item -recurse D:\a\mirror\installer
33+
Remove-Item -recurse D:\a\mirror\interface
34+
Remove-Item -recurse D:\a\mirror\logic
35+
- name: Build Server
36+
run: |
37+
mkdir D:\a\mirror\logic
38+
dotnet build "./logic/Server/Server.csproj" -o "D:\a\mirror\logic\Server" -p:WindowsAppSDKSelfContained=true -c Release
39+
- name: Build Client
40+
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
41+
- name: Deploy to bucket
42+
run: dotnet run --project "./dependency/deploy/deploy.csproj" ${{ secrets.INSTALLER_COS_SECRET_ID }} ${{ secrets.INSTALLER_COS_SECRET_KEY }} "check"
43+
- name: Get installer package(No Key contained for safety)
44+
run: |
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"

.github/workflows/docker.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ jobs:
2222
- name: Push cpp_compile image to DockerHub
2323
run: docker push ${{ secrets.DOCKER_USERNAME }}/thuai7_cpp:latest
2424

25-
- name: Build run docker image
26-
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/thuai7_run:latest -f ./dependency/Dockerfile/Dockerfile_run .
27-
- name: Push run image to DockerHub
28-
run: docker push ${{ secrets.DOCKER_USERNAME }}/thuai7_run:latest
25+
- name: Build run_server docker image
26+
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/thuai7_run_server:latest -f ./dependency/Dockerfile/Dockerfile_run_server .
27+
- name: Push run_server image to DockerHub
28+
run: docker push ${{ secrets.DOCKER_USERNAME }}/thuai7_run_server:latest
29+
30+
- name: Build run_client docker image
31+
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/thuai7_run_client:latest -f ./dependency/Dockerfile/Dockerfile_run_client .
32+
- name: Push run_client image to DockerHub
33+
run: docker push ${{ secrets.DOCKER_USERNAME }}/thuai7_run_client:latest

.github/workflows/gh-pages.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
name: github-pages
3030
url: ${{ steps.deployment.outputs.page_url }}
3131
steps:
32-
- uses: actions/checkout@v3
32+
- uses: actions/checkout@v4
3333

3434
- name: Setup Pages
3535
uses: actions/configure-pages@v5

CAPI/cpp/API/include/API.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ILogic
4545
[[nodiscard]] virtual std::shared_ptr<const THUAI7::GameInfo> GetGameInfo() const = 0;
4646
[[nodiscard]] virtual std::vector<int64_t> GetPlayerGUIDs() const = 0;
4747
[[nodiscard]] virtual THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const = 0;
48-
[[nodiscard]] virtual int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const = 0;
48+
[[nodiscard]] virtual std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const = 0;
4949
[[nodiscard]] virtual int32_t GetWormholeHp(int32_t cellX, int32_t cellY) const = 0;
5050
[[nodiscard]] virtual int32_t GetResourceState(int32_t cellX, int32_t cellY) const = 0;
5151
[[nodiscard]] virtual int32_t GetHomeHp() const = 0;
@@ -97,7 +97,7 @@ class IAPI
9797
[[nodiscard]] virtual std::vector<std::vector<THUAI7::PlaceType>> GetFullMap() const = 0;
9898
[[nodiscard]] virtual std::shared_ptr<const THUAI7::GameInfo> GetGameInfo() const = 0;
9999
[[nodiscard]] virtual THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const = 0;
100-
[[nodiscard]] virtual int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const = 0;
100+
[[nodiscard]] virtual std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const = 0;
101101
[[nodiscard]] virtual int32_t GetWormholeHp(int32_t cellX, int32_t cellY) const = 0;
102102
[[nodiscard]] virtual int32_t GetResourceState(int32_t cellX, int32_t cellY) const = 0;
103103
[[nodiscard]] virtual int32_t GetHomeHp() const = 0;
@@ -203,7 +203,7 @@ class ShipAPI : public IShipAPI, public IGameTimer
203203
[[nodiscard]] std::vector<std::shared_ptr<const THUAI7::Bullet>> GetBullets() const override;
204204
[[nodiscard]] std::vector<std::vector<THUAI7::PlaceType>> GetFullMap() const override;
205205
[[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;
206-
[[nodiscard]] int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const override;
206+
[[nodiscard]] std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const override;
207207
[[nodiscard]] int32_t GetWormholeHp(int32_t x, int32_t y) const override;
208208
[[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const override;
209209
[[nodiscard]] std::shared_ptr<const THUAI7::GameInfo> GetGameInfo() const override;
@@ -259,7 +259,7 @@ class TeamAPI : public ITeamAPI, public IGameTimer
259259
[[nodiscard]] std::vector<std::shared_ptr<const THUAI7::Bullet>> GetBullets() const override;
260260
[[nodiscard]] std::vector<std::vector<THUAI7::PlaceType>> GetFullMap() const override;
261261
[[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;
262-
[[nodiscard]] int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const override;
262+
[[nodiscard]] std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const override;
263263
[[nodiscard]] int32_t GetWormholeHp(int32_t x, int32_t y) const override;
264264
[[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const override;
265265
[[nodiscard]] int32_t GetHomeHp() const override;
@@ -320,7 +320,7 @@ class ShipDebugAPI : public IShipAPI, public IGameTimer
320320
[[nodiscard]] std::vector<std::shared_ptr<const THUAI7::Bullet>> GetBullets() const override;
321321
[[nodiscard]] std::vector<std::vector<THUAI7::PlaceType>> GetFullMap() const override;
322322
[[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;
323-
[[nodiscard]] int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const override;
323+
[[nodiscard]] std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const override;
324324
[[nodiscard]] int32_t GetWormholeHp(int32_t x, int32_t y) const override;
325325
[[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const override;
326326
[[nodiscard]] int32_t GetHomeHp() const override;
@@ -366,7 +366,7 @@ class TeamDebugAPI : public ITeamAPI, public IGameTimer
366366
[[nodiscard]] std::vector<std::shared_ptr<const THUAI7::Bullet>> GetBullets() const override;
367367
[[nodiscard]] std::vector<std::vector<THUAI7::PlaceType>> GetFullMap() const override;
368368
[[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;
369-
[[nodiscard]] int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const override;
369+
[[nodiscard]] std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const override;
370370
[[nodiscard]] int32_t GetWormholeHp(int32_t x, int32_t y) const override;
371371
[[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const override;
372372
[[nodiscard]] int32_t GetHomeHp() const override;

CAPI/cpp/API/include/logic.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class Logic : public ILogic
9898
[[nodiscard]] std::shared_ptr<const THUAI7::GameInfo> GetGameInfo() const;
9999
[[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const;
100100
[[nodiscard]] std::vector<int64_t> GetPlayerGUIDs() const;
101-
[[nodiscard]] int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const;
101+
[[nodiscard]] std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const;
102102
[[nodiscard]] int32_t GetWormholeHp(int32_t cellX, int32_t cellY) const;
103103
[[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const;
104104
[[nodiscard]] int32_t GetHomeHp() const;

CAPI/cpp/API/include/state.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct State
2525
std::shared_ptr<THUAI7::GameMap> mapInfo;
2626
std::shared_ptr<THUAI7::GameInfo> gameInfo;
2727
std::vector<int64_t> guids;
28+
std::vector<int64_t> allGuids;
2829
};
2930

3031
#endif

CAPI/cpp/API/include/utils.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ namespace AssistFunction
4141
THUAI7::PlaceType newPlace = map[GridToCell(newX)][GridToCell(newY)];
4242
if (newPlace == THUAI7::PlaceType::Shadow && myPlace != THUAI7::PlaceType::Shadow)
4343
return false;
44+
if (distance > viewRange * viewRange)
45+
return false;
4446
int32_t divide = std::max(std::abs(deltaX), std::abs(deltaY)) / 100;
4547
if (divide == 0)
4648
return true;

CAPI/cpp/API/src/API.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ THUAI7::PlaceType TeamAPI::GetPlaceType(int32_t cellX, int32_t cellY) const
140140
return logic.GetPlaceType(cellX, cellY);
141141
}
142142

143-
int32_t ShipAPI::GetConstructionHp(int32_t cellX, int32_t cellY) const
143+
std::pair<int32_t, int32_t> ShipAPI::GetConstructionState(int32_t cellX, int32_t cellY) const
144144
{
145-
return logic.GetConstructionHp(cellX, cellY);
145+
return logic.GetConstructionState(cellX, cellY);
146146
}
147147

148-
int32_t TeamAPI::GetConstructionHp(int32_t cellX, int32_t cellY) const
148+
std::pair<int32_t, int32_t> TeamAPI::GetConstructionState(int32_t cellX, int32_t cellY) const
149149
{
150-
return logic.GetConstructionHp(cellX, cellY);
150+
return logic.GetConstructionState(cellX, cellY);
151151
}
152152

153153
int32_t ShipAPI::GetWormholeHp(int32_t cellX, int32_t cellY) const
@@ -290,7 +290,7 @@ std::future<bool> ShipAPI::Construct(THUAI7::ConstructionType constructionType)
290290
bool ShipAPI::HaveView(int32_t targetX, int32_t targetY) const
291291
{
292292
auto selfInfo = GetSelfInfo();
293-
return logic.HaveView(targetX, targetY, selfInfo->x, selfInfo->y, selfInfo->viewRange);
293+
return logic.HaveView(selfInfo->x, selfInfo->y, targetX, targetY, selfInfo->viewRange);
294294
}
295295

296296
// Team独有

CAPI/cpp/API/src/Communication.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ bool Communication::BuildShip(int32_t teamID, THUAI7::ShipType ShipType, int32_t
202202
auto request = THUAI72Proto::THUAI72ProtobufBuildShipMsg(teamID, ShipType, birthIndex);
203203
auto status = THUAI7Stub->BuildShip(&context, request, &reply);
204204
if (status.ok())
205-
return true;
205+
return reply.act_success();
206206
else
207207
return false;
208208
}
@@ -274,4 +274,4 @@ protobuf::MessageToClient Communication::GetMessage2Client()
274274
{ return haveNewMessage; });
275275
haveNewMessage = false;
276276
return message2Client;
277-
}
277+
}

CAPI/cpp/API/src/DebugAPI.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ THUAI7::PlaceType ShipDebugAPI::GetPlaceType(int32_t cellX, int32_t cellY) const
201201
return logic.GetPlaceType(cellX, cellY);
202202
}
203203

204-
int32_t ShipDebugAPI::GetConstructionHp(int32_t cellX, int32_t cellY) const
204+
std::pair<int32_t, int32_t> ShipDebugAPI::GetConstructionState(int32_t cellX, int32_t cellY) const
205205
{
206-
return logic.GetConstructionHp(cellX, cellY);
206+
return logic.GetConstructionState(cellX, cellY);
207207
}
208208

209209
int32_t ShipDebugAPI::GetWormholeHp(int32_t cellX, int32_t cellY) const
@@ -239,7 +239,7 @@ std::shared_ptr<const THUAI7::Ship> ShipDebugAPI::GetSelfInfo() const
239239
bool ShipDebugAPI::HaveView(int32_t targetX, int32_t targetY) const
240240
{
241241
auto selfInfo = GetSelfInfo();
242-
return logic.HaveView(targetX, targetY, selfInfo->x, selfInfo->y, selfInfo->viewRange);
242+
return logic.HaveView(selfInfo->x, selfInfo->y, targetX, targetY, selfInfo->viewRange);
243243
}
244244

245245
int32_t ShipDebugAPI::GetEnergy() const
@@ -395,9 +395,9 @@ THUAI7::PlaceType TeamDebugAPI::GetPlaceType(int32_t cellX, int32_t cellY) const
395395
return logic.GetPlaceType(cellX, cellY);
396396
}
397397

398-
int32_t TeamDebugAPI::GetConstructionHp(int32_t cellX, int32_t cellY) const
398+
std::pair<int32_t, int32_t> TeamDebugAPI::GetConstructionState(int32_t cellX, int32_t cellY) const
399399
{
400-
return logic.GetConstructionHp(cellX, cellY);
400+
return logic.GetConstructionState(cellX, cellY);
401401
}
402402

403403
int32_t TeamDebugAPI::GetWormholeHp(int32_t cellX, int32_t cellY) const

0 commit comments

Comments
 (0)