Skip to content

Commit 13aa874

Browse files
authored
Merge branch 'eesast:dev' into dev
2 parents dd54565 + a408bf5 commit 13aa874

13 files changed

Lines changed: 1193 additions & 492 deletions

interface/AvaloniaUI/Converters/TeamIdToColorConverter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public object Convert(object? value, Type targetType, object? parameter, Culture
1616
{
1717
return teamId switch
1818
{
19-
0 => new SolidColorBrush(Colors.Red),
20-
1 => new SolidColorBrush(Colors.Blue),
21-
2 => new SolidColorBrush(Colors.Green),
22-
3 => new SolidColorBrush(Colors.Orange),
19+
1 => new SolidColorBrush(Colors.Red),
20+
2 => new SolidColorBrush(Colors.Blue),
21+
3 => new SolidColorBrush(Colors.Green),
22+
4 => new SolidColorBrush(Colors.Orange),
2323
_ => new SolidColorBrush(Colors.Gray)
2424
};
2525
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using Avalonia.Media;
2+
using CommunityToolkit.Mvvm.ComponentModel;
3+
4+
namespace THUAI9_Avalonia.Models
5+
{
6+
public enum MapOverlayKind
7+
{
8+
Factory,
9+
Resource,
10+
ComputeCenter,
11+
Market
12+
}
13+
14+
/// <summary>
15+
/// 动态地图覆盖物。底图只保留静态地形,建筑/资源/据点状态以覆盖层形式渲染。
16+
/// </summary>
17+
public partial class MapOverlayItem : ObservableObject
18+
{
19+
[ObservableProperty]
20+
private string key = string.Empty;
21+
22+
[ObservableProperty]
23+
private int cellX;
24+
25+
[ObservableProperty]
26+
private int cellY;
27+
28+
[ObservableProperty]
29+
private string label = string.Empty;
30+
31+
[ObservableProperty]
32+
private string tooltip = string.Empty;
33+
34+
[ObservableProperty]
35+
private IBrush background = Brushes.Gray;
36+
37+
[ObservableProperty]
38+
private IBrush foreground = Brushes.White;
39+
40+
[ObservableProperty]
41+
private IBrush borderBrush = Brushes.White;
42+
43+
[ObservableProperty]
44+
private double opacity = 0.88;
45+
46+
[ObservableProperty]
47+
private MapOverlayKind kind;
48+
}
49+
}

interface/AvaloniaUI/Models/PlaybackConstant.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static class Constants
1414
public class FileFormatNotLegalException(string fileName) : Exception
1515
{
1616
public string FileName { get; } = fileName;
17-
public override string Message { get; } = $"The file: {fileName} is not a legal playback file for THUAI{Constants.Version}.";
17+
public override string Message { get; } = $"文件 {fileName} 不是适用于 THUAI{Constants.Version} 的合法回放文件。";
1818
}
1919

2020
public static class Utils
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using CommunityToolkit.Mvvm.ComponentModel;
2+
3+
namespace THUAI9_Avalonia.Models
4+
{
5+
/// <summary>
6+
/// 顶层摘要区中的队伍概览。
7+
/// </summary>
8+
public partial class TeamOverviewItem : ObservableObject
9+
{
10+
[ObservableProperty]
11+
private int teamId;
12+
13+
[ObservableProperty]
14+
private int score;
15+
16+
[ObservableProperty]
17+
private int material;
18+
19+
[ObservableProperty]
20+
private int computePower;
21+
22+
[ObservableProperty]
23+
private int factoryHp;
24+
25+
public string Header => $"队伍 {TeamId}";
26+
27+
public string SummaryText => $"得分 {Score} · 原料 {Material} · 算力 {ComputePower} · 工厂血量 {FactoryHp}";
28+
29+
partial void OnTeamIdChanged(int value) => OnPropertyChanged(nameof(Header));
30+
partial void OnScoreChanged(int value) => OnPropertyChanged(nameof(SummaryText));
31+
partial void OnMaterialChanged(int value) => OnPropertyChanged(nameof(SummaryText));
32+
partial void OnComputePowerChanged(int value) => OnPropertyChanged(nameof(SummaryText));
33+
partial void OnFactoryHpChanged(int value) => OnPropertyChanged(nameof(SummaryText));
34+
}
35+
}

interface/AvaloniaUI/THUAI9_Avalonia.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
77
<ApplicationManifest>app.manifest</ApplicationManifest>
88
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
9+
<DefaultItemExcludes>$(DefaultItemExcludes);$(MSBuildProjectDirectory)\bin\**;$(MSBuildProjectDirectory)\obj\**;$(MSBuildProjectDirectory)\temp_build_verify\**;$(MSBuildProjectDirectory)\interface\AvaloniaUI\temp_build_verify\**</DefaultItemExcludes>
910
</PropertyGroup>
1011

1112
<ItemGroup>

interface/AvaloniaUI/ViewModels/CharacterViewModel.cs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,51 @@ namespace THUAI9_Avalonia.ViewModels
99
public partial class CharacterViewModel : ViewModelBase
1010
{
1111
[ObservableProperty]
12-
private long guid; // 全局唯一 ID
12+
private long guid;
1313

1414
[ObservableProperty]
15-
private long characterId; // 玩家 ID
15+
private long characterId;
1616

1717
[ObservableProperty]
18-
private int teamId; // 队伍 ID
18+
private int teamId;
1919

2020
[ObservableProperty]
21-
private string name = string.Empty; // 角色名称
21+
private string name = string.Empty;
2222

2323
[ObservableProperty]
24-
private int hp; // 当前生命值
24+
private int hp;
2525

2626
[ObservableProperty]
27-
private int maxHp; // 最大生命值
27+
private int maxHp;
2828

2929
[ObservableProperty]
30-
private int posX; // X 坐标(游戏坐标)
30+
private int posX;
3131

3232
[ObservableProperty]
33-
private int posY; // Y 坐标(游戏坐标)
33+
private int posY;
3434

3535
[ObservableProperty]
36-
private string activeState = string.Empty; // 当前状态
36+
private string activeState = string.Empty;
3737

3838
[ObservableProperty]
39-
private CharacterType characterType; // 角色类型
39+
private CharacterType characterType;
4040

41-
/// <summary>
42-
/// 网格坐标显示文本。
43-
/// </summary>
44-
public string Coordinates => $"({PosX / 1000},{PosY / 1000})";
41+
public string Coordinates => $"坐标 ({PosX / 1000},{PosY / 1000})";
42+
43+
public string HealthText => $"生命值 {Hp}";
44+
45+
public string PlayerText => $"玩家 P{CharacterId}";
4546

46-
/// <summary>
47-
/// 仅在角色存活时显示坐标。
48-
/// </summary>
4947
public bool ShowCoordinates => Hp > 0;
5048

5149
partial void OnPosXChanged(int value) => OnPropertyChanged(nameof(Coordinates));
5250
partial void OnPosYChanged(int value) => OnPropertyChanged(nameof(Coordinates));
53-
partial void OnHpChanged(int value) => OnPropertyChanged(nameof(ShowCoordinates));
51+
partial void OnHpChanged(int value)
52+
{
53+
OnPropertyChanged(nameof(ShowCoordinates));
54+
OnPropertyChanged(nameof(HealthText));
55+
}
56+
partial void OnMaxHpChanged(int value) => OnPropertyChanged(nameof(HealthText));
57+
partial void OnCharacterIdChanged(long value) => OnPropertyChanged(nameof(PlayerText));
5458
}
5559
}

0 commit comments

Comments
 (0)