mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-12 04:04:00 +00:00
MLS for Quick Chat (#686)
## Description: <img width="842" alt="スクリーンショット 2025-05-09 17 51 27" src="https://github.com/user-attachments/assets/b9a2cb5b-74d2-4c07-aed2-01d719de6eb4" /> MLS ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors
This commit is contained in:
@@ -509,6 +509,15 @@ export interface Game extends GameMap {
|
||||
playerID: PlayerID | null,
|
||||
): void;
|
||||
|
||||
displayChat(
|
||||
message: string,
|
||||
category: string,
|
||||
variables: Record<string, string>,
|
||||
playerID: PlayerID | null,
|
||||
isFrom: boolean,
|
||||
recipient: string,
|
||||
): void;
|
||||
|
||||
// Nations
|
||||
nations(): Nation[];
|
||||
|
||||
|
||||
@@ -606,6 +606,28 @@ export class GameImpl implements Game {
|
||||
});
|
||||
}
|
||||
|
||||
displayChat(
|
||||
message: string,
|
||||
category: string,
|
||||
variables: Record<string, string> = {},
|
||||
playerID: PlayerID | null,
|
||||
isFrom: boolean | null = null,
|
||||
recipient: string,
|
||||
): void {
|
||||
let id = null;
|
||||
if (playerID != null) {
|
||||
id = this.player(playerID).smallID();
|
||||
}
|
||||
this.addUpdate({
|
||||
type: GameUpdateType.DisplayChatEvent,
|
||||
key: message,
|
||||
category: category,
|
||||
variables: variables,
|
||||
playerID: id,
|
||||
isFrom: isFrom,
|
||||
recipient: recipient,
|
||||
});
|
||||
}
|
||||
addUnit(u: Unit) {
|
||||
this.unitGrid.addUnit(u);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ export enum GameUpdateType {
|
||||
Unit,
|
||||
Player,
|
||||
DisplayEvent,
|
||||
DisplayChatEvent,
|
||||
AllianceRequest,
|
||||
AllianceRequestReply,
|
||||
BrokeAlliance,
|
||||
@@ -48,6 +49,7 @@ export type GameUpdate =
|
||||
| BrokeAllianceUpdate
|
||||
| AllianceExpiredUpdate
|
||||
| DisplayMessageUpdate
|
||||
| DisplayChatMessageUpdate
|
||||
| TargetPlayerUpdate
|
||||
| EmojiUpdate
|
||||
| WinUpdate
|
||||
@@ -157,6 +159,16 @@ export interface DisplayMessageUpdate {
|
||||
playerID: number | null;
|
||||
}
|
||||
|
||||
export type DisplayChatMessageUpdate = {
|
||||
type: GameUpdateType.DisplayChatEvent;
|
||||
key: string;
|
||||
category: string;
|
||||
variables?: Record<string, string>;
|
||||
playerID: number | null;
|
||||
isFrom: boolean;
|
||||
recipient: string;
|
||||
};
|
||||
|
||||
export interface WinUpdate {
|
||||
type: GameUpdateType.Win;
|
||||
allPlayersStats: AllPlayersStats;
|
||||
|
||||
Reference in New Issue
Block a user