fixed bug

This commit is contained in:
Aotumuri
2025-05-06 13:59:22 +09:00
parent d403560f79
commit c242865a6b
4 changed files with 38 additions and 2 deletions
+28 -1
View File
@@ -7,7 +7,7 @@
},
{
"key": "gold",
"text": "Please give me golds!",
"text": "Please give me gold!",
"requiresPlayer": false
},
{
@@ -133,5 +133,32 @@
"text": "When will my PR finally get merged...?",
"requiresPlayer": false
}
],
"warnings": [
{
"key": "strong",
"text": "[P1] is strong.",
"requiresPlayer": true
},
{
"key": "weak",
"text": "[P1] is weak.",
"requiresPlayer": true
},
{
"key": "mirv_soon",
"text": "[P1] can launch a MIRV soon!",
"requiresPlayer": true
},
{
"key": "number1_warning",
"text": "The #1 player will win soon unless we team up!",
"requiresPlayer": false
},
{
"key": "stalemate",
"text": "Let's make peace. This is a stalemate, we will both lose.",
"requiresPlayer": false
}
]
}
+1 -1
View File
@@ -90,7 +90,7 @@ export function createRenderer(
eventsDisplay.clientID = clientID;
const chatDisplay = document.querySelector("chat-display") as ChatDisplay;
if (!(eventsDisplay instanceof ChatDisplay)) {
if (!(chatDisplay instanceof ChatDisplay)) {
consolex.error("chat display not found");
}
chatDisplay.eventBus = eventBus;
@@ -26,6 +26,8 @@ export class ChatDisplay extends LitElement implements Layer {
public game: GameView;
public clientID: ClientID;
private active: boolean = false;
private updateMap = new Map([
[GameUpdateType.DisplayEvent, (u) => this.onDisplayMessageEvent(u)],
]);
@@ -78,6 +80,7 @@ export class ChatDisplay extends LitElement implements Layer {
init() {}
tick() {
this.active = true;
const updates = this.game.updatesSinceLastTick();
const messages = updates[GameUpdateType.DisplayEvent] as
| DisplayMessageUpdate[]
@@ -109,6 +112,8 @@ export class ChatDisplay extends LitElement implements Layer {
if (this.chatEvents.length > 100) {
this.chatEvents = this.chatEvents.slice(-100);
}
this.requestUpdate();
}
private getChatContent(
@@ -120,6 +125,9 @@ export class ChatDisplay extends LitElement implements Layer {
}
render() {
if (!this.active) {
return html``;
}
return html`
<div
class="${this._hidden
+1
View File
@@ -62,6 +62,7 @@ export class ChatModal extends LitElement {
{ id: "defend", name: "Defend" },
{ id: "greet", name: "Greetings" },
{ id: "misc", name: "Miscellaneous" },
{ id: "warnings", name: "Warnings" },
];
private getPhrasesForCategory(categoryId: string) {