import Loop from "./Loop.js"; import UIManager from "./UI/UIManager.js"; import Playground from "./Elements/Playground.js"; import MovementHandler from "./Elements/MovementHandler.js"; class Game{ /**@param {import("../../../../backend/node_modules/socket.io-client".Socket} socket Autocompletions VSC*/ constructor(socket) { this.socket = socket; this.loop = new Loop(this.socket, this); this.uiManager = new UIManager(); this.movementHandler = undefined; this.playGround = undefined; this.gameStarted = false; this.ourColor = null; this.socket.on("startGame", (data) => { this.start(data) }); this.socket.on("color", (data) => { this.setOutColor(data) }) } start(playgroundSize){ this.gameStarted = true; this.uiManager.loadGameContent(); this.movementHandler = new MovementHandler(this.socket); this.playGround = new Playground(this, this.uiManager, playgroundSize); } setOutColor(color){ this.ourColor = color; this.uiManager.addSnakeColorInfo(color); } } export default Game;