mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-06 04:08:09 +00:00
teams (#349)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user