1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-09 16:21:51 +00:00

Remove highly redundant utils functions

Remove isSupportedBrowser entirely and inline usages of getLogoSprite.
This commit is contained in:
Даниїл Григор'єв 2025-06-14 06:14:58 +03:00
parent 2f23c0174d
commit a6a517a96b
No known key found for this signature in database
GPG Key ID: B890DF16341D8C1D
5 changed files with 6 additions and 23 deletions

View File

@ -9,12 +9,12 @@ import { AtlasDefinition, atlasFiles } from "./atlas_definitions";
import { Loader } from "./loader";
import { createLogger } from "./logging";
import { Signal } from "./signal";
import { clamp, getLogoSprite, timeoutPromise } from "./utils";
import { clamp, timeoutPromise } from "./utils";
const logger = createLogger("background_loader");
const MAIN_MENU_ASSETS = {
sprites: [getLogoSprite()],
sprites: ["logo.png"],
sounds: [SOUNDS.uiClick, SOUNDS.uiError, SOUNDS.dialogError, SOUNDS.dialogOk],
atlas: [],
css: [],

View File

@ -399,13 +399,6 @@ export function removeAllChildren(elem) {
}
}
/**
* Returns if the game supports this browser
*/
export function isSupportedBrowser() {
return true;
}
/**
* Formats an amount of seconds into something like "5s ago"
* @param {number} secs Seconds
@ -659,13 +652,6 @@ export function getRomanNumber(number) {
return formatted;
}
/**
* Returns the appropriate logo sprite path
*/
export function getLogoSprite() {
return "logo.png";
}
/**
* Rejects a promise after X ms
* @param {Promise} promise

View File

@ -1,7 +1,6 @@
import { THIRDPARTY_URLS } from "../core/config";
import { TextualGameState } from "../core/textual_game_state";
import { T } from "../translations";
import { THIRDPARTY_URLS } from "../core/config";
import { getLogoSprite } from "../core/utils";
export class AboutState extends TextualGameState {
constructor() {
@ -15,7 +14,7 @@ export class AboutState extends TextualGameState {
getMainContentHTML() {
return `
<div class="head">
<img src="res/${getLogoSprite()}" alt="shapez.io Logo">
<img src="res/logo.png" alt="shapez.io Logo">
</div>
<div class="text">
${T.about.body

View File

@ -4,7 +4,6 @@ import { DialogWithForm } from "../core/modal_dialog_elements";
import { FormElementInput } from "../core/modal_dialog_forms";
import {
formatSecondsToTimeAgo,
getLogoSprite,
makeButton,
makeDiv,
makeDivElement,
@ -42,7 +41,7 @@ export class MainMenuState extends GameState {
</video>
<div class="logo">
<img src="res/${getLogoSprite()}" alt="shapez.io Logo"
<img src="res/logo.png" alt="shapez.io Logo"
width="${Math.round((710 / 3) * this.app.getEffectiveUiScale())}"
height="${Math.round((180 / 3) * this.app.getEffectiveUiScale())}"
>

View File

@ -2,7 +2,6 @@ import { CHANGELOG } from "../changelog";
import { globalConfig } from "../core/config";
import { GameState } from "../core/game_state";
import { createLogger } from "../core/logging";
import { getLogoSprite } from "../core/utils";
import { getRandomHint } from "../game/hints";
import { HUDModalDialogs } from "../game/hud/parts/modal_dialogs";
import { T, autoDetectLanguageId, updateApplicationLanguage } from "../translations";
@ -235,7 +234,7 @@ export class PreloadState extends GameState {
subElement.innerHTML = `
<div class="logo">
<img src="res/${getLogoSprite()}" alt="Shapez.io Logo">
<img src="res/logo.png" alt="Shapez.io Logo">
</div>
<div class="failureInner">
<div class="errorHeader">