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
love_飞影
Neos
Commits
992b8979
Commit
992b8979
authored
Jun 03, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update small
parent
5220b672
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
13 deletions
+4
-13
src/infra/stream.ts
src/infra/stream.ts
+1
-7
src/service/duel/attack.ts
src/service/duel/attack.ts
+2
-3
src/service/duel/chaining.ts
src/service/duel/chaining.ts
+1
-3
No files found.
src/infra/stream.ts
View file @
992b8979
...
...
@@ -3,10 +3,6 @@
//
// 因此封装了一个`WebSocketStream`类,当每次Websocket连接中有消息到达时,往流中添加event,
// 同时执行器会不断地从流中获取event进行处理。
import
{
sleep
}
from
"
./sleep
"
;
const
SLEEP_INTERVAL
=
200
;
export
class
WebSocketStream
{
public
ws
:
WebSocket
;
stream
:
ReadableStream
;
...
...
@@ -52,9 +48,7 @@ export class WebSocketStream {
return
;
}
else
{
// websocket not closed, sleep sometime, wait for next message from server
await
sleep
(
SLEEP_INTERVAL
);
// websocket not closed, handle next message from server
return
reader
.
read
().
then
(
process
);
}
}
...
...
src/service/duel/attack.ts
View file @
992b8979
import
{
ygopro
}
from
"
@/api
"
;
import
{
sleep
}
from
"
@/infra
"
;
import
{
cardStore
,
fetchEsHintMeta
,
matStore
}
from
"
@/stores
"
;
export
default
async
(
attack
:
ygopro
.
StocGameMessage
.
MsgAttack
)
=>
{
...
...
@@ -18,7 +17,7 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
if
(
attack
.
direct_attack
)
{
attacker
.
directAttack
=
true
;
await
sleep
(
500
);
//
await sleep(500);
attacker
.
directAttack
=
false
;
}
else
{
const
target
=
cardStore
.
at
(
...
...
@@ -33,7 +32,7 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
...
target
,
};
await
sleep
(
500
);
//
await sleep(500);
attacker
.
attackTarget
=
undefined
;
}
}
...
...
src/service/duel/chaining.ts
View file @
992b8979
import
{
ygopro
}
from
"
@/api
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
eventbus
,
sleep
,
Task
}
from
"
@/infra
"
;
import
{
eventbus
,
Task
}
from
"
@/infra
"
;
import
{
cardStore
,
fetchEsHintMeta
,
matStore
}
from
"
@/stores
"
;
export
default
async
(
chaining
:
ygopro
.
StocGameMessage
.
MsgChaining
)
=>
{
...
...
@@ -11,7 +10,6 @@ export default async (chaining: ygopro.StocGameMessage.MsgChaining) => {
await
cardStore
.
setChaining
(
chaining
.
location
,
chaining
.
code
,
true
);
await
sleep
(
useConfig
().
ui
.
chainingDelay
);
const
location
=
chaining
.
location
;
// 恢复成非`chaining`状态
...
...
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