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
744058e2
Commit
744058e2
authored
May 28, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix draw
parent
b013068f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
23 deletions
+8
-23
src/service/duel/confirmCards.ts
src/service/duel/confirmCards.ts
+1
-1
src/service/duel/draw.ts
src/service/duel/draw.ts
+7
-22
No files found.
src/service/duel/confirmCards.ts
View file @
744058e2
import
{
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
{
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
{
sleep
}
from
"
@/infra
"
;
import
{
sleep
}
from
"
@/infra
"
;
import
{
cardStore
,
matStore
}
from
"
@/stores
"
;
import
{
cardStore
}
from
"
@/stores
"
;
export
default
async
(
confirmCards
:
ygopro
.
StocGameMessage
.
MsgConfirmCards
)
=>
{
export
default
async
(
confirmCards
:
ygopro
.
StocGameMessage
.
MsgConfirmCards
)
=>
{
const
cards
=
confirmCards
.
cards
;
const
cards
=
confirmCards
.
cards
;
...
...
src/service/duel/draw.ts
View file @
744058e2
import
{
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
{
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
{
sleep
}
from
"
@/infra
"
;
import
{
cardStore
,
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
cardStore
,
fetchEsHintMeta
,
matStore
}
from
"
@/stores
"
;
import
{
zip
}
from
"
@/ui/Duel/utils
"
;
export
default
async
(
draw
:
ygopro
.
StocGameMessage
.
MsgDraw
)
=>
{
export
default
async
(
draw
:
ygopro
.
StocGameMessage
.
MsgDraw
)
=>
{
fetchEsHintMeta
({
originMsg
:
"
玩家抽卡时
"
});
fetchEsHintMeta
({
originMsg
:
"
玩家抽卡时
"
});
const
deckLength
=
matStore
.
decks
.
of
(
draw
.
player
).
length
;
const
drawLength
=
draw
.
cards
.
length
;
const
drawLength
=
draw
.
cards
.
length
;
const
popCards
=
matStore
.
decks
.
of
(
draw
.
player
)
.
splice
(
deckLength
-
drawLength
,
drawLength
);
const
data
=
zip
(
popCards
,
draw
.
cards
).
map
(([
pop
,
hand
])
=>
{
return
{
uuid
:
pop
.
uuid
,
id
:
hand
};
});
matStore
.
hands
.
of
(
draw
.
player
)
.
add
(
data
,
ygopro
.
CardPosition
.
FACEUP_ATTACK
,
true
);
await
sleep
(
500
);
for
(
const
hand
of
matStore
.
hands
.
of
(
draw
.
player
))
{
hand
.
focus
=
false
;
}
// 将卡从卡组移到手牌:设置zone、occupant、sequence
// 将卡从卡组移到手牌:设置zone、occupant、sequence
const
handsLength
=
cardStore
.
at
(
ygopro
.
CardZone
.
HAND
,
draw
.
player
).
length
;
const
handsLength
=
cardStore
.
at
(
ygopro
.
CardZone
.
HAND
,
draw
.
player
).
length
;
...
@@ -32,12 +12,17 @@ export default async (draw: ygopro.StocGameMessage.MsgDraw) => {
...
@@ -32,12 +12,17 @@ export default async (draw: ygopro.StocGameMessage.MsgDraw) => {
.
at
(
ygopro
.
CardZone
.
DECK
,
draw
.
player
)
.
at
(
ygopro
.
CardZone
.
DECK
,
draw
.
player
)
.
slice
(
-
drawLength
)
.
slice
(
-
drawLength
)
.
forEach
(
async
(
card
,
idx
)
=>
{
.
forEach
(
async
(
card
,
idx
)
=>
{
const
code
=
draw
.
cards
[
idx
];
const
meta
=
await
fetchCard
(
code
);
card
.
code
=
code
;
card
.
meta
=
meta
;
card
.
zone
=
ygopro
.
CardZone
.
HAND
;
card
.
zone
=
ygopro
.
CardZone
.
HAND
;
card
.
code
=
draw
.
cards
[
idx
];
card
.
sequence
=
idx
+
handsLength
;
card
.
sequence
=
idx
+
handsLength
;
});
});
// 抽卡动画
// 抽卡动画
cardStore
cardStore
.
at
(
ygopro
.
CardZone
.
HAND
,
draw
.
player
)
.
at
(
ygopro
.
CardZone
.
HAND
,
draw
.
player
)
.
forEach
((
card
)
=>
eventBus
.
emit
(
Report
.
Move
,
card
.
uuid
));
.
forEach
((
card
)
=>
eventBus
.
emit
(
Report
.
Move
,
card
.
uuid
));
// FIXME: `eventBus.emit`的方式能保证动画完成后才进行下一次msg的处理么
// 如果下一次msg来得很快,可能会有动画冲突?
};
};
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