Skip to content
This repository was archived by the owner on Sep 7, 2023. It is now read-only.

Commit ee40759

Browse files
authored
Merge pull request #74 from THU-ASTA/develop
Develop
2 parents 2b94e5b + a0cc43d commit ee40759

File tree

6 files changed

+29
-17
lines changed

6 files changed

+29
-17
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010

11+
## [24.1.0-beta.7]
12+
## Fixed
13+
- Progress bar not being reset to zero when resetting the game
14+
- Failing to handle packages with packet ID 0x00
15+
16+
## Changed
17+
- Update titles of error messages
18+
19+
1120
## [24.1.0-beta.6]
1221
## Added
1322
- Frame rate displaying by @Futrime

Source/MainWindow.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ public MainWindow()
225225
if (!this._camera.IsOpened())
226226
{
227227
MessageBox.Show(
228-
"No camera found!",
229-
"Error",
228+
"No camera is found!",
229+
"Nahida said:",
230230
MessageBoxButtons.OK,
231231
MessageBoxIcon.Error
232232
);
@@ -711,7 +711,7 @@ private void Draw(ref Mat image)
711711
org: new Point2i(5, 30),
712712
fontFace: HersheyFonts.HersheySimplex,
713713
fontScale: 1,
714-
color: new Scalar(102, 8, 116),
714+
color: new Scalar(255, 0, 255),
715715
thickness: 2,
716716
bottomLeftOrigin: false,
717717
lineType: LineTypes.AntiAlias
@@ -772,6 +772,7 @@ private void RefreshMonitor(Image img)
772772
if (pictureBoxMonitor.Image != null)
773773
{
774774
pictureBoxMonitor.Image.Dispose();
775+
pictureBoxMonitor.Image = null;
775776
}
776777

777778
pictureBoxMonitor.Image = img;
@@ -916,6 +917,7 @@ private void buttonReset_Click(object sender, EventArgs e)
916917
this.labelScoreVehicleB.Text = "N/A";
917918
this.labelGameTime.Text = "N/A";
918919
this.labelGameHalf.Text = "Pre-match";
920+
this.progressBarRemainingPowerRatio.Value = 0;
919921
}
920922

921923
private void buttonFoul_Click(object sender, EventArgs e)

Source/PacketGetGameInformationHost.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ public override byte[] GetBytes()
111111

112112

113113
// Gamestage
114-
BitConverter.GetBytes((byte)this._gameStage).CopyTo(data, currentIndex);
114+
data[currentIndex] = ((byte)this._gameStage);
115115
currentIndex += 1;
116116

117117
// Barrier
118118
if (this._barrierList.Count > 0xff)
119119
{
120120
throw new ArgumentException("Barrier length is larger than 0xff");
121121
}
122-
BitConverter.GetBytes((byte)this._barrierList.Count).CopyTo(data, currentIndex);
122+
data[currentIndex] = ((byte)this._barrierList.Count);
123123
currentIndex += 1;
124124

125125
for (int i = 0; i < this._barrierList.Count; i++)
@@ -141,7 +141,7 @@ public override byte[] GetBytes()
141141
{
142142
throw new ArgumentException("Length of own charging piles is larger than 0xff");
143143
}
144-
BitConverter.GetBytes((byte)this._ownChargingPiles.Count).CopyTo(data, currentIndex);
144+
data[currentIndex] = ((byte)this._ownChargingPiles.Count);
145145
currentIndex += 1;
146146

147147
for (int i = 0; i < this._ownChargingPiles.Count; i++)
@@ -158,8 +158,9 @@ public override byte[] GetBytes()
158158
{
159159
throw new ArgumentException("Length of opponent charging piles is larger than 0xff");
160160
}
161-
BitConverter.GetBytes(this._opponentChargingPiles.Count).CopyTo(data, currentIndex);
162-
currentIndex += 4;
161+
162+
data[currentIndex] = ((byte)this._opponentChargingPiles.Count);
163+
currentIndex += 1; // ZYR FIXED BUG in 2022-11-9
163164

164165
for (int i = 0; i < this._opponentChargingPiles.Count; i++)
165166
{

Source/PacketGetStatusHost.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public PacketGetStatusHost(
3838
Order latestPendingOrder
3939
)
4040
{
41-
41+
4242

4343
this._gameStatus = gameStatus;
4444
this._gameTime = gameTime;
@@ -146,11 +146,11 @@ public override byte[] GetBytes()
146146
case GameStatusType.Unstarted:
147147
case GameStatusType.Paused:
148148
case GameStatusType.Ended:
149-
BitConverter.GetBytes((byte)0).CopyTo(data, index);
149+
data[index] = ((byte)0);
150150
break;
151151

152152
case GameStatusType.Running:
153-
BitConverter.GetBytes((byte)1).CopyTo(data, index);
153+
data[index] = ((byte)1);
154154
break;
155155

156156
default:
@@ -185,7 +185,7 @@ public override byte[] GetBytes()
185185
{
186186
throw new ArgumentException("Length of orderInDeliveryList is larger than 0xff");
187187
}
188-
BitConverter.GetBytes((byte)this._orderInDeliveryList.Count).CopyTo(data, index);
188+
data[index] = ((byte)this._orderInDeliveryList.Count);
189189
index += 1;
190190
foreach (var order in this._orderInDeliveryList)
191191
{

Source/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static void Main()
2222
{
2323
MessageBox.Show(
2424
$"The file {e.FileName} is missing. Please check if you have extracted all files to the folder wherein the program locate.",
25-
"Error",
25+
"Nahida said:",
2626
MessageBoxButtons.OK,
2727
MessageBoxIcon.Error
2828
);
@@ -39,7 +39,7 @@ static void HandleUnhandledException(object sender, UnhandledExceptionEventArgs
3939
MessageBox.Show(
4040
"An unhandled exception occurred!\nPlease take a screenshot of this message and report to EDC Commitee!\n\n" +
4141
e.ExceptionObject.ToString(),
42-
"Unexpected Exception",
42+
"Nahida choked and said:",
4343
MessageBoxButtons.OK,
4444
MessageBoxIcon.Error
4545
);

Source/SettingsWindow.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private void ApplyConfig()
127127
{
128128
MessageBox.Show(
129129
$"Cannot open the serial port: {vehicleConfig.SerialPort}",
130-
"Error",
130+
"Nahida said:",
131131
MessageBoxButtons.OK,
132132
MessageBoxIcon.Error
133133
);
@@ -172,7 +172,7 @@ private void LoadConfig()
172172
{
173173
MessageBox.Show(
174174
text: "No configuration file is found!",
175-
caption: "Error",
175+
caption: "Nahida said:",
176176
MessageBoxButtons.OK,
177177
MessageBoxIcon.Error
178178
);
@@ -254,7 +254,7 @@ private void SyncFormToConfig()
254254
{
255255
MessageBox.Show(
256256
"Some parameters are invalid.",
257-
"Error",
257+
"Nahida said:",
258258
MessageBoxButtons.OK,
259259
MessageBoxIcon.Error
260260
);

0 commit comments

Comments
 (0)