Skip to content

Commit

Permalink
Merge branch 'eesast:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
hhzzff authored May 15, 2024
2 parents d48c73c + 1a9db10 commit b79b6ea
Show file tree
Hide file tree
Showing 167 changed files with 4,718 additions and 2,027 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/debug.yml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
46 changes: 46 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: deploy
on:
push:
branches: [main, master]


jobs:
deploy-to-tencent-cos:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup dotnet-script
run: dotnet tool install --global dotnet-script
- name: Pre-Process
run: dotnet script .github/preProcess/MauiEnvConfig.csx
- name: Install Workloads
run: dotnet workload install maui-windows
- name: Create Folders need
run: |
mkdir D:\a\installer
mkdir D:\a\publish
- name: Copy THUAI7
run: Copy-Item -recurse D:\a\THUAI7\THUAI7\ D:\a\mirror\
- name: Remove directories not needed
run: |
Remove-Item -recurse -force D:\a\mirror\.git
Remove-Item -recurse D:\a\mirror\.github
Remove-Item -recurse D:\a\mirror\installer
Remove-Item -recurse D:\a\mirror\interface
Remove-Item -recurse D:\a\mirror\logic
- name: Build Server
run: |
mkdir D:\a\mirror\logic
dotnet build "./logic/Server/Server.csproj" -o "D:\a\mirror\logic\Server" -p:WindowsAppSDKSelfContained=true -c Release
- name: Build Client
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
- name: Deploy to bucket
run: dotnet run --project "./dependency/deploy/deploy.csproj" ${{ secrets.INSTALLER_COS_SECRET_ID }} ${{ secrets.INSTALLER_COS_SECRET_KEY }} "check"
- name: Get installer package(No Key contained for safety)
run: |
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
dotnet run --project "./dependency/deploy/deploy.csproj" ${{ secrets.INSTALLER_COS_SECRET_ID }} ${{ secrets.INSTALLER_COS_SECRET_KEY }} "upload"
13 changes: 9 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ jobs:
- name: Push cpp_compile image to DockerHub
run: docker push ${{ secrets.DOCKER_USERNAME }}/thuai7_cpp:latest

- name: Build run docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/thuai7_run:latest -f ./dependency/Dockerfile/Dockerfile_run .
- name: Push run image to DockerHub
run: docker push ${{ secrets.DOCKER_USERNAME }}/thuai7_run:latest
- name: Build run_server docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/thuai7_run_server:latest -f ./dependency/Dockerfile/Dockerfile_run_server .
- name: Push run_server image to DockerHub
run: docker push ${{ secrets.DOCKER_USERNAME }}/thuai7_run_server:latest

- name: Build run_client docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/thuai7_run_client:latest -f ./dependency/Dockerfile/Dockerfile_run_client .
- name: Push run_client image to DockerHub
run: docker push ${{ secrets.DOCKER_USERNAME }}/thuai7_run_client:latest
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v5
Expand Down
12 changes: 6 additions & 6 deletions CAPI/cpp/API/include/API.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ILogic
[[nodiscard]] virtual std::shared_ptr<const THUAI7::GameInfo> GetGameInfo() const = 0;
[[nodiscard]] virtual std::vector<int64_t> GetPlayerGUIDs() const = 0;
[[nodiscard]] virtual THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetWormholeHp(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetResourceState(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetHomeHp() const = 0;
Expand Down Expand Up @@ -97,7 +97,7 @@ class IAPI
[[nodiscard]] virtual std::vector<std::vector<THUAI7::PlaceType>> GetFullMap() const = 0;
[[nodiscard]] virtual std::shared_ptr<const THUAI7::GameInfo> GetGameInfo() const = 0;
[[nodiscard]] virtual THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetWormholeHp(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetResourceState(int32_t cellX, int32_t cellY) const = 0;
[[nodiscard]] virtual int32_t GetHomeHp() const = 0;
Expand Down Expand Up @@ -203,7 +203,7 @@ class ShipAPI : public IShipAPI, public IGameTimer
[[nodiscard]] std::vector<std::shared_ptr<const THUAI7::Bullet>> GetBullets() const override;
[[nodiscard]] std::vector<std::vector<THUAI7::PlaceType>> GetFullMap() const override;
[[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetWormholeHp(int32_t x, int32_t y) const override;
[[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] std::shared_ptr<const THUAI7::GameInfo> GetGameInfo() const override;
Expand Down Expand Up @@ -259,7 +259,7 @@ class TeamAPI : public ITeamAPI, public IGameTimer
[[nodiscard]] std::vector<std::shared_ptr<const THUAI7::Bullet>> GetBullets() const override;
[[nodiscard]] std::vector<std::vector<THUAI7::PlaceType>> GetFullMap() const override;
[[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetWormholeHp(int32_t x, int32_t y) const override;
[[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetHomeHp() const override;
Expand Down Expand Up @@ -320,7 +320,7 @@ class ShipDebugAPI : public IShipAPI, public IGameTimer
[[nodiscard]] std::vector<std::shared_ptr<const THUAI7::Bullet>> GetBullets() const override;
[[nodiscard]] std::vector<std::vector<THUAI7::PlaceType>> GetFullMap() const override;
[[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetWormholeHp(int32_t x, int32_t y) const override;
[[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetHomeHp() const override;
Expand Down Expand Up @@ -366,7 +366,7 @@ class TeamDebugAPI : public ITeamAPI, public IGameTimer
[[nodiscard]] std::vector<std::shared_ptr<const THUAI7::Bullet>> GetBullets() const override;
[[nodiscard]] std::vector<std::vector<THUAI7::PlaceType>> GetFullMap() const override;
[[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetWormholeHp(int32_t x, int32_t y) const override;
[[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const override;
[[nodiscard]] int32_t GetHomeHp() const override;
Expand Down
2 changes: 1 addition & 1 deletion CAPI/cpp/API/include/logic.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Logic : public ILogic
[[nodiscard]] std::shared_ptr<const THUAI7::GameInfo> GetGameInfo() const;
[[nodiscard]] THUAI7::PlaceType GetPlaceType(int32_t cellX, int32_t cellY) const;
[[nodiscard]] std::vector<int64_t> GetPlayerGUIDs() const;
[[nodiscard]] int32_t GetConstructionHp(int32_t cellX, int32_t cellY) const;
[[nodiscard]] std::pair<int32_t, int32_t> GetConstructionState(int32_t cellX, int32_t cellY) const;
[[nodiscard]] int32_t GetWormholeHp(int32_t cellX, int32_t cellY) const;
[[nodiscard]] int32_t GetResourceState(int32_t cellX, int32_t cellY) const;
[[nodiscard]] int32_t GetHomeHp() const;
Expand Down
1 change: 1 addition & 0 deletions CAPI/cpp/API/include/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct State
std::shared_ptr<THUAI7::GameMap> mapInfo;
std::shared_ptr<THUAI7::GameInfo> gameInfo;
std::vector<int64_t> guids;
std::vector<int64_t> allGuids;
};

#endif
2 changes: 2 additions & 0 deletions CAPI/cpp/API/include/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ namespace AssistFunction
THUAI7::PlaceType newPlace = map[GridToCell(newX)][GridToCell(newY)];
if (newPlace == THUAI7::PlaceType::Shadow && myPlace != THUAI7::PlaceType::Shadow)
return false;
if (distance > viewRange * viewRange)
return false;
int32_t divide = std::max(std::abs(deltaX), std::abs(deltaY)) / 100;
if (divide == 0)
return true;
Expand Down
10 changes: 5 additions & 5 deletions CAPI/cpp/API/src/API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ THUAI7::PlaceType TeamAPI::GetPlaceType(int32_t cellX, int32_t cellY) const
return logic.GetPlaceType(cellX, cellY);
}

int32_t ShipAPI::GetConstructionHp(int32_t cellX, int32_t cellY) const
std::pair<int32_t, int32_t> ShipAPI::GetConstructionState(int32_t cellX, int32_t cellY) const
{
return logic.GetConstructionHp(cellX, cellY);
return logic.GetConstructionState(cellX, cellY);
}

int32_t TeamAPI::GetConstructionHp(int32_t cellX, int32_t cellY) const
std::pair<int32_t, int32_t> TeamAPI::GetConstructionState(int32_t cellX, int32_t cellY) const
{
return logic.GetConstructionHp(cellX, cellY);
return logic.GetConstructionState(cellX, cellY);
}

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

// Team独有
Expand Down
4 changes: 2 additions & 2 deletions CAPI/cpp/API/src/Communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ bool Communication::BuildShip(int32_t teamID, THUAI7::ShipType ShipType, int32_t
auto request = THUAI72Proto::THUAI72ProtobufBuildShipMsg(teamID, ShipType, birthIndex);
auto status = THUAI7Stub->BuildShip(&context, request, &reply);
if (status.ok())
return true;
return reply.act_success();
else
return false;
}
Expand Down Expand Up @@ -274,4 +274,4 @@ protobuf::MessageToClient Communication::GetMessage2Client()
{ return haveNewMessage; });
haveNewMessage = false;
return message2Client;
}
}
10 changes: 5 additions & 5 deletions CAPI/cpp/API/src/DebugAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ THUAI7::PlaceType ShipDebugAPI::GetPlaceType(int32_t cellX, int32_t cellY) const
return logic.GetPlaceType(cellX, cellY);
}

int32_t ShipDebugAPI::GetConstructionHp(int32_t cellX, int32_t cellY) const
std::pair<int32_t, int32_t> ShipDebugAPI::GetConstructionState(int32_t cellX, int32_t cellY) const
{
return logic.GetConstructionHp(cellX, cellY);
return logic.GetConstructionState(cellX, cellY);
}

int32_t ShipDebugAPI::GetWormholeHp(int32_t cellX, int32_t cellY) const
Expand Down Expand Up @@ -239,7 +239,7 @@ std::shared_ptr<const THUAI7::Ship> ShipDebugAPI::GetSelfInfo() const
bool ShipDebugAPI::HaveView(int32_t targetX, int32_t targetY) const
{
auto selfInfo = GetSelfInfo();
return logic.HaveView(targetX, targetY, selfInfo->x, selfInfo->y, selfInfo->viewRange);
return logic.HaveView(selfInfo->x, selfInfo->y, targetX, targetY, selfInfo->viewRange);
}

int32_t ShipDebugAPI::GetEnergy() const
Expand Down Expand Up @@ -395,9 +395,9 @@ THUAI7::PlaceType TeamDebugAPI::GetPlaceType(int32_t cellX, int32_t cellY) const
return logic.GetPlaceType(cellX, cellY);
}

int32_t TeamDebugAPI::GetConstructionHp(int32_t cellX, int32_t cellY) const
std::pair<int32_t, int32_t> TeamDebugAPI::GetConstructionState(int32_t cellX, int32_t cellY) const
{
return logic.GetConstructionHp(cellX, cellY);
return logic.GetConstructionState(cellX, cellY);
}

int32_t TeamDebugAPI::GetWormholeHp(int32_t cellX, int32_t cellY) const
Expand Down
Loading

0 comments on commit b79b6ea

Please sign in to comment.