Skip to content

Commit

Permalink
Merge pull request eesast#261 from ONLOX/dev
Browse files Browse the repository at this point in the history
Update UI and Add Manual.md
  • Loading branch information
DreamEnderKing authored Apr 20, 2024
2 parents e858be3 + d79d608 commit 0cc35fc
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 18 deletions.
4 changes: 2 additions & 2 deletions installer/AppShell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
Title="Login"
ContentTemplate="{DataTemplate local:LoginPage}"/>

<ShellContent
<!-- <ShellContent
Title="Help"
ContentTemplate="{DataTemplate local:HelpPage}"/>
ContentTemplate="{DataTemplate local:HelpPage}"/> -->

</FlyoutItem>

Expand Down
31 changes: 31 additions & 0 deletions installer/Data/ConfigFileData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public class Player : NotificationObject
protected int teamID = 0;
protected int playerID = 0;
protected string playerMode = "API";
protected bool shipTypePickerEnabled = false;
protected int shipType = 0;
[JsonInclude]
public int TeamID
{
Expand Down Expand Up @@ -86,6 +88,35 @@ public string PlayerMode
set
{
playerMode = value;
if (playerMode == "API")
{
ShipTypePickerEnabled = false;
ShipType = 0;
}
else
{
ShipTypePickerEnabled = true;
}
OnPropertyChanged();
}
}
[JsonInclude]
public bool ShipTypePickerEnabled
{
get => shipTypePickerEnabled;
set
{
shipTypePickerEnabled = value;
OnPropertyChanged();
}
}
[JsonInclude]
public int ShipType
{
get => shipType;
set
{
shipType = value;
OnPropertyChanged();
}
}
Expand Down
60 changes: 60 additions & 0 deletions installer/Manual.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 下载器

- 第一次打开下载器后会在 `C:\Users\用户名\Documents\` 内生成文件夹 `THUAI7`,里面存放了下载器的一些配置信息,非必要不要手动修改。

## Installer

### 下载

下载和移动功能均需要选择空的文件夹路径。

- 第一次下载完成后,按钮上的 `下载` 会变为 `移动`。之后选择新的空文件夹路径将会进行移动操作。
- 如果第一次下载出现问题,且 `是否已下载选手包` 点亮,此时请关闭下载器,删除下载的选手包,将 `C:\Users\用户名\Documents\THUAI7\config.json` 中的 `"Installed": true` 改为 `"Installed": false`

### 更新

更新前需要先进行检查更新操作。

- **下载后不要对其他非空文件路径进行更新操作,这将会删除多余的文件**

第一次下载完成后,请检查更新,第一次下载的安装包通常版本较旧。

## Launcher

- C++:选手需要在 `%InstallPath%\CAPI\cpp\CAPI.sln` 中开发,且一般只需要修改 `%InstallPath%\CAPI\cpp\API\src\AI.cpp`,然后生成项目。
- Python:选手需要确保电脑已经安装了 `python``pip`,然后执行 `%InstallPath%\CAPI\python\generate_proto.cmd`(Windows) 或 `%InstallPath%\CAPI\python\generate_proto.cmd`(Mac/Linux),等待 protos 文件夹生成完毕,在 `%InstallPath%\CAPI\python\PyAPI\AI.py` 中开发。

当启动器中的 `IP` `Port` `Language` `Playback File` `Playback Speed` 被修改后,需要先点击 `保存`

### Debug

**启动器的正常工作可能需要管理员权限**

#### 一般调试流程

1. 输入 `IP``Port`,默认为 `127.0.0.1``8888`
2. 选择 `Server` 调整 `Team Count``Ship Count`,启动 *Server*
3. 选择 `Client` 加入对应的数量的 *Player*,调整各个 *Player* 的参数和 `Language` 后启动 *Client*
- *Player* 数量为 $\mathrm{TeamCount}*(\mathrm{ShipCount}+1)$, *Player* 全部加入后 *Server* 才会开始游戏
- `Player ID``0` 表示 `Home`,其他为 `Ship`
- `Player Mode``API` 表示选手在 *CAPI* 中写的代码;为 `Manual` 表示一个手动操控的 *Player*。手动操控模式下,`Player ID` 不能为 `0``Ship Type` 不能为 `0`,同时一台电脑不建议有多个手动操控的 *Player*

#### 联机调试流程

1. 多台电脑输入相同的 `IP``Port``IP` 可以通过在 cmd 中输入 `ipconfig` 查看
2. 其中一台电脑启动 *Server*
3. 所有电脑凑够对应数量的 *Player*,启动 *Client*

### Playback

每次调试后会在 `%InstallPath%\logic\Server` 中生成 `114514.thuai7.pb`,在 `Playback File` 中输入 `114514.thuai7.pb`,点击 `保存``启动`。也可以对回放文件进行改名,输入对应文件名即可。

## Login

暂时没有功能

## Other

欢迎在比赛群中提出有关比赛的各种问题!

**祝大家 Debug 快乐!**
32 changes: 27 additions & 5 deletions installer/Page/DebugPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
<Grid
HorizontalOptions="Center"
WidthRequest="600"
RowDefinitions="*,*,*,*,*,*,*,*,*,*,*,*,*,*,*"
RowDefinitions="*,*,*,*,*,*,*,*,*,*"
ColumnDefinitions="*">


<VerticalStackLayout
Grid.Row="0"
Grid.RowSpan="15"
HorizontalOptions="Center">
Grid.RowSpan="9"
HorizontalOptions="Center"
VerticalOptions="Center">

<HorizontalStackLayout>
<Label
Expand Down Expand Up @@ -72,9 +74,13 @@
Text="Player ID"
VerticalOptions="Center"/>
<Label
WidthRequest="270"
WidthRequest="170"
Text="Player Mode"
VerticalOptions="Center"/>
<Label
WidthRequest="100"
Text="Ship Type"
VerticalOptions="Center"/>
</HorizontalStackLayout>
<CollectionView
HeightRequest="200"
Expand Down Expand Up @@ -109,7 +115,7 @@
</Picker.ItemsSource>
</Picker>
<Picker
WidthRequest="270"
WidthRequest="170"
SelectedItem="{Binding PlayerMode}">
<Picker.ItemsSource>
<x:Array
Expand All @@ -119,6 +125,20 @@
</x:Array>
</Picker.ItemsSource>
</Picker>
<Picker
WidthRequest="100"
IsEnabled="{Binding ShipTypePickerEnabled}"
SelectedItem="{Binding ShipType}">
<Picker.ItemsSource>
<x:Array
Type="{x:Type x:Int32}">
<x:Int32>0</x:Int32>
<x:Int32>1</x:Int32>
<x:Int32>2</x:Int32>
<x:Int32>3</x:Int32>
</x:Array>
</Picker.ItemsSource>
</Picker>
</HorizontalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
Expand Down Expand Up @@ -188,6 +208,7 @@

</VerticalStackLayout>


<VerticalStackLayout
IsVisible="{Binding ServerVisible}">

Expand Down Expand Up @@ -257,6 +278,7 @@

</VerticalStackLayout>


<!--<Frame
BorderColor="Gray"
Padding="3"
Expand Down
8 changes: 4 additions & 4 deletions installer/Page/InstallPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
<Grid
HorizontalOptions="Center"
WidthRequest="600"
RowDefinitions="10,*,*,*,*,*,*,*,*,*,*"
RowDefinitions="*,*,*,*,*,*,*,*,*,*"
ColumnDefinitions="*">

<VerticalStackLayout
Grid.Row="1"
Grid.RowSpan="10"
Grid.Row="0"
Grid.RowSpan="9"
HorizontalOptions="Center"
WidthRequest="600">
VerticalOptions="Center">

<HorizontalStackLayout>
<Label
Expand Down
9 changes: 5 additions & 4 deletions installer/Page/LoginPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
<Grid
HorizontalOptions="Center"
WidthRequest="500"
RowDefinitions="*,*,*,*,*">
RowDefinitions="*,*,*,*,*,*,*,*,*,*">

<VerticalStackLayout
Grid.Row="1"
Grid.RowSpan="4"
Grid.Row="0"
Grid.RowSpan="8"
WidthRequest="500"
HorizontalOptions="Center"
WidthRequest="500">
VerticalOptions="Center">

<Editor
Placeholder="请输入EESAST账户名……"
Expand Down
4 changes: 2 additions & 2 deletions installer/Page/PlaybackPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<Grid
HorizontalOptions="Center"
WidthRequest="600"
RowDefinitions="*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*"
RowDefinitions="*,*,*,*,*,*,*,*,*,*"
ColumnDefinitions="*">

<VerticalStackLayout
Grid.Row="0"
Grid.RowSpan="15"
Grid.RowSpan="8"
HorizontalOptions="Center"
VerticalOptions="Center">

Expand Down
2 changes: 2 additions & 0 deletions installer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

THUAI7 选手包下载器

[下载器使用文档](.\Manual.md)

## 目标

### 基本目标
Expand Down
2 changes: 1 addition & 1 deletion installer/ViewModel/DebugViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ public string ServerStartBtnText
}

private bool serverStartMode = false;

public bool ServerStartMode
{
get => serverStartMode;
Expand Down Expand Up @@ -185,6 +184,7 @@ private void ClientStart()
{
Downloader.Data.Config.Commands.TeamID = Players[i].TeamID;
Downloader.Data.Config.Commands.PlayerID = Players[i].PlayerID;
Downloader.Data.Config.Commands.ShipType = Players[i].ShipType;
haveSpectator = true;
LaunchClient();
}
Expand Down

0 comments on commit 0cc35fc

Please sign in to comment.