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

Oda sahibi username karşılama.

üst 2d2e04e6
{"user_name":"Haydut","score_list":[],"zorluk_setting":"Kolay"}
\ No newline at end of file
......@@ -25,8 +25,8 @@ user2hole.push(treasure2);
var player = 2;
waitcolor = "#ed664c"; //// Kırmızı renk beklesin
playercolor = "#ffe268"; // Sarı renk oynasın
waitvisible="visible";
playervisible="hidden";
waitvisible = "visible";
playervisible = "hidden";
function tikla(id) {
// ekranda bulunan kuyulardaki kuyulara tıklama ile tetiklenen fonk.
......@@ -41,8 +41,8 @@ function tikla(id) {
if (player == 2) {
document.getElementById("user1").style.backgroundColor = waitcolor;
document.getElementById("user2").style.backgroundColor = playercolor;
document.getElementById("clock1").style.visibility=playervisible;
document.getElementById("clock2").style.visibility=waitvisible;
document.getElementById("clock1").style.visibility = playervisible;
document.getElementById("clock2").style.visibility = waitvisible;
}
//sendMessage(Number(id[9]));
}
......@@ -56,8 +56,8 @@ function tikla(id) {
if (player == 1) {
document.getElementById("user1").style.backgroundColor = playercolor;
document.getElementById("user2").style.backgroundColor = waitcolor;
document.getElementById("clock1").style.visibility=waitvisible;
document.getElementById("clock2").style.visibility=playervisible;
document.getElementById("clock1").style.visibility = waitvisible;
document.getElementById("clock2").style.visibility = playervisible;
}
sendMessage(Number(id[9]));
}
......@@ -377,7 +377,7 @@ let game = io.connect("https://mangala-server.herokuapp.com/game");
//let game = io.connect("http://localhost:3000/game");
//username cekme
const name=require("./settings.js");
const name = require("./settings.js");
const username = name.getUsername();
console.log(name.getUsername());
......@@ -416,9 +416,11 @@ function overlayOda() {
let elemt3 = document.createElement("p");
let odaGirisi = document.getElementById("odaGirisi");
game.on("newUser", (username) => {
elemt3.textContent = username + " odaya katıldı.";
createNotification(username + " odaya katıldı.");
game.on("newUser", (userNew) => {
elemt3.textContent = userNew + " odaya katıldı.";
game.emit("sendUserName", username, randomKey); // İkinci kullanıcı karşılama(isim yollama)
document.getElementById("user1Name").innerHTML = userNew;
createNotification(userNew + " odaya katıldı.");
});
//odaGirisi.appendChild(elemt3);
overlayOdaOff();
......@@ -485,3 +487,7 @@ game.on("newMessage", (msg) => {
console.log(`newMessage...: "${msg}" mesajı geldi.`);
tikla("user1hole" + msg + "x");
});
game.on("newUserName", (username) => {
console.log(username);
});
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