Display OFM25 ad in WinModal (#1281)

## Description:

Display OFM25 ad in WinModal 50% of the time.


![image](https://github.com/user-attachments/assets/e61c3139-d81e-4f50-a703-db8ec8e97cee)

## 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
- [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:
Scott Anderson
2025-06-27 14:40:59 -04:00
parent 2cbfddaa14
commit 95f9a6a91c
4 changed files with 40 additions and 7 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

+5 -5
View File
@@ -121,12 +121,12 @@ export function createRenderer(
playerInfo.transform = transformHandler;
playerInfo.game = game;
const winModel = document.querySelector("win-modal") as WinModal;
if (!(winModel instanceof WinModal)) {
const winModal = document.querySelector("win-modal") as WinModal;
if (!(winModal instanceof WinModal)) {
console.error("win modal not found");
}
winModel.eventBus = eventBus;
winModel.game = game;
winModal.eventBus = eventBus;
winModal.game = game;
const optionsMenu = document.querySelector("options-menu") as OptionsMenu;
if (!(optionsMenu instanceof OptionsMenu)) {
@@ -213,7 +213,7 @@ export function createRenderer(
leaderboard,
controlPanel,
playerInfo,
winModel,
winModal,
optionsMenu,
teamStats,
topBar,
+35 -2
View File
@@ -1,5 +1,6 @@
import { LitElement, css, html } from "lit";
import { customElement, state } from "lit/decorators.js";
import logo from "../../../../resources/images/ofm/logo_MASTER_2025.png";
import { translateText } from "../../../client/Utils";
import { EventBus } from "../../../core/EventBus";
import { GameUpdateType } from "../../../core/game/GameUpdates";
@@ -21,6 +22,9 @@ export class WinModal extends LitElement implements Layer {
@state()
showButtons = false;
@state()
private showSteamContent = Math.random() > 0.5;
private _title: string;
// Override to prevent shadow DOM creation
@@ -138,7 +142,9 @@ export class WinModal extends LitElement implements Layer {
return html`
<div class="win-modal ${this.isVisible ? "visible" : ""}">
<h2>${this._title || ""}</h2>
${this.innerHtml()}
${this.showSteamContent
? this.steamWishlist()
: this.openfrontMasters()}
<div
class="button-container ${this.showButtons ? "visible" : "hidden"}"
>
@@ -153,7 +159,7 @@ export class WinModal extends LitElement implements Layer {
`;
}
innerHtml() {
steamWishlist() {
return html`<p>
<a
href="https://store.steampowered.com/app/3560670"
@@ -174,6 +180,33 @@ export class WinModal extends LitElement implements Layer {
</p>`;
}
openfrontMasters() {
return html`<p>
<img
src="${logo}"
alt="OpenFront Masters"
style="max-width: 100%; height: auto; margin-bottom: 16px;"
/>
<a
href="https://discord.gg/gStsGh5vWR"
target="_blank"
rel="noopener noreferrer"
style="
color: #4a9eff;
text-decoration: underline;
font-weight: 500;
transition: color 0.2s ease;
font-size: 24px;
"
onmouseover="this.style.color='#6db3ff'"
onmouseout="this.style.color='#4a9eff'"
>
Watch the best compete in the
<span style="font-weight: bold;">OpenFront Masters</span>
</a>
</p>`;
}
show() {
this.eventBus.emit(new GutterAdModalEvent(true));
setTimeout(() => {