Skip to content
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

feat: basic structure of logic #11

Merged
merged 19 commits into from
Oct 28, 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
404 changes: 404 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
| 子目录 | 说明 | 主要开发组 |
| :--------: | :--------------------------------------------------------: | :----------------------------: |
| .github | CI,用于选手包同步到服务器上供选手下载 | 运维组 |
| CAPI | 选手接口,生成可执行文件 | 通信组 |
| docs | 比赛的说明文档 | 逻辑组、通信组、运维组、界面组 |
| CAPI | 选手接口,生成可执行文件 | 通信组 |
| docs | 比赛的说明文档 | 逻辑组、通信组、运维组、界面组 |
| dependency | 项目依赖文件,如 proto、dll、lib、dockerfile、shell 脚本等 | 逻辑组、通信组、运维组、界面组 |
| installer | 下载器,用于选手包的下载与更新,生成可执行文件 | 运维组 |
| interface | Unity 界面 | 界面组 |
| launcher | 游戏启动器,用于快速启动游戏,生成可执行文件 | 运维组 |
| logic | 游戏逻辑、Server,生成可执行文件 | 通信组、逻辑组 |
| playback | 游戏回放组件,生成类库 | 逻辑组 |
| logic | 游戏逻辑、Server,生成可执行文件 | 通信组、逻辑组 |
| playback | 游戏回放组件,生成类库 | 逻辑组 |
| resource | 资源文件目录,用于存储主目录下 README 所用图片 | 端茶倒水 |

### 分支管理
Expand Down Expand Up @@ -137,11 +137,11 @@ THUAI7 开发组成员与其他贡献者应当遵循以下流程:

仓库的文档使用 Markdown 语法,具体语法可以参照 [Markdown 语法文档](https://docs.github.com/zh/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax)。

中文文档的书写须严格遵循:[中午技术文档规范](https://github.com/ruanyf/document-style-guide)、[中文文案排版指北](https://mazhuang.org/wiki/chinese-copywriting-guidelines/),以写出更美观的中文文档。例如:[中文文字与西文文字间空格](https://github.com/ruanyf/document-style-guide/blob/master/docs/text.md#%E5%AD%97%E9%97%B4%E8%B7%9D)、[全角标点符号的正确使用](https://github.com/ruanyf/document-style-guide/blob/master/docs/marks.md),等等。
中文文档的书写须严格遵循:[中文技术文档规范](https://github.com/ruanyf/document-style-guide)、[中文文案排版指北](https://mazhuang.org/wiki/chinese-copywriting-guidelines/),以写出更美观的中文文档。例如:[中文文字与西文文字间空格](https://github.com/ruanyf/document-style-guide/blob/master/docs/text.md#%E5%AD%97%E9%97%B4%E8%B7%9D)、[全角标点符号的正确使用](https://github.com/ruanyf/document-style-guide/blob/master/docs/marks.md),等等。

西文文档的书写须遵循:

+ 在 [中午技术文档规范](https://github.com/ruanyf/document-style-guide) 和 [中文文案排版指北](https://mazhuang.org/wiki/chinese-copywriting-guidelines/) 中规定的数字和西文的规范
+ 在 [中文技术文档规范](https://github.com/ruanyf/document-style-guide) 和 [中文文案排版指北](https://mazhuang.org/wiki/chinese-copywriting-guidelines/) 中规定的数字和西文的规范
+ 半角空格的标点符号的使用:
+ 半角的逗号 `,`、分号 `;`、句号 `.`、叹号 `!`、问号 `?` 等标点,在不位于行尾时,后需加空格,除非其后紧跟全角标点符号。例如:`"Hello, world",是一句学习编程语言常用的句子`
+ 半角的括号 `()`、`[]`、`{}`、`<>` 等在左半括号前加空格、右半括号后加空格,除非其空格处紧跟全角标点符号或位于行首或行尾。例如:`Tsinghua University (THU) and Peking University (PKU)(我是全角括号)`
Expand Down
50 changes: 25 additions & 25 deletions dependency/proto/Proto.sln
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32328.378
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Proto", "Proto.csproj", "{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CB1C0B2E-5D0E-4420-94B5-FE8AECC7E106}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32328.378
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Proto", "Proto.csproj", "{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CB1C0B2E-5D0E-4420-94B5-FE8AECC7E106}
EndGlobalSection
EndGlobal
68 changes: 34 additions & 34 deletions dependency/proto/Protos.csproj
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<!--<ItemGroup>
<None Remove="Message2Clients.proto" />
<None Remove="Message2Server.proto" />
<None Remove="MessageType.proto" />
<None Remove="Services.proto" />
</ItemGroup>-->
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.24.4" />
<PackageReference Include="Grpc" Version="2.46.6" />
<PackageReference Include="Grpc.Core" Version="2.46.6" />
<PackageReference Include="Grpc.Tools" Version="2.54.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Protobuf Include="Message2Clients.proto" />
<Protobuf Include="Message2Server.proto" />
<Protobuf Include="MessageType.proto" />
<Protobuf Include="Services.proto" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<!--<ItemGroup>
<None Remove="Message2Clients.proto" />
<None Remove="Message2Server.proto" />
<None Remove="MessageType.proto" />
<None Remove="Services.proto" />
</ItemGroup>-->

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.24.4" />
<PackageReference Include="Grpc" Version="2.46.6" />
<PackageReference Include="Grpc.Core" Version="2.46.6" />
<PackageReference Include="Grpc.Tools" Version="2.54.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Protobuf Include="Message2Clients.proto" />
<Protobuf Include="Message2Server.proto" />
<Protobuf Include="MessageType.proto" />
<Protobuf Include="Services.proto" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

## 中文文档

中文文档的书写须严格遵循:[中午技术文档规范](https://github.com/ruanyf/document-style-guide)、[中文文案排版指北](https://mazhuang.org/wiki/chinese-copywriting-guidelines/),以写出更美观的中文文档。例如:[中文文字与西文文字间空格](https://github.com/ruanyf/document-style-guide/blob/master/docs/text.md#%E5%AD%97%E9%97%B4%E8%B7%9D)、[全角标点符号的正确使用](https://github.com/ruanyf/document-style-guide/blob/master/docs/marks.md),等等。
中文文档的书写须严格遵循:[中文技术文档规范](https://github.com/ruanyf/document-style-guide)、[中文文案排版指北](https://mazhuang.org/wiki/chinese-copywriting-guidelines/),以写出更美观的中文文档。例如:[中文文字与西文文字间空格](https://github.com/ruanyf/document-style-guide/blob/master/docs/text.md#%E5%AD%97%E9%97%B4%E8%B7%9D)、[全角标点符号的正确使用](https://github.com/ruanyf/document-style-guide/blob/master/docs/marks.md),等等。

## 西文文档

西文文档的书写须遵循:

+ 在 [中午技术文档规范](https://github.com/ruanyf/document-style-guide) 和 [中文文案排版指北](https://mazhuang.org/wiki/chinese-copywriting-guidelines/) 中规定的数字和西文的规范
+ 在 [中文技术文档规范](https://github.com/ruanyf/document-style-guide) 和 [中文文案排版指北](https://mazhuang.org/wiki/chinese-copywriting-guidelines/) 中规定的数字和西文的规范
+ 半角空格的标点符号的使用:
+ 半角的逗号 `,`、分号 `;`、句号 `.`、叹号 `!`、问号 `?` 等标点,在不位于行尾时,后需加空格,除非其后紧跟全角标点符号。例如:`"Hello, world",是一句学习编程语言常用的句子`
+ 半角的括号 `()`、`[]`、`{}`、`<>` 等在左半括号前加空格、右半括号后加空格,除非其空格处紧跟全角标点符号或位于行首或行尾。例如:`Tsinghua University (THU) and Peking University (PKU)(我是全角括号)`
2 changes: 2 additions & 0 deletions docs/temp.url
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://thuai7.panxuc.com/
37 changes: 37 additions & 0 deletions logic/Client/Client.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32328.378
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client", "Client.csproj", "{5AD8481D-90EF-410C-BD48-355DB97EEAB3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Playback", "..\..\playback\Playback\Playback.csproj", "{662FDB27-FBF3-4D2D-BDA4-B4BF4D35B866}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Protos", "..\..\dependency\proto\Protos.csproj", "{A0F72D3B-9A82-48EB-90AF-B3770151AD83}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5AD8481D-90EF-410C-BD48-355DB97EEAB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5AD8481D-90EF-410C-BD48-355DB97EEAB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5AD8481D-90EF-410C-BD48-355DB97EEAB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5AD8481D-90EF-410C-BD48-355DB97EEAB3}.Release|Any CPU.Build.0 = Release|Any CPU
{662FDB27-FBF3-4D2D-BDA4-B4BF4D35B866}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{662FDB27-FBF3-4D2D-BDA4-B4BF4D35B866}.Debug|Any CPU.Build.0 = Debug|Any CPU
{662FDB27-FBF3-4D2D-BDA4-B4BF4D35B866}.Release|Any CPU.ActiveCfg = Release|Any CPU
{662FDB27-FBF3-4D2D-BDA4-B4BF4D35B866}.Release|Any CPU.Build.0 = Release|Any CPU
{A0F72D3B-9A82-48EB-90AF-B3770151AD83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0F72D3B-9A82-48EB-90AF-B3770151AD83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0F72D3B-9A82-48EB-90AF-B3770151AD83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0F72D3B-9A82-48EB-90AF-B3770151AD83}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {89A74B1B-445C-49EB-9C93-506DC243C227}
EndGlobalSection
EndGlobal
Binary file added logic/Client/Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions logic/GameClass/GameObj/Areas/AreaFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Preparation.Utility;

namespace GameClass.GameObj.Areas;

public static class AreaFactory
{
public static Immovable GetArea(XY pos, PlaceType placeType) => placeType switch
{
PlaceType.Home => new Home(pos),
PlaceType.Ruin => new Ruin(pos),
PlaceType.Shadow => new Shadow(pos),
PlaceType.Asteroid => new Asteroid(pos),
PlaceType.Resource => new Resource(pos),
PlaceType.Construction => new Construction(pos),
PlaceType.Wormhole => new Wormhole(pos),
_ => throw new System.NotImplementedException()
};
public static OutOfBoundBlock GetOutOfBoundBlock(XY pos) => new(pos);
}
14 changes: 14 additions & 0 deletions logic/GameClass/GameObj/Areas/Asteroid.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Preparation.Utility;
using System;

namespace GameClass.GameObj.Areas;

public class Asteroid : Immovable
{
public override bool IsRigid => true;
public override ShapeType Shape => ShapeType.Square;
public Asteroid(XY initPos)
: base(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Asteroid)
{
}
}
17 changes: 17 additions & 0 deletions logic/GameClass/GameObj/Areas/Construction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Preparation.Utility;
using System;

namespace GameClass.GameObj.Areas;

public class Construction : Immovable
{
public LongWithVariableRange HP => throw new NotImplementedException();
public override bool IsRigid => constructionType == ConstructionType.Community;
public override ShapeType Shape => ShapeType.Square;
private ConstructionType constructionType = ConstructionType.Null;
public ConstructionType ConstructionType => constructionType;
public Construction(XY initPos)
: base(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Construction)
{
}
}
22 changes: 22 additions & 0 deletions logic/GameClass/GameObj/Areas/Home.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Preparation.Interface;
using Preparation.Utility;
using System;

namespace GameClass.GameObj.Areas;

public class Home : Immovable, IHome
{
public AtomicLong TeamID => throw new NotImplementedException();
public LongWithVariableRange HP => throw new NotImplementedException();
public long Score => throw new NotImplementedException();
public override bool IsRigid => false;
public override ShapeType Shape => ShapeType.Square;
public void AddScore(long add)
{
throw new NotImplementedException();
}
public Home(XY initPos)
: base(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Home)
{
}
}
17 changes: 17 additions & 0 deletions logic/GameClass/GameObj/Areas/OutOfBoundBlock.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Preparation.Interface;
using Preparation.Utility;

namespace GameClass.GameObj.Areas;

/// <summary>
/// 逻辑墙
/// </summary>
public class OutOfBoundBlock : Immovable, IOutOfBound
{
public override bool IsRigid => true;
public override ShapeType Shape => ShapeType.Square;
public OutOfBoundBlock(XY initPos)
: base(initPos, int.MaxValue, GameObjType.OutOfBoundBlock)
{
}
}
14 changes: 14 additions & 0 deletions logic/GameClass/GameObj/Areas/Resource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Preparation.Utility;
using System;

namespace GameClass.GameObj.Areas;

public class Resource : Immovable
{
public override bool IsRigid => true;
public override ShapeType Shape => ShapeType.Square;
public Resource(XY initPos)
: base(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Resource)
{
}
}
14 changes: 14 additions & 0 deletions logic/GameClass/GameObj/Areas/Ruin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Preparation.Utility;
using System;

namespace GameClass.GameObj.Areas;

public class Ruin : Immovable
{
public override bool IsRigid => true;
public override ShapeType Shape => ShapeType.Square;
public Ruin(XY initPos)
: base(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Ruin)
{
}
}
14 changes: 14 additions & 0 deletions logic/GameClass/GameObj/Areas/Shadow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Preparation.Utility;
using System;

namespace GameClass.GameObj.Areas;

public class Shadow : Immovable
{
public override bool IsRigid => false;
public override ShapeType Shape => ShapeType.Square;
public Shadow(XY initPos)
: base(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Shadow)
{
}
}
19 changes: 19 additions & 0 deletions logic/GameClass/GameObj/Areas/Wormhole.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Preparation.Interface;
using Preparation.Utility;
using System;
using System.Collections.Generic;

namespace GameClass.GameObj.Areas;

public class Wormhole : Immovable, IWormhole
{
public LongWithVariableRange HP => throw new NotImplementedException();
public List<XY> Entrance => throw new NotImplementedException();
public List<XY> Content => throw new NotImplementedException();
public override bool IsRigid => HP > GameData.WormholeHP / 2;
public override ShapeType Shape => ShapeType.Square;
public Wormhole(XY initPos)
: base(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Wormhole)
{
}
}
Loading
Loading