Kaydet (Commit) 26001952 authored tarafından Abdülkerim AKSAK's avatar Abdülkerim AKSAK

Ekranlara overlay eklendi. Server güncellendi.

üst ba62ebb6
......@@ -10,8 +10,15 @@
<body>
<div class="container-fluid">
<div id="overlay" onclick="overlayOff()">
<div id="text">Bitti</div>
<div id="overlay">
<div>
<p id="text"></p>
</div>
<div style="position: absolute; top: 50%; left: 40%">
<button class="big-button" onclick="yenidenOyna()" style="font-size: 11px; width: 150px">
Yeniden Oyna
</button>
</div>
</div>
<div id="overlayOda" onclick="overlayOff()">
<div class="row" style="padding: 50px">
......
......@@ -366,8 +366,8 @@ function yenidenOyna() {
const io = require("socket.io-client");
//Connect http://localhost:3000
//let game = io.connect("https://mangala-server.herokuapp.com/game");
let game = io.connect("http://localhost:3000/game");
let game = io.connect("https://mangala-server.herokuapp.com/game");
//let game = io.connect("http://localhost:3000/game");
const username = "Kerim";
......
// Server Side
const express = require("express");
const app = express();
const port = 3030;
const http = require("http").createServer();
const port = process.env.PORT || 3000;
const http = require("http").createServer(app);
const io = require("socket.io")(http);
var gameRooms = []; // Kullanıcıların oluşturmuş oldukları odalar
app.get("/", function (req, res) {
res.sendFile(__dirname + "/index.html");
});
io.of("/game").on("connection", (socket) => {
socket.emit("welcome", "hello to <namespcaess>");
......@@ -51,7 +55,7 @@ io.of("/game").on("connection", (socket) => {
console.log(
`newMsg...: "${username}" kisisinden "${roomKey}" odasindan "${msg}" mesaji yollandi.`
);
socket.broadcast.to(roomKey).emit("newMessage", username, msg); //oda içindeki her user için gönderilir.
socket.broadcast.to(roomKey).emit("newMessage", msg); //oda içindeki her user için gönderilir.
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment