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
b68b030e
Commit
b68b030e
authored
Jun 20, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix something
parent
99af0d62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
39 deletions
+13
-39
src/service/duel/shuffleSetCard.ts
src/service/duel/shuffleSetCard.ts
+7
-35
src/service/duel/updateData.ts
src/service/duel/updateData.ts
+6
-4
No files found.
src/service/duel/shuffleSetCard.ts
View file @
b68b030e
...
...
@@ -5,51 +5,23 @@ import MsgShuffleSetCard = ygopro.StocGameMessage.MsgShuffleSetCard;
// 后端传过来的`from_locations`的列表是切洗前场上卡的location,它们在列表里面按照切洗后的顺序排列
export
default
async
(
shuffleSetCard
:
MsgShuffleSetCard
)
=>
{
const
zone
=
shuffleSetCard
.
zone
;
const
from_locations
=
shuffleSetCard
.
from_locations
;
if
(
from_locations
.
length
==
0
)
{
console
.
error
(
"
<ShuffleSetCard>from_locations is empty
"
);
return
;
}
const
controller
=
from_locations
[
0
].
controller
;
// 获取到场上对应zone的卡
const
cards
=
cardStore
.
at
(
zone
,
controller
);
// 获取场上卡当前所有sequence,并按大小排列
const
sequences
=
cards
.
map
((
card
)
=>
card
.
location
.
sequence
)
.
sort
((
a
,
b
)
=>
a
-
b
);
if
(
sequences
.
length
!=
from_locations
.
length
)
{
console
.
error
(
"
<ShuffleSetCard>length of sequences and from_locations not matched
"
);
return
;
}
const
count
=
from_locations
.
length
;
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
const
from
=
from_locations
[
i
];
const
to_seq
=
sequences
[
i
];
for
(
const
from
of
from_locations
)
{
const
target
=
cardStore
.
at
(
from
.
zone
,
from
.
controller
,
from
.
sequence
);
if
(
target
)
{
//
更新位置
target
.
location
.
sequence
=
to_seq
;
// 渲染动画
await
eventbus
.
call
(
Task
.
Move
,
target
.
uuid
)
;
//
设置code为0,洗切后的code会由`UpdateData`指定
target
.
code
=
0
;
target
.
meta
.
id
=
0
;
target
.
meta
.
text
.
id
=
0
;
}
else
{
console
.
warn
(
`<ShuffleSetCard>target from
${
from
}
is null`
);
}
// 同时更新超量素材的sequence(非overlay_sequence)
for
(
const
overlay
of
cardStore
.
findOverlay
(
from
.
zone
,
from
.
controller
,
from
.
sequence
))
{
overlay
.
location
.
sequence
=
to_seq
;
await
eventbus
.
call
(
Task
.
Move
,
overlay
.
uuid
);
}
}
// TODO: 处理超量
};
src/service/duel/updateData.ts
View file @
b68b030e
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
MsgUpdateData
=
ygopro
.
StocGameMessage
.
MsgUpdateData
;
import
{
eventbus
,
Task
}
from
"
@/infra
"
;
...
...
@@ -15,12 +15,14 @@ export default async (updateData: MsgUpdateData) => {
.
filter
((
card
)
=>
card
.
location
.
sequence
==
sequence
)
.
at
(
0
);
if
(
target
)
{
const
meta
=
target
.
meta
;
// 目前只更新以下字段
if
(
action
?.
code
>=
0
)
{
meta
.
id
=
action
.
code
;
meta
.
text
.
id
=
action
.
code
;
const
newMeta
=
await
fetchCard
(
action
.
code
);
target
.
code
=
action
.
code
;
target
.
meta
=
newMeta
;
}
const
meta
=
target
.
meta
;
if
(
action
.
location
!==
undefined
)
{
if
(
target
.
location
.
position
!=
action
.
location
.
position
)
{
// Currently only update position
...
...
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