Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
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
deft
Neos
Commits
954fb8be
Commit
954fb8be
authored
May 14, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct delay
parent
122be474
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
304 additions
and
297 deletions
+304
-297
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+218
-221
src/service/duel/timeLimit.ts
src/service/duel/timeLimit.ts
+3
-4
src/service/onSocketMessage.ts
src/service/onSocketMessage.ts
+83
-72
No files found.
src/service/duel/gameMsg.ts
View file @
954fb8be
...
...
@@ -60,10 +60,6 @@ const ActiveList = [
const
NeosConfig
=
useConfig
();
export
default
function
handleGameMsg
(
pb
:
ygopro
.
YgoStocMsg
)
{
// 防止MSG更新太频繁,做下控频
const
delay
=
matStore
.
delay
;
setTimeout
(()
=>
{
const
msg
=
pb
.
stoc_game_msg
;
if
(
ActiveList
.
includes
(
msg
.
gameMsg
))
{
...
...
@@ -108,6 +104,7 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
}
case
"
move
"
:
{
onMsgMove
(
msg
.
move
);
matStore
.
delay
=
NeosConfig
.
ui
.
moveDelay
+
500
;
break
;
}
...
...
@@ -233,6 +230,7 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
}
case
"
chaining
"
:
{
onMsgChaining
(
msg
.
chaining
);
matStore
.
delay
=
NeosConfig
.
ui
.
chainingDelay
;
break
;
}
...
...
@@ -280,5 +278,4 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break
;
}
}
},
delay
);
}
src/service/duel/timeLimit.ts
View file @
954fb8be
import
{
sendTimeConfirm
,
ygopro
}
from
"
@/api
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
matStore
}
from
"
@/stores
"
;
export
default
function
handleTimeLimit
(
timeLimit
:
ygopro
.
StocTimeLimit
)
{
setTimeout
(()
=>
{
matStore
.
timeLimits
.
set
(
timeLimit
.
player
,
timeLimit
.
left_time
);
if
(
matStore
.
isMe
(
timeLimit
.
player
))
{
sendTimeConfirm
();
}
,
useConfig
().
ui
.
commonDelay
);
}
}
src/service/onSocketMessage.ts
View file @
954fb8be
...
...
@@ -4,6 +4,8 @@
* */
import
{
adaptStoc
}
from
"
@/api/ocgcore/ocgAdapter/adapter
"
;
import
{
YgoProPacket
}
from
"
@/api/ocgcore/ocgAdapter/packet
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
matStore
}
from
"
@/stores
"
;
import
handleGameMsg
from
"
./duel/gameMsg
"
;
import
handleTimeLimit
from
"
./duel/timeLimit
"
;
...
...
@@ -18,6 +20,8 @@ import handleHsWatchChange from "./room/hsWatchChange";
import
handleJoinGame
from
"
./room/joinGame
"
;
import
handleTypeChange
from
"
./room/typeChange
"
;
const
NeosConfig
=
useConfig
();
/*
* 先将从长连接中读取到的二进制数据通过Adapter转成protobuf结构体,
* 然后再分发到各个处理函数中去处理。
...
...
@@ -27,6 +31,12 @@ export default function handleSocketMessage(e: MessageEvent) {
const
packet
=
YgoProPacket
.
deserialize
(
e
.
data
);
const
pb
=
adaptStoc
(
packet
);
// 防止MSG更新太频繁,做下控频
const
delay
=
matStore
.
delay
;
// 重置`delay`
matStore
.
delay
=
NeosConfig
.
ui
.
commonDelay
;
setTimeout
(()
=>
{
switch
(
pb
.
msg
)
{
case
"
stoc_join_game
"
:
{
handleJoinGame
(
pb
);
...
...
@@ -100,4 +110,5 @@ export default function handleSocketMessage(e: MessageEvent) {
break
;
}
}
},
delay
);
}
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