Skip to content

Commit

Permalink
Merge pull request #360 from GuoWQ222/dev
Browse files Browse the repository at this point in the history
add feature
  • Loading branch information
DragonAura authored May 11, 2024
2 parents 5fa8518 + f8a98e2 commit ed9da22
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion logic/Server/GameServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private void SaveGameResult(string path)

}

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 @@ private void OnGameEnd()
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

0 comments on commit ed9da22

Please sign in to comment.