This commit is contained in:
evanpelle
2025-03-27 20:43:56 -07:00
committed by GitHub
parent 9ed1fe865c
commit d8fe41de7a
37 changed files with 767 additions and 387 deletions
+18 -2
View File
@@ -1,4 +1,10 @@
import { PlayerID, GameMapType, Difficulty, GameType } from "../core/game/Game";
import {
PlayerID,
GameMapType,
Difficulty,
GameType,
TeamName,
} from "../core/game/Game";
import { EventBus } from "../core/EventBus";
import { createRenderer, GameRenderer } from "./graphics/GameRenderer";
import { InputHandler, MouseUpEvent } from "./InputHandler";
@@ -165,6 +171,15 @@ export class ClientGameRunner {
clientID: this.lobby.clientID,
},
];
let winner: ClientID | TeamName | null = null;
if (update.winnerType == "player") {
winner = this.gameView
.playerBySmallID(update.winner as number)
.clientID();
} else {
winner = update.winner as TeamName;
}
const record = createGameRecord(
this.lobby.gameID,
this.lobby.gameConfig,
@@ -173,7 +188,8 @@ export class ClientGameRunner {
[],
LocalPersistantStats.startTime(),
Date.now(),
this.gameView.playerBySmallID(update.winnerID).id(),
winner,
update.winnerType,
update.allPlayersStats,
);
LocalPersistantStats.endGame(record);