Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
M
mangala-pardusacikhack
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Tuğba Fıçıcı
mangala-pardusacikhack
Commits
ba62ebb6
Kaydet (Commit)
ba62ebb6
authored
May 06, 2021
tarafından
Abdülkerim AKSAK
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Kullanıcıların mesaj yollama ve alma kısmı tamamlandı.
üst
165f08d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
7 deletions
+37
-7
clientApp.js
pages/clientApp.js
+2
-2
clientGameArea.js
pages/clientGameArea.js
+35
-5
No files found.
pages/clientApp.js
Dosyayı görüntüle @
ba62ebb6
...
...
@@ -2,8 +2,8 @@
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"
;
...
...
pages/clientGameArea.js
Dosyayı görüntüle @
ba62ebb6
...
...
@@ -31,7 +31,7 @@ function tikla(id) {
// tiklanan kuyunun html' deki id sini alır
// Paramaters:
// id --> tiklanan kuyunun html' deki id sini alır ex.("user1hole5")
if
(
Number
(
id
[
4
])
==
1
&&
player
==
Number
(
id
[
4
]))
{
if
(
Number
(
id
[
4
])
==
1
&&
player
==
Number
(
id
[
4
])
&&
id
[
10
]
==
"x"
)
{
if
(
user1hole
[
Number
(
id
[
9
])
-
1
].
value
!=
0
)
{
player
=
2
;
dagit
(
Number
(
id
[
4
]),
Number
(
id
[
9
]));
...
...
@@ -40,16 +40,20 @@ function tikla(id) {
document
.
getElementById
(
"user1"
).
style
.
backgroundColor
=
waitcolor
;
document
.
getElementById
(
"user2"
).
style
.
backgroundColor
=
playercolor
;
}
//sendMessage(Number(id[9]));
}
}
else
if
(
Number
(
id
[
4
])
==
2
&&
player
==
Number
(
id
[
4
]))
{
// player 2
if
(
user2hole
[
Number
(
id
[
9
])
-
1
].
value
!=
0
)
{
player
=
1
;
dagit
(
Number
(
id
[
4
]),
Number
(
id
[
9
]));
boncukCiz
();
if
(
player
==
1
)
{
document
.
getElementById
(
"user1"
).
style
.
backgroundColor
=
playercolor
;
document
.
getElementById
(
"user2"
).
style
.
backgroundColor
=
waitcolor
;
}
sendMessage
(
Number
(
id
[
9
]));
}
}
}
...
...
@@ -377,10 +381,10 @@ function overlayOda() {
document
.
getElementById
(
"overlayOda"
).
style
.
display
=
"block"
;
//ODA OLUSTURMA
randomKey
=
Math
.
random
().
toString
(
36
).
substr
(
2
,
5
);
// odalar için random key
const
odaOlusturContainer
=
document
.
getElementById
(
"odaOlustur"
);
const
odaOlusturBtn
=
document
.
getElementById
(
"odaOlusturBtn"
);
odaOlusturBtn
.
onclick
=
()
=>
{
randomKey
=
Math
.
random
().
toString
(
36
).
substr
(
2
,
5
);
// odalar için random key
let
elemt
=
document
.
createElement
(
"p"
);
//Server kısmında key adında oda olustur.
console
.
log
(
"girdi"
);
...
...
@@ -416,18 +420,21 @@ function overlayOda() {
let
odayaKatilInput
=
document
.
getElementById
(
"odayaKatilInput"
);
odayaKatilBtn
.
onclick
=
()
=>
{
let
roomKey
=
odayaKatilInput
.
value
;
randomKey
=
roomKey
;
game
.
emit
(
"joinRoom"
,
roomKey
,
"Muaz"
);
//username dinamik olmalı!!!!
let
elemt
=
document
.
createElement
(
"p"
);
let
elemt
5
=
document
.
createElement
(
"p"
);
game
.
on
(
"success"
,
(
roomKey
)
=>
{
elemt
.
textContent
=
roomKey
+
" odasına giriş yapıldı."
;
elemt
5
.
textContent
=
"Oda numarası: "
+
roomKey
;
createNotification
(
roomKey
+
" odasına giriş yapıldı."
);
});
game
.
on
(
"err"
,
(
roomKey
)
=>
{
elemt
.
textContent
=
roomKey
+
" odasına giriş yapılamadı."
;
elemt
5
.
textContent
=
roomKey
+
" odasına giriş yapılamadı."
;
createNotification
(
roomKey
+
" odasına giriş yapılamadı."
);
});
//odaGirisi.appendChild(elemt);
odaOlusturContainer
.
appendChild
(
elemt5
);
overlayOdaOff
();
player
=
1
;
};
}
...
...
@@ -445,3 +452,26 @@ const createNotification = (mesaj) => {
toasts
.
appendChild
(
notif
);
setTimeout
(()
=>
notif
.
remove
(),
3000
);
};
// MESAJ YOLLAMA <OdayaKatıl>
function
sendMessage
(
userHoleID
)
{
//let odayaKatilInput = document.getElementById("odayaKatilInput");
//let roomKey = odayaKatilInput.value; // Odaya katıl alanı için etkin
//let input = document.getElementById("mesajGonderOdayaKatilInput");
//let msg = input.value;
let
msg
=
userHoleID
;
//input.value = "";
game
.
emit
(
"newMsg"
,
"Muaz"
,
msg
,
randomKey
);
// username dinamik olmalı!!!!
}
// MESAJI ALMA <OdaOlustur>
function
addMessage
(
msg
)
{
let
elemt
=
document
.
createElement
(
"p"
);
elemt
.
textContent
=
`
${
username
}
:
${
msg
}
`
;
container
.
appendChild
(
elemt
);
}
game
.
on
(
"newMessage"
,
(
msg
)
=>
{
console
.
log
(
`newMessage...: "
${
msg
}
" mesajı geldi.`
);
tikla
(
"user1hole"
+
msg
+
"x"
);
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment