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

add feature #360

Merged
merged 1 commit into from
May 11, 2024
Merged
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
13 changes: 12 additions & 1 deletion logic/Server/GameServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
{
public class ContestResult
{
public string status;

Check warning on line 18 in logic/Server/GameServer.cs

View workflow job for this annotation

GitHub Actions / deploy-to-tencent-cos

Non-nullable field 'status' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 18 in logic/Server/GameServer.cs

View workflow job for this annotation

GitHub Actions / deploy-to-tencent-cos

Non-nullable field 'status' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
public double[] scores;

Check warning on line 19 in logic/Server/GameServer.cs

View workflow job for this annotation

GitHub Actions / deploy-to-tencent-cos

Non-nullable field 'scores' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
}
partial class GameServer : ServerBase
{
Expand Down Expand Up @@ -110,7 +110,7 @@

}

protected void SendGameResult(int[] scores, bool crashed) // 天梯的 Server 给网站发消息记录比赛结果
protected void SendGameResult(int[] scores, bool crashed = false) // 天梯的 Server 给网站发消息记录比赛结果
{
string? url2 = Environment.GetEnvironmentVariable("FINISH_URL");
if (url2 == null)
Expand Down Expand Up @@ -229,6 +229,17 @@
scores = doubleArray.Select(x => (int)x).ToArray();
SendGameResult(scores, crash);
}
else if (options.Mode == 1)
{
int[] s = new int[2];
if (scores[1] > scores[0])
s = [0, 2];
else if (scores[1] == scores[0])
s = [1, 1];
else
s = [2, 0];
SendGameResult(s);
}
endGameSem.Release();
}
public void ReportGame(GameState gameState, bool requiredGaming = true)
Expand Down
Loading