Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
srvpro
Commits
35901924
Commit
35901924
authored
Apr 30, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix side hang timeout
parent
21a2d777
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
ygopro-server.coffee
ygopro-server.coffee
+14
-1
ygopro-server.js
ygopro-server.js
+20
-1
No files found.
ygopro-server.coffee
View file @
35901924
...
@@ -756,7 +756,7 @@ wait_room_start = (room, time)->
...
@@ -756,7 +756,7 @@ wait_room_start = (room, time)->
time
-=
1
time
-=
1
if
time
if
time
unless
time
%
5
unless
time
%
5
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
if
time
<=
9
then
' '
else
''
}#{
time
}
秒后房主若不开始游戏将被请出房间"
,
if
time
<=
9
then
ygopro
.
constants
.
COLORS
.
RED
else
ygopro
.
constants
.
COLORS
.
BLUE
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
if
time
<=
9
then
' '
else
''
}#{
time
}
秒后房主若不开始游戏将被请出房间"
,
if
time
<=
9
then
ygopro
.
constants
.
COLORS
.
RED
else
ygopro
.
constants
.
COLORS
.
B
ABYB
LUE
)
setTimeout
(()
->
wait_room_start
(
room
,
time
);
return
),
1000
setTimeout
(()
->
wait_room_start
(
room
,
time
);
return
),
1000
else
else
for
player
in
room
.
players
for
player
in
room
.
players
...
@@ -857,6 +857,10 @@ ygopro.ctos_follow 'UPDATE_DECK', false, (buffer, info, client, server)->
...
@@ -857,6 +857,10 @@ ygopro.ctos_follow 'UPDATE_DECK', false, (buffer, info, client, server)->
side
=
(
info
.
deckbuf
[
i
]
for
i
in
[
info
.
mainc
...
info
.
mainc
+
info
.
sidec
])
side
=
(
info
.
deckbuf
[
i
]
for
i
in
[
info
.
mainc
...
info
.
mainc
+
info
.
sidec
])
client
.
main
=
main
client
.
main
=
main
client
.
side
=
side
client
.
side
=
side
return
unless
client
.
room
and
client
.
room
.
random_type
if
client
.
is_host
client
.
room
.
waiting_for_player
=
client
.
room
.
waiting_for_player2
client
.
room
.
last_active_time
=
moment
()
return
return
ygopro
.
ctos_follow
'RESPONSE'
,
false
,
(
buffer
,
info
,
client
,
server
)
->
ygopro
.
ctos_follow
'RESPONSE'
,
false
,
(
buffer
,
info
,
client
,
server
)
->
...
@@ -891,6 +895,15 @@ ygopro.stoc_follow 'SELECT_TP', false, (buffer, info, client, server)->
...
@@ -891,6 +895,15 @@ ygopro.stoc_follow 'SELECT_TP', false, (buffer, info, client, server)->
client
.
room
.
last_active_time
=
moment
()
client
.
room
.
last_active_time
=
moment
()
return
return
ygopro
.
stoc_follow
'CHANGE_SIDE'
,
false
,
(
buffer
,
info
,
client
,
server
)
->
return
unless
client
.
room
and
client
.
room
.
random_type
if
client
.
is_host
client
.
room
.
waiting_for_player
=
client
else
client
.
room
.
waiting_for_player2
=
client
client
.
room
.
last_active_time
=
moment
()
return
setInterval
()
->
setInterval
()
->
for
room
in
Room
.
all
when
room
and
room
.
started
and
room
.
random_type
and
room
.
last_active_time
and
room
.
waiting_for_player
for
room
in
Room
.
all
when
room
and
room
.
started
and
room
.
random_type
and
room
.
last_active_time
and
room
.
waiting_for_player
time_passed
=
Math
.
floor
((
moment
()
-
room
.
last_active_time
)
/
1000
)
time_passed
=
Math
.
floor
((
moment
()
-
room
.
last_active_time
)
/
1000
)
...
...
ygopro-server.js
View file @
35901924
...
@@ -864,7 +864,7 @@
...
@@ -864,7 +864,7 @@
time
-=
1
;
time
-=
1
;
if
(
time
)
{
if
(
time
)
{
if
(
!
(
time
%
5
))
{
if
(
!
(
time
%
5
))
{
ygopro
.
stoc_send_chat_to_room
(
room
,
""
+
(
time
<=
9
?
'
'
:
''
)
+
time
+
"
秒后房主若不开始游戏将被请出房间
"
,
time
<=
9
?
ygopro
.
constants
.
COLORS
.
RED
:
ygopro
.
constants
.
COLORS
.
BLUE
);
ygopro
.
stoc_send_chat_to_room
(
room
,
""
+
(
time
<=
9
?
'
'
:
''
)
+
time
+
"
秒后房主若不开始游戏将被请出房间
"
,
time
<=
9
?
ygopro
.
constants
.
COLORS
.
RED
:
ygopro
.
constants
.
COLORS
.
B
ABYB
LUE
);
}
}
setTimeout
((
function
()
{
setTimeout
((
function
()
{
wait_room_start
(
room
,
time
);
wait_room_start
(
room
,
time
);
...
@@ -1041,6 +1041,13 @@
...
@@ -1041,6 +1041,13 @@
})();
})();
client
.
main
=
main
;
client
.
main
=
main
;
client
.
side
=
side
;
client
.
side
=
side
;
if
(
!
(
client
.
room
&&
client
.
room
.
random_type
))
{
return
;
}
if
(
client
.
is_host
)
{
client
.
room
.
waiting_for_player
=
client
.
room
.
waiting_for_player2
;
}
client
.
room
.
last_active_time
=
moment
();
});
});
ygopro
.
ctos_follow
(
'
RESPONSE
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
ygopro
.
ctos_follow
(
'
RESPONSE
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
...
@@ -1087,6 +1094,18 @@
...
@@ -1087,6 +1094,18 @@
client
.
room
.
last_active_time
=
moment
();
client
.
room
.
last_active_time
=
moment
();
});
});
ygopro
.
stoc_follow
(
'
CHANGE_SIDE
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
if
(
!
(
client
.
room
&&
client
.
room
.
random_type
))
{
return
;
}
if
(
client
.
is_host
)
{
client
.
room
.
waiting_for_player
=
client
;
}
else
{
client
.
room
.
waiting_for_player2
=
client
;
}
client
.
room
.
last_active_time
=
moment
();
});
setInterval
(
function
()
{
setInterval
(
function
()
{
var
k
,
len
,
ref
,
room
,
time_passed
;
var
k
,
len
,
ref
,
room
,
time_passed
;
ref
=
Room
.
all
;
ref
=
Room
.
all
;
...
...
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