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
baichixing
Neos
Commits
99af0d62
Commit
99af0d62
authored
Jun 20, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix shuffle_set_card
parent
fcf02257
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
10 deletions
+33
-10
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
+1
-1
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/shuffleSetCard.ts
...api/ocgcore/ocgAdapter/stoc/stocGameMsg/shuffleSetCard.ts
+2
-3
src/service/duel/shuffleSetCard.ts
src/service/duel/shuffleSetCard.ts
+30
-6
No files found.
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
View file @
99af0d62
...
@@ -33,7 +33,7 @@ import MsgSelectPositionAdapter from "./selectPosition";
...
@@ -33,7 +33,7 @@ import MsgSelectPositionAdapter from "./selectPosition";
import
MsgSelectSum
from
"
./selectSum
"
;
import
MsgSelectSum
from
"
./selectSum
"
;
import
MsgSelectTributeAdapter
from
"
./selectTribute
"
;
import
MsgSelectTributeAdapter
from
"
./selectTribute
"
;
import
MsgSelectUnselectCardAdapter
from
"
./selectUnselectCard
"
;
import
MsgSelectUnselectCardAdapter
from
"
./selectUnselectCard
"
;
import
MsgShuffleSetCard
from
"
./shuffle
_set_c
ard
"
;
import
MsgShuffleSetCard
from
"
./shuffle
SetC
ard
"
;
import
MsgSortCard
from
"
./sortCard
"
;
import
MsgSortCard
from
"
./sortCard
"
;
import
MsgStartAdapter
from
"
./start
"
;
import
MsgStartAdapter
from
"
./start
"
;
import
MsgTossAdapter
from
"
./toss
"
;
import
MsgTossAdapter
from
"
./toss
"
;
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/shuffle
_set_c
ard.ts
→
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/shuffle
SetC
ard.ts
View file @
99af0d62
...
@@ -16,17 +16,16 @@ export default (data: Uint8Array) => {
...
@@ -16,17 +16,16 @@ export default (data: Uint8Array) => {
const
zone
=
numberToCardZone
(
reader
.
inner
.
readUint8
());
const
zone
=
numberToCardZone
(
reader
.
inner
.
readUint8
());
const
count
=
reader
.
inner
.
readUint8
();
const
count
=
reader
.
inner
.
readUint8
();
const
from_locations
=
[];
const
from_locations
=
[];
const
to_locations
=
[];
const
_overlay_locations
=
[];
// TODO: 这个字段是否有用?
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
from_locations
.
push
(
reader
.
readCardLocation
());
from_locations
.
push
(
reader
.
readCardLocation
());
}
}
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
to
_locations
.
push
(
reader
.
readCardLocation
());
_overlay
_locations
.
push
(
reader
.
readCardLocation
());
}
}
return
new
MsgShuffleSetCard
({
return
new
MsgShuffleSetCard
({
zone
,
zone
,
from_locations
,
from_locations
,
to_locations
,
});
});
};
};
src/service/duel/shuffleSetCard.ts
View file @
99af0d62
...
@@ -3,29 +3,53 @@ import { eventbus, Task } from "@/infra";
...
@@ -3,29 +3,53 @@ import { eventbus, Task } from "@/infra";
import
{
cardStore
}
from
"
@/stores
"
;
import
{
cardStore
}
from
"
@/stores
"
;
import
MsgShuffleSetCard
=
ygopro
.
StocGameMessage
.
MsgShuffleSetCard
;
import
MsgShuffleSetCard
=
ygopro
.
StocGameMessage
.
MsgShuffleSetCard
;
// 后端传过来的`from_locations`的列表是切洗前场上卡的location,它们在列表里面按照切洗后的顺序排列
export
default
async
(
shuffleSetCard
:
MsgShuffleSetCard
)
=>
{
export
default
async
(
shuffleSetCard
:
MsgShuffleSetCard
)
=>
{
const
zone
=
shuffleSetCard
.
zone
;
const
from_locations
=
shuffleSetCard
.
from_locations
;
const
from_locations
=
shuffleSetCard
.
from_locations
;
const
to_locations
=
shuffleSetCard
.
to_locations
;
if
(
from_locations
.
length
==
0
)
{
if
(
from_locations
.
length
!=
to_locations
.
length
)
{
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
(
console
.
error
(
"
<ShuffleSetCard>length of
from_locations and to
_locations not matched
"
"
<ShuffleSetCard>length of
sequences and from
_locations not matched
"
);
);
return
;
return
;
}
}
const
count
=
from_locations
.
length
;
const
count
=
from_locations
.
length
;
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
const
from
=
from_locations
[
i
];
const
from
=
from_locations
[
i
];
const
to
=
to_location
s
[
i
];
const
to
_seq
=
sequence
s
[
i
];
// TODO: 需要考虑超量么
const
target
=
cardStore
.
at
(
from
.
zone
,
from
.
controller
,
from
.
sequence
);
const
target
=
cardStore
.
at
(
from
.
zone
,
from
.
controller
,
from
.
sequence
);
if
(
target
)
{
if
(
target
)
{
// 更新位置
// 更新位置
target
.
location
=
to
;
target
.
location
.
sequence
=
to_seq
;
// 渲染动画
// 渲染动画
await
eventbus
.
call
(
Task
.
Move
,
target
.
uuid
);
await
eventbus
.
call
(
Task
.
Move
,
target
.
uuid
);
}
else
{
}
else
{
console
.
warn
(
`<ShuffleSetCard>target from
${
from
}
is null`
);
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
);
}
}
}
};
};
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