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
4c0e1367
Commit
4c0e1367
authored
Aug 15, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
게임 한 판이 끝날 때 그 게임에 들어있는 인스턴스들 모두 초기화 되게 함
parent
b2cdc152
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
44 deletions
+76
-44
Client.js
js/Client.js
+9
-8
GameCycle.js
js/GameCycle.js
+1
-30
ScenesData.js
js/ScenesData.js
+2
-1
WordSpace.js
js/WordSpace.js
+63
-4
server.js
server.js
+1
-1
No files found.
js/Client.js
View file @
4c0e1367
...
...
@@ -317,15 +317,19 @@ var backToMenu = function()
actions
:
'
center
'
// 'center'|'left'|'right'
}
}).
setDepth
(
10
);
var
temp
=
function
(){
//WordSpace.resetGame();
socket
.
emit
(
'
exitFromRoom
'
,
RoomData
.
myself
.
id
);
fbClient
.
updateUserData
(
'
killCount
'
,
RoomData
.
myself
.
killCount
);
fbClient
.
updateUserData
(
'
money
'
,
10
);
ScenesData
.
changeScene
(
'
menuScene
'
);
}
ScenesData
.
gameScene
.
backToMenuDialog
.
on
(
'
button.click
'
,
function
(
button
,
groupName
,
index
)
{
if
(
index
==
0
)
{
socket
.
emit
(
'
exitFromRoom
'
,
RoomData
.
myself
.
id
);
fbClient
.
updateUserData
(
'
killCount
'
,
RoomData
.
myself
.
killCount
);
fbClient
.
updateUserData
(
'
money
'
,
10
);
ScenesData
.
changeScene
(
'
menuScene
'
);
temp
();
}
else
{
...
...
@@ -333,10 +337,7 @@ var backToMenu = function()
ScenesData
.
gameScene
.
backToMenuBtn
=
UIObject
.
createButton
(
ScenesData
.
gameScene
,
UIObject
.
createLabel
(
ScenesData
.
gameScene
,
100
,
900
,
5
,
'
pyeongminThrow
'
,
0.5
,
'
center
'
),
1
,
0
,
2
,
function
()
{
socket
.
emit
(
'
exitFromRoom
'
,
RoomData
.
myself
.
id
);
fbClient
.
updateUserData
(
'
killCount
'
,
RoomData
.
myself
.
killCount
);
fbClient
.
updateUserData
(
'
money
'
,
10
);
ScenesData
.
changeScene
(
'
menuScene
'
);
temp
();
});
}
},
ScenesData
.
gameScene
)
...
...
js/GameCycle.js
View file @
4c0e1367
...
...
@@ -39,32 +39,3 @@ class Cycle //앞으로 cycle은 이 클래스를 사용해서 구현할 것
else
this
.
currentCycle
=
scene
.
time
.
addEvent
(
option
);
}
}
\ No newline at end of file
//단어 생성 사이클
WordSpace
.
wordCycle
=
new
Cycle
(
function
()
{
WordSpace
.
genWordByProb
(
this
);
});
//게임 오버 사이클
WordSpace
.
gameOverCycle
=
new
Cycle
(
gameOver
);
//호패 생성 사이클
WordSpace
.
nameCycle
=
new
Cycle
(
function
()
{
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
});
//이건 뭐지
WordSpace
.
varAdjustCycle
=
new
Cycle
(
function
()
{
//나중에는 메세지 분석해서 Phase랑 playerTypingRate 받겠지만 일단 이렇게 해둠
//WordSpace.GetPhase();
//WordSpace.GetPlayerTypingRate();
WordSpace
.
AdjustVarByPhase
(
WordSpace
.
playerTypingRate
,
WordSpace
.
CurrentPhase
);
});
// playerTypingRate 갱신용 사이클
WordSpace
.
playerTypingCycle
=
new
Cycle
(
function
()
{
socket
.
emit
(
'
setPlayerTyping
'
,
{
playerTyping
:
WordSpace
.
playerTyping
,
isWord
:
WordSpace
.
setPlayerTyping
.
writeWord
,
isAttackMode
:
Input
.
attackMode
}
);
WordSpace
.
setPlayerTyping
.
writeWord
=
false
;
});
// 공격받을때의 일회용 이벤트들
WordSpace
.
attackedEvents
=
[];
\ No newline at end of file
js/ScenesData.js
View file @
4c0e1367
...
...
@@ -419,6 +419,7 @@ var gameScene = new Phaser.Class(
url
:
'
https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/plugins/dist/rexbuttonplugin.min.js
'
,
sceneKey
:
'
button
'
});
WordSpace
.
resetGame
();
WordSpace
.
weightTextObjForTest
=
this
.
add
.
text
(
game
.
config
.
width
*
5
/
64
,
game
.
config
.
height
*
5
/
48
,
'
뇌의 무게: (현재) 0 /
'
+
this
.
brainCapacity
+
'
(전체)
'
).
setDepth
(
10
).
setColor
(
'
#000000
'
);
WordSpace
.
killLogTextForTest
=
this
.
add
.
text
(
game
.
config
.
width
*
25
/
32
,
game
.
config
.
height
*
5
/
72
,
WordSpace
.
killLogForTest
).
setDepth
(
10
).
setColor
(
'
#000000
'
).
setAlign
(
'
right
'
);
},
...
...
@@ -453,7 +454,7 @@ var gameScene = new Phaser.Class(
update
:
function
()
{
if
(
ScenesData
.
currentScene
==
ScenesData
.
gameScene
)
if
(
ScenesData
.
currentScene
==
ScenesData
.
gameScene
&&
WordSpace
.
gameTimer
!=
null
)
{
WordSpace
.
deltaTime
=
this
.
sys
.
game
.
loop
.
delta
;
WordSpace
.
wordForcedGroup
.
forEach
(
function
(
element
)
...
...
js/WordSpace.js
View file @
4c0e1367
...
...
@@ -222,9 +222,6 @@ function gameOver()
socket
.
emit
(
'
defeated
'
);
console
.
log
(
'
defeat
'
);
ScenesData
.
gameScene
.
add
.
text
(
game
.
config
.
width
/
2
,
game
.
config
.
height
/
2
,
'
패배
'
,
{
fontSize
:
'
30pt
'
})
.
setPadding
(
5
,
5
,
5
,
5
).
setOrigin
(
0.5
,
0.5
).
setDepth
(
10
)
.
setColor
(
'
#000000
'
).
setBackgroundColor
(
'
#ffffff
'
);
}
//게임 오버 판정을 위한 타이머
...
...
@@ -347,6 +344,11 @@ WordSpace.setPlayerTyping =
initiate
:
function
(
scene
)
{
this
.
text
=
scene
.
add
.
text
(
100
,
200
,
'
현재 타수 :
'
+
WordSpace
.
playerTyping
.
toFixed
(
1
)).
setDepth
(
10
).
setColor
(
'
#000000
'
);
},
reset
:
function
()
{
this
.
totalTyping
=
0
;
this
.
writeWord
=
false
;
}
}
...
...
@@ -486,5 +488,62 @@ WordSpace.nameQueue =
this
.
shuffle
();
}
}
WordSpace
.
resetGame
=
function
()
{
WordSpace
.
weightTextObjForTest
=
null
;
WordSpace
.
nameWordTextForTest
=
null
;
WordSpace
.
killLogTextForTest
=
null
;
WordSpace
.
killLogForTest
=
''
;
WordSpace
.
nextWordCode
=
0
;
WordSpace
.
totalWeight
=
0
;
//현재 단어 무게 총합
WordSpace
.
totalWordNum
=
0
;
WordSpace
.
brainCapacity
=
200
;
//수용 가능한 단어 무게 최대치
WordSpace
.
gameTimer
=
null
;
//현재 게임 플레이 시간 타이머
WordSpace
.
isTimerOn
=
false
;
WordSpace
.
isInvincible
=
false
;
WordSpace
.
pyeongminAnims
=
[];
WordSpace
.
wordGroup
=
[];
WordSpace
.
nameGroup
=
[];
WordSpace
.
attackPaperGroup
=
[];
WordSpace
.
wordForcedGroup
=
[];
WordSpace
.
wordPhysicsGroup
=
null
;
WordSpace
.
gameOverUI
\ No newline at end of file
WordSpace
.
nameQueue
.
queue
=
[];
WordSpace
.
setPlayerTyping
.
reset
();
WordSpace
.
isTimerOn
=
false
;
WordSpace
.
attackGauge
.
resetValue
();
WordSpace
.
CurrentPhase
=
WordSpace
.
Phase
.
START
;
WordSpace
.
playerTyping
=
0
;
WordSpace
.
playerTypingRate
=
0
;
//단어 생성 사이클
WordSpace
.
wordCycle
=
new
Cycle
(
function
()
{
WordSpace
.
genWordByProb
(
this
);
});
//게임 오버 사이클
WordSpace
.
gameOverCycle
=
new
Cycle
(
gameOver
);
//호패 생성 사이클
WordSpace
.
nameCycle
=
new
Cycle
(
function
()
{
WordSpace
.
generateWord
.
Name
(
ScenesData
.
gameScene
,
false
,
null
);
});
//이건 뭐지
WordSpace
.
varAdjustCycle
=
new
Cycle
(
function
()
{
//나중에는 메세지 분석해서 Phase랑 playerTypingRate 받겠지만 일단 이렇게 해둠
//WordSpace.GetPhase();
//WordSpace.GetPlayerTypingRate();
WordSpace
.
AdjustVarByPhase
(
WordSpace
.
playerTypingRate
,
WordSpace
.
CurrentPhase
);
});
// playerTypingRate 갱신용 사이클
WordSpace
.
playerTypingCycle
=
new
Cycle
(
function
()
{
socket
.
emit
(
'
setPlayerTyping
'
,
{
playerTyping
:
WordSpace
.
playerTyping
,
isWord
:
WordSpace
.
setPlayerTyping
.
writeWord
,
isAttackMode
:
Input
.
attackMode
}
);
WordSpace
.
setPlayerTyping
.
writeWord
=
false
;
});
// 공격받을때의 일회용 이벤트들
WordSpace
.
attackedEvents
=
[];
}
\ No newline at end of file
server.js
View file @
4c0e1367
...
...
@@ -13,7 +13,7 @@ app.get('/', function(req, res) {
});
// http 기본 포트(80)에 서버 열기
server
.
listen
(
80
80
,
function
()
{
server
.
listen
(
80
,
function
()
{
console
.
log
(
'
[SERVER] Listening on port
'
+
server
.
address
().
port
);
GameServer
.
serverNumber
=
Math
.
floor
(
Math
.
random
()
*
1000
+
1
);
console
.
log
(
'
[SERVER] server number is
'
+
GameServer
.
serverNumber
);
...
...
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