/
memoryspeak
/
UlamCodeWeb
Обзор
Документация
Войти
/
memoryspeak
/
UlamCodeWeb
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
js/App.js
104 строки
3 KB
memoryspeak
refactor function parameters
17 фев 2026, 18:30
17 фев 2026, 18:30
d5167b6
Код
Авторство
О чём код?
import Layer from "./Layer.js"; import Loop from "./Loop.js"; import Input from "./Input.js"; import Database from "./Database.js"; import Map from "./Map.js"; import RunningLine from "./elements/RunningLine.js"; import RandomHint from "./elements/RandomHint.js"; import DivisorHint from "./elements/divisorHint/DivisorHint.js"; import Score from "./elements/Score.js"; import Modal from "./elements/modals/Modal.js"; import LeftButton from "./elements/controls/LeftButton.js"; import RightButton from "./elements/controls/RightButton.js"; import UpButton from "./elements/controls/UpButton.js"; import DownButton from "./elements/controls/DownButton.js"; import CenterButton from "./elements/controls/CenterButton.js"; import Controls from "./elements/controls/Controls.js"; export default class App { constructor(container) { this.database = new Database(); this.layer = new Layer(container); this.input = new Input(this); this.modal = new Modal(this); this.score = new Score(this); this.divisorHint = new DivisorHint(this); this.runningLine = new RunningLine(this); this.map = new Map(this); this.randomHint = new RandomHint(this); this.areControls = false; this.leftButton = new LeftButton(this); this.rightButton = new RightButton(this); this.upButton = new UpButton(this); this.downButton = new DownButton(this); this.centerButton = new CenterButton(this); this.controls = new Controls(this); new Loop(this.update.bind(this), this.draw.bind(this)); } update(correction) { this.map.update(correction); this.runningLine.update(correction); this.randomHint.update(correction); this.divisorHint.update(correction); this.score.update(correction); this.controls.update(correction); this.leftButton.update(correction); this.rightButton.update(correction); this.upButton.update(correction); this.downButton.update(correction); this.centerButton.update(correction); this.input.update(); this.modal.update(correction); } draw() { this.layer.clear(); this.map.draw(); this.runningLine.draw(); this.randomHint.draw(); this.divisorHint.draw(); this.score.draw(); this.leftButton.draw(); this.rightButton.draw(); this.upButton.draw(); this.downButton.draw(); this.centerButton.draw(); this.controls.draw(); this.modal.draw(); } } onload = () => { const bgMusic = new Audio("sound/bg.mp3"); bgMusic.loop = true; bgMusic.volume = 1.0; const startButton = document.getElementById("start"); startButton.addEventListener( "click", function (event) { startButton.disabled = true; const doc = document.documentElement; let isFullscreen = true; if (doc.requestFullscreen) { doc.requestFullscreen(); } else if (doc.webkitRequestFullscreen) { doc.webkitRequestFullscreen(); } else if (doc.msRequestFullscreen) { doc.msRequestFullscreen(); } else { isFullscreen = false; } if (isFullscreen) { startButton.style.display = "none"; new App(document.body); bgMusic.play(); } }, false, ); };