Start Logik

This commit is contained in:
2025-04-02 15:25:43 +02:00
parent c9f43c537e
commit 74ba1730f5
3 changed files with 42 additions and 17 deletions

View File

@@ -9,8 +9,8 @@
<link rel="icon" type="image/png" href="../assets/Logo.png">
</head>
<body>
<h1 id="pc"></h1>
<h1 id="rd"></h1>
<h1 id="wM"></h1>
<h1 id="wS"></h1>
</body>
<script src="https://cdn.socket.io/4.7.2/socket.io.min.js"></script>

View File

@@ -5,20 +5,16 @@ class ServerConnectionManager {
this.basicSetup();
this.socket.on("waitForStart", (data) => { this.waitForStart(data) });
this.socket.on("randomTest", (data) => { this.randomTest(data) });
// Socket.on Handler und Routen
this.socket.on("waitingForPlayers", (msg) => {
const { msg: message, waitingSeconds } = msg;
document.getElementById("wM").innerText = message;
document.getElementById("wS").innerText = waitingSeconds;
});
this.socket.on("gameEnd", (msg) => { this.gameEnd(msg) });
}
waitForStart(data) {
document.getElementById("pc").innerText = data;
}
randomTest(data) {
document.getElementById("rd").innerText = data;
}
gameEnd(msg){
this.socket.disconnect();
confirm(msg)