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 @@ ...@@ -10,8 +10,15 @@
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
<div id="overlay" onclick="overlayOff()"> <div id="overlay">
<div id="text">Bitti</div> <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>
<div id="overlayOda" onclick="overlayOff()"> <div id="overlayOda" onclick="overlayOff()">
<div class="row" style="padding: 50px"> <div class="row" style="padding: 50px">
......
...@@ -366,8 +366,8 @@ function yenidenOyna() { ...@@ -366,8 +366,8 @@ function yenidenOyna() {
const io = require("socket.io-client"); const io = require("socket.io-client");
//Connect http://localhost:3000 //Connect http://localhost:3000
//let game = io.connect("https://mangala-server.herokuapp.com/game"); let game = io.connect("https://mangala-server.herokuapp.com/game");
let game = io.connect("http://localhost:3000/game"); //let game = io.connect("http://localhost:3000/game");
const username = "Kerim"; const username = "Kerim";
......
// Server Side // Server Side
const express = require("express"); const express = require("express");
const app = express(); const app = express();
const port = 3030; const port = process.env.PORT || 3000;
const http = require("http").createServer(); const http = require("http").createServer(app);
const io = require("socket.io")(http); const io = require("socket.io")(http);
var gameRooms = []; // Kullanıcıların oluşturmuş oldukları odalar 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) => { io.of("/game").on("connection", (socket) => {
socket.emit("welcome", "hello to <namespcaess>"); socket.emit("welcome", "hello to <namespcaess>");
...@@ -51,7 +55,7 @@ io.of("/game").on("connection", (socket) => { ...@@ -51,7 +55,7 @@ io.of("/game").on("connection", (socket) => {
console.log( console.log(
`newMsg...: "${username}" kisisinden "${roomKey}" odasindan "${msg}" mesaji yollandi.` `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