mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:20:45 +00:00
Discord and OFM advert added (#2380)
## Description: Adds a win modal for OFM and the main discord. Adds needed translation keys and an OFM picture back to the resources file ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: Iamlewis --------- Co-authored-by: evanpelle <evanpelle@gmail.com>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
@@ -512,7 +512,13 @@
|
||||
"exit": "Exit Game",
|
||||
"keep": "Keep Playing",
|
||||
"spectate": "Spectate",
|
||||
"wishlist": "Wishlist on Steam!"
|
||||
"wishlist": "Wishlist on Steam!",
|
||||
"ofm_winter": "OpenFront Masters Winter Tournament!",
|
||||
"ofm_winter_description": "Join the competitive tournament and compete against the best players",
|
||||
"join_tournament": "Join Tournament",
|
||||
"join_discord": "Join Our Discord Community!",
|
||||
"discord_description": "Connect with other players, get updates, and share strategies",
|
||||
"join_server": "Join Server"
|
||||
},
|
||||
"leaderboard": {
|
||||
"title": "Leaderboard",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { LitElement, TemplateResult, html } from "lit";
|
||||
import { customElement, state } from "lit/decorators.js";
|
||||
import ofmWintersLogo from "../../../../resources/images/OfmWintersLogo.png";
|
||||
import { isInIframe, translateText } from "../../../client/Utils";
|
||||
import { ColorPalette, Pattern } from "../../../core/CosmeticSchemas";
|
||||
import { EventBus } from "../../../core/EventBus";
|
||||
@@ -100,10 +101,19 @@ export class WinModal extends LitElement implements Layer {
|
||||
}
|
||||
|
||||
innerHtml() {
|
||||
if (isInIframe() || this.rand < 0.25) {
|
||||
if (isInIframe()) {
|
||||
return this.steamWishlist();
|
||||
}
|
||||
return this.renderPatternButton();
|
||||
|
||||
if (this.rand < 0.25) {
|
||||
return this.steamWishlist();
|
||||
} else if (this.rand < 0.5) {
|
||||
return this.ofmDisplay();
|
||||
} else if (this.rand < 0.75) {
|
||||
return this.discordDisplay();
|
||||
} else {
|
||||
return this.renderPatternButton();
|
||||
}
|
||||
}
|
||||
|
||||
renderPatternButton() {
|
||||
@@ -190,6 +200,55 @@ export class WinModal extends LitElement implements Layer {
|
||||
</p>`;
|
||||
}
|
||||
|
||||
ofmDisplay(): TemplateResult {
|
||||
return html`
|
||||
<div class="text-center mb-6 bg-black/30 p-2.5 rounded">
|
||||
<h3 class="text-xl font-semibold text-white mb-3">
|
||||
${translateText("win_modal.ofm_winter")}
|
||||
</h3>
|
||||
<div class="mb-3">
|
||||
<img
|
||||
src=${ofmWintersLogo}
|
||||
alt="OpenFront Masters Winter"
|
||||
class="mx-auto max-w-full h-auto max-h-[200px] rounded"
|
||||
/>
|
||||
</div>
|
||||
<p class="text-white mb-3">
|
||||
${translateText("win_modal.ofm_winter_description")}
|
||||
</p>
|
||||
<a
|
||||
href="https://discord.gg/wXXJshB8Jt"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="inline-block px-6 py-3 bg-green-600 text-white rounded font-semibold transition-all duration-200 hover:bg-green-700 hover:-translate-y-px no-underline"
|
||||
>
|
||||
${translateText("win_modal.join_tournament")}
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
discordDisplay(): TemplateResult {
|
||||
return html`
|
||||
<div class="text-center mb-6 bg-black/30 p-2.5 rounded">
|
||||
<h3 class="text-xl font-semibold text-white mb-3">
|
||||
${translateText("win_modal.join_discord")}
|
||||
</h3>
|
||||
<p class="text-white mb-3">
|
||||
${translateText("win_modal.discord_description")}
|
||||
</p>
|
||||
<a
|
||||
href="https://discord.com/invite/openfront"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="inline-block px-6 py-3 bg-indigo-600 text-white rounded font-semibold transition-all duration-200 hover:bg-indigo-700 hover:-translate-y-px no-underline"
|
||||
>
|
||||
${translateText("win_modal.join_server")}
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
async show() {
|
||||
await this.loadPatternContent();
|
||||
this.isVisible = true;
|
||||
|
||||
Reference in New Issue
Block a user