mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-28 06:24:17 +00:00
dd9ad7472f
## Description: 1. Remove SpawnAds and replace it with AdTimer which will delete the in-game ad after the first minute. 2. remove login blocker UI, we don't use it anymore 3. convert TerritoryPatternsModal & GutterAds to use event based when checking for flares 4. remove window.PageOS.session.newPageView(); because it was throwing an exception 5. Convert SpawnTimer to a lit element to give it a higher z-index to stay above the header ad ## 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: evan
29 lines
639 B
TypeScript
29 lines
639 B
TypeScript
import { GameView } from "../../../core/game/GameView";
|
|
import { Layer } from "./Layer";
|
|
|
|
const AD_SHOW_TICKS = 60 * 10; // 1 minute
|
|
|
|
export class AdTimer implements Layer {
|
|
private isHidden: boolean = false;
|
|
|
|
constructor(private g: GameView) {}
|
|
|
|
init() {}
|
|
|
|
public async tick() {
|
|
if (this.isHidden) {
|
|
return;
|
|
}
|
|
|
|
const gameTicks = this.g.ticks() - this.g.config().numSpawnPhaseTurns();
|
|
if (gameTicks > AD_SHOW_TICKS) {
|
|
console.log("destroying sticky ads");
|
|
window.fusetag?.que?.push(() => {
|
|
window.fusetag?.destroySticky?.();
|
|
});
|
|
this.isHidden = true;
|
|
return;
|
|
}
|
|
}
|
|
}
|