Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sejong25
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Tear of Sejong
sejong25
Commits
fc356f78
Commit
fc356f78
authored
Jul 22, 2019
by
18신대성
Committed by
18손재민
Jul 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
같은 사람에 대한 여러 공격이 뭉쳐서 가도록 변경
parent
94d2cd10
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
16 deletions
+37
-16
GameServer.js
GameServer.js
+0
-1
Client.js
js/Client.js
+3
-1
WordSpace.js
js/WordSpace.js
+29
-10
server.js
server.js
+5
-4
No files found.
GameServer.js
View file @
fc356f78
...
...
@@ -70,7 +70,6 @@ GameServer.getRoomNumber = function()
}
while
(
true
)
}
class
GameRoom
{
constructor
()
...
...
js/Client.js
View file @
fc356f78
...
...
@@ -13,6 +13,8 @@ socket.on('alert', function(msg) // string errorcode
ScenesData
.
gameScene
.
add
.
text
(
640
,
360
,
'
승리!!!!
'
,
{
fontSize
:
'
30pt
'
})
.
setPadding
(
5
,
5
,
5
,
5
).
setOrigin
(
0.5
,
0.5
).
setDepth
(
11
)
.
setColor
(
'
#000000
'
).
setBackgroundColor
(
'
#ffffff
'
);
gameOver
();
}
//alert(toAlert);
});
...
...
@@ -138,7 +140,7 @@ socket.on('attacked', function(msg) // object attackData
//console.log('attacked by ' + msg.attacker.nickname);
var
timeout
=
setTimeout
(
function
()
{
WordSpace
.
generateWord
.
Attack
(
ScenesData
.
gameScene
,
msg
.
text
,
msg
.
grade
,
msg
.
attacker
,
msg
.
isStrong
,
msg
.
isCountable
);
for
(
let
i
=
0
;
i
<
msg
.
multiple
;
i
++
)
WordSpace
.
generateWord
.
Attack
(
ScenesData
.
gameScene
,
msg
.
text
,
msg
.
grade
,
msg
.
attacker
,
msg
.
isStrong
,
msg
.
isCountable
);
},
4000
);
//console.log(timeout);
});
...
...
js/WordSpace.js
View file @
fc356f78
...
...
@@ -350,7 +350,8 @@ WordSpace.findWord = function(wordText)
{
roomNum
:
RoomData
.
roomId
,
victim
:
RoomData
.
myself
,
target
:
element
.
attacker
.
id
target
:
element
.
attacker
.
id
,
word
:
element
.
wordText
}
socket
.
emit
(
'
defenseFailed
'
,
victimData
);
return
true
;
...
...
@@ -383,22 +384,40 @@ WordSpace.attack = function(wordText, grade)
if
(
wordText
!=
''
)
{
console
.
log
(
'
attack
'
+
wordText
+
'
, grade:
'
+
grade
);
let
toSend
=
[];
WordSpace
.
nameGroup
.
forEach
(
function
(
element
)
{
//console.log(RoomData.myself)
;
let
attackData
=
let
targetId
=
element
.
ownerId
;
let
sendIdx
=
toSend
.
findIndex
(
function
(
element
)
{
roomNum
:
RoomData
.
roomId
,
attacker
:
RoomData
.
myself
,
target
:
element
.
ownerId
,
text
:
wordText
,
grade
:
grade
,
isStrong
:
element
.
isStrong
return
element
.
target
===
targetId
;
});
if
(
sendIdx
!==
-
1
)
{
toSend
[
sendIdx
].
multiple
++
;
}
else
{
let
attackData
=
{
roomNum
:
RoomData
.
roomId
,
attacker
:
RoomData
.
myself
,
target
:
element
.
ownerId
,
text
:
wordText
,
grade
:
grade
,
isStrong
:
element
.
isStrong
,
multiple
:
1
}
toSend
.
push
(
attackData
);
}
socket
.
emit
(
'
attack
'
,
attackData
);
element
.
physicsObj
.
destroy
();
element
.
wordObj
.
destroy
();
});
toSend
.
forEach
(
function
(
element
)
{
socket
.
emit
(
'
attack
'
,
element
);
});
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
WordSpace
.
nameGroup
=
[];
...
...
server.js
View file @
fc356f78
...
...
@@ -129,10 +129,11 @@ io.on('connection', function(socket)
socket
.
on
(
'
defenseFailed
'
,
function
(
msg
)
{
socket
.
playerData
.
currentRoom
.
announceToTarget
(
msg
.
target
,
'
attackSucceed
'
,
msg
);
//let socket.playerData.playingData.lastAttacks.findIndex(function(element)
//{
//})
let
wrongCountIndex
=
socket
.
playerData
.
playingData
.
lastAttacks
.
findIndex
(
function
(
element
)
{
return
(
element
.
word
===
msg
.
word
)
&&
(
element
.
attackerId
===
msg
.
target
);
});
if
(
wrongCountIndex
!==
-
1
)
socket
.
playerData
.
playingData
.
lastAttacks
[
wrongCountIndex
].
wrongCount
++
;
});
socket
.
on
(
'
disconnect
'
,
function
(
reason
)
...
...
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