diff --git a/TODO.txt b/TODO.txt index 1268b3683..3d4e68be6 100644 --- a/TODO.txt +++ b/TODO.txt @@ -145,22 +145,23 @@ * better color scheme radial menu DONE 9/28/2024 * Make buttons icons DONE 9/28/2024 * BUG: change username after selecting map DONE 9/29/2024 -* BUG: fake humans break alliance too often -* make fake humans more difficult -* make event box work on mobile +* BUG: fake humans break alliance too often DONE 9/29/2024 +* make fake humans more difficult DONE 9/29/2024 +* BUG: make event box work on mobile DONE 9/29/2024 * BUG: alliance cooldown request -* add request attack +* BUG: alliance expire message after player dies +* Make fake humans spawn by their country +* make create/break alliance single button +* add request attack other players * add emoji button -* request to attack other players * make year clock * block user inputs if too far behind server -* BUG: FakeHuman don't be enemy if don't share border +* BUG: FakeHuman don't be enemy if don't share border (or send boat) * store cookies * BUG: names dissapear on bottom of screen +* UI: leader board * UI: boats * UI: current attacks -* UI: leader board -* make random waves on ocean, dark spots * Load terrain dataImage in background * BUG: half encircle Antartica causes capture diff --git a/src/client/graphics/layers/EventsDisplay.ts b/src/client/graphics/layers/EventsDisplay.ts index a10029a70..7a5769ead 100644 --- a/src/client/graphics/layers/EventsDisplay.ts +++ b/src/client/graphics/layers/EventsDisplay.ts @@ -56,14 +56,18 @@ export class EventsDisplay implements Layer { } tick() { - const remainingEvents: Event[] = [] + let remainingEvents: Event[] = [] for (const event of this.events) { - if (this.game.ticks() - event.createdAt < 100) { + if (this.game.ticks() - event.createdAt < 50) { remainingEvents.push(event) } else if (event.onDelete != null) { event.onDelete() } } + if (remainingEvents.length > 5) { + remainingEvents = remainingEvents.slice(-5) + } + let shouldRender = false if (this.events.length != remainingEvents.length) { shouldRender = true @@ -77,15 +81,9 @@ export class EventsDisplay implements Layer { private createTableContainer() { this.tableContainer = document.createElement('div'); this.tableContainer.id = 'table-container'; - this.tableContainer.style.position = 'fixed'; - this.tableContainer.style.bottom = '0px'; // Distance from bottom - this.tableContainer.style.right = '0px'; // Distance from right - this.tableContainer.style.zIndex = '1000'; - this.tableContainer.style.backgroundColor = 'rgba(255, 255, 255, 0.0)'; - this.tableContainer.style.padding = '20px'; - this.tableContainer.style.boxShadow = '0 0 10px rgba(0,0,0,0.0)'; + this.tableContainer.className = 'events-display'; + this.tableContainer.style.display = "none"; document.body.appendChild(this.tableContainer); - this.tableContainer.style.minWidth = '400px'; // Set minimum width } shouldTransform(): boolean { @@ -225,37 +223,29 @@ export class EventsDisplay implements Layer { render(): void { } renderTable(): void { + if (this.events.length === 0) { + this.tableContainer.innerHTML = ""; + this.tableContainer.style.display = "none"; + return; + } + + this.tableContainer.style.display = "block"; + + let tableHtml = `
| + |
|
${event.description}
- ${event.buttons ? ' ' + event.buttons.map((btn, btnIndex) => + ${event.buttons ? '' : ''} |