mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-11 09:11:50 +00:00
Remove highly redundant utils functions
Remove isSupportedBrowser entirely and inline usages of getLogoSprite.
This commit is contained in:
parent
2f23c0174d
commit
a6a517a96b
@ -9,12 +9,12 @@ import { AtlasDefinition, atlasFiles } from "./atlas_definitions";
|
|||||||
import { Loader } from "./loader";
|
import { Loader } from "./loader";
|
||||||
import { createLogger } from "./logging";
|
import { createLogger } from "./logging";
|
||||||
import { Signal } from "./signal";
|
import { Signal } from "./signal";
|
||||||
import { clamp, getLogoSprite, timeoutPromise } from "./utils";
|
import { clamp, timeoutPromise } from "./utils";
|
||||||
|
|
||||||
const logger = createLogger("background_loader");
|
const logger = createLogger("background_loader");
|
||||||
|
|
||||||
const MAIN_MENU_ASSETS = {
|
const MAIN_MENU_ASSETS = {
|
||||||
sprites: [getLogoSprite()],
|
sprites: ["logo.png"],
|
||||||
sounds: [SOUNDS.uiClick, SOUNDS.uiError, SOUNDS.dialogError, SOUNDS.dialogOk],
|
sounds: [SOUNDS.uiClick, SOUNDS.uiError, SOUNDS.dialogError, SOUNDS.dialogOk],
|
||||||
atlas: [],
|
atlas: [],
|
||||||
css: [],
|
css: [],
|
||||||
|
|||||||
@ -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"
|
* Formats an amount of seconds into something like "5s ago"
|
||||||
* @param {number} secs Seconds
|
* @param {number} secs Seconds
|
||||||
@ -659,13 +652,6 @@ export function getRomanNumber(number) {
|
|||||||
return formatted;
|
return formatted;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the appropriate logo sprite path
|
|
||||||
*/
|
|
||||||
export function getLogoSprite() {
|
|
||||||
return "logo.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rejects a promise after X ms
|
* Rejects a promise after X ms
|
||||||
* @param {Promise} promise
|
* @param {Promise} promise
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
|
import { THIRDPARTY_URLS } from "../core/config";
|
||||||
import { TextualGameState } from "../core/textual_game_state";
|
import { TextualGameState } from "../core/textual_game_state";
|
||||||
import { T } from "../translations";
|
import { T } from "../translations";
|
||||||
import { THIRDPARTY_URLS } from "../core/config";
|
|
||||||
import { getLogoSprite } from "../core/utils";
|
|
||||||
|
|
||||||
export class AboutState extends TextualGameState {
|
export class AboutState extends TextualGameState {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -15,7 +14,7 @@ export class AboutState extends TextualGameState {
|
|||||||
getMainContentHTML() {
|
getMainContentHTML() {
|
||||||
return `
|
return `
|
||||||
<div class="head">
|
<div class="head">
|
||||||
<img src="res/${getLogoSprite()}" alt="shapez.io Logo">
|
<img src="res/logo.png" alt="shapez.io Logo">
|
||||||
</div>
|
</div>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
${T.about.body
|
${T.about.body
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import { DialogWithForm } from "../core/modal_dialog_elements";
|
|||||||
import { FormElementInput } from "../core/modal_dialog_forms";
|
import { FormElementInput } from "../core/modal_dialog_forms";
|
||||||
import {
|
import {
|
||||||
formatSecondsToTimeAgo,
|
formatSecondsToTimeAgo,
|
||||||
getLogoSprite,
|
|
||||||
makeButton,
|
makeButton,
|
||||||
makeDiv,
|
makeDiv,
|
||||||
makeDivElement,
|
makeDivElement,
|
||||||
@ -42,7 +41,7 @@ export class MainMenuState extends GameState {
|
|||||||
</video>
|
</video>
|
||||||
|
|
||||||
<div class="logo">
|
<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())}"
|
width="${Math.round((710 / 3) * this.app.getEffectiveUiScale())}"
|
||||||
height="${Math.round((180 / 3) * this.app.getEffectiveUiScale())}"
|
height="${Math.round((180 / 3) * this.app.getEffectiveUiScale())}"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import { CHANGELOG } from "../changelog";
|
|||||||
import { globalConfig } from "../core/config";
|
import { globalConfig } from "../core/config";
|
||||||
import { GameState } from "../core/game_state";
|
import { GameState } from "../core/game_state";
|
||||||
import { createLogger } from "../core/logging";
|
import { createLogger } from "../core/logging";
|
||||||
import { getLogoSprite } from "../core/utils";
|
|
||||||
import { getRandomHint } from "../game/hints";
|
import { getRandomHint } from "../game/hints";
|
||||||
import { HUDModalDialogs } from "../game/hud/parts/modal_dialogs";
|
import { HUDModalDialogs } from "../game/hud/parts/modal_dialogs";
|
||||||
import { T, autoDetectLanguageId, updateApplicationLanguage } from "../translations";
|
import { T, autoDetectLanguageId, updateApplicationLanguage } from "../translations";
|
||||||
@ -235,7 +234,7 @@ export class PreloadState extends GameState {
|
|||||||
|
|
||||||
subElement.innerHTML = `
|
subElement.innerHTML = `
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<img src="res/${getLogoSprite()}" alt="Shapez.io Logo">
|
<img src="res/logo.png" alt="Shapez.io Logo">
|
||||||
</div>
|
</div>
|
||||||
<div class="failureInner">
|
<div class="failureInner">
|
||||||
<div class="errorHeader">
|
<div class="errorHeader">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user