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
feb483cc
Commit
feb483cc
authored
Jun 20, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/shuffle_set_card' into 'main'
Fix/shuffle set card See merge request
!231
parents
d5270a03
3fac2e51
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
34 deletions
+55
-34
neos-protobuf
neos-protobuf
+1
-1
src/api/ocgcore/idl/ocgcore.ts
src/api/ocgcore/idl/ocgcore.ts
+14
-14
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
+3
-3
src/service/duel/shuffleSetCard.ts
src/service/duel/shuffleSetCard.ts
+30
-11
src/service/duel/updateData.ts
src/service/duel/updateData.ts
+6
-4
No files found.
neos-protobuf
@
2caaa3aa
Subproject commit
cd10e6a5f76cfda5ada5a39a9a7a526ca9c5e881
Subproject commit
2caaa3aa310f699ebf5b52a08413d0a555ac4065
src/api/ocgcore/idl/ocgcore.ts
View file @
feb483cc
...
...
@@ -10766,7 +10766,7 @@ export namespace ygopro {
constructor(data?: any[] | {
zone?: CardZone;
from_locations?: CardLocation[];
to
_locations?: CardLocation[];
overlay
_locations?: CardLocation[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3], this.#one_of_decls);
...
...
@@ -10777,8 +10777,8 @@ export namespace ygopro {
if ("from_locations" in data && data.from_locations != undefined) {
this.from_locations = data.from_locations;
}
if ("
to_locations" in data && data.to
_locations != undefined) {
this.
to_locations = data.to
_locations;
if ("
overlay_locations" in data && data.overlay
_locations != undefined) {
this.
overlay_locations = data.overlay
_locations;
}
}
}
...
...
@@ -10794,16 +10794,16 @@ export namespace ygopro {
set from_locations(value: CardLocation[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
get
to
_locations() {
get
overlay
_locations() {
return pb_1.Message.getRepeatedWrapperField(this, CardLocation, 3) as CardLocation[];
}
set
to
_locations(value: CardLocation[]) {
set
overlay
_locations(value: CardLocation[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
}
static fromObject(data: {
zone?: CardZone;
from_locations?: ReturnType<typeof CardLocation.prototype.toObject>[];
to
_locations?: ReturnType<typeof CardLocation.prototype.toObject>[];
overlay
_locations?: ReturnType<typeof CardLocation.prototype.toObject>[];
}): MsgShuffleSetCard {
const message = new MsgShuffleSetCard({});
if (data.zone != null) {
...
...
@@ -10812,8 +10812,8 @@ export namespace ygopro {
if (data.from_locations != null) {
message.from_locations = data.from_locations.map(item => CardLocation.fromObject(item));
}
if (data.
to
_locations != null) {
message.
to_locations = data.to
_locations.map(item => CardLocation.fromObject(item));
if (data.
overlay
_locations != null) {
message.
overlay_locations = data.overlay
_locations.map(item => CardLocation.fromObject(item));
}
return message;
}
...
...
@@ -10821,7 +10821,7 @@ export namespace ygopro {
const data: {
zone?: CardZone;
from_locations?: ReturnType<typeof CardLocation.prototype.toObject>[];
to
_locations?: ReturnType<typeof CardLocation.prototype.toObject>[];
overlay
_locations?: ReturnType<typeof CardLocation.prototype.toObject>[];
} = {};
if (this.zone != null) {
data.zone = this.zone;
...
...
@@ -10829,8 +10829,8 @@ export namespace ygopro {
if (this.from_locations != null) {
data.from_locations = this.from_locations.map((item: CardLocation) => item.toObject());
}
if (this.
to
_locations != null) {
data.
to_locations = this.to
_locations.map((item: CardLocation) => item.toObject());
if (this.
overlay
_locations != null) {
data.
overlay_locations = this.overlay
_locations.map((item: CardLocation) => item.toObject());
}
return data;
}
...
...
@@ -10842,8 +10842,8 @@ export namespace ygopro {
writer.writeEnum(1, this.zone);
if (this.from_locations.length)
writer.writeRepeatedMessage(2, this.from_locations, (item: CardLocation) => item.serialize(writer));
if (this.
to
_locations.length)
writer.writeRepeatedMessage(3, this.
to
_locations, (item: CardLocation) => item.serialize(writer));
if (this.
overlay
_locations.length)
writer.writeRepeatedMessage(3, this.
overlay
_locations, (item: CardLocation) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
...
...
@@ -10860,7 +10860,7 @@ export namespace ygopro {
reader.readMessage(message.from_locations, () => pb_1.Message.addToRepeatedWrapperField(message, 2, CardLocation.deserialize(reader), CardLocation));
break;
case 3:
reader.readMessage(message.
to
_locations, () => pb_1.Message.addToRepeatedWrapperField(message, 3, CardLocation.deserialize(reader), CardLocation));
reader.readMessage(message.
overlay
_locations, () => pb_1.Message.addToRepeatedWrapperField(message, 3, CardLocation.deserialize(reader), CardLocation));
break;
default: reader.skipField();
}
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
View file @
feb483cc
...
...
@@ -33,7 +33,7 @@ import MsgSelectPositionAdapter from "./selectPosition";
import
MsgSelectSum
from
"
./selectSum
"
;
import
MsgSelectTributeAdapter
from
"
./selectTribute
"
;
import
MsgSelectUnselectCardAdapter
from
"
./selectUnselectCard
"
;
import
MsgShuffleSetCard
from
"
./shuffle
_set_c
ard
"
;
import
MsgShuffleSetCard
from
"
./shuffle
SetC
ard
"
;
import
MsgSortCard
from
"
./sortCard
"
;
import
MsgStartAdapter
from
"
./start
"
;
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 @
feb483cc
...
...
@@ -16,17 +16,17 @@ export default (data: Uint8Array) => {
const
zone
=
numberToCardZone
(
reader
.
inner
.
readUint8
());
const
count
=
reader
.
inner
.
readUint8
();
const
from_locations
=
[];
const
to_locations
=
[];
const
overlay_locations
=
[];
// TODO: 这个字段是否有用?
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
from_locations
.
push
(
reader
.
readCardLocation
());
}
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
to
_locations
.
push
(
reader
.
readCardLocation
());
overlay
_locations
.
push
(
reader
.
readCardLocation
());
}
return
new
MsgShuffleSetCard
({
zone
,
from_locations
,
to
_locations
,
overlay
_locations
,
});
};
src/service/duel/shuffleSetCard.ts
View file @
feb483cc
...
...
@@ -3,29 +3,48 @@ import { eventbus, Task } from "@/infra";
import
{
cardStore
}
from
"
@/stores
"
;
import
MsgShuffleSetCard
=
ygopro
.
StocGameMessage
.
MsgShuffleSetCard
;
// 后端传过来的`from_locations`的列表是切洗前场上卡的location,它们在列表里面按照切洗后的顺序排列
export
default
async
(
shuffleSetCard
:
MsgShuffleSetCard
)
=>
{
const
from_locations
=
shuffleSetCard
.
from_locations
;
const
to_locations
=
shuffleSetCard
.
to_locations
;
if
(
from_locations
.
length
!=
to_locations
.
length
)
{
const
overlay_locations
=
shuffleSetCard
.
overlay_locations
;
if
(
from_locations
.
length
==
0
)
{
console
.
error
(
"
<ShuffleSetCard>from_locations is empty
"
);
return
;
}
if
(
from_locations
.
length
!=
overlay_locations
.
length
)
{
console
.
error
(
"
<ShuffleSetCard>length of from_locations and
to
_locations not matched
"
"
<ShuffleSetCard>length of from_locations and
overlay
_locations not matched
"
);
return
;
}
const
count
=
from_locations
.
length
;
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
const
from
=
from_locations
[
i
];
const
to
=
to_locations
[
i
];
// TODO: 需要考虑超量么
const
target
=
cardStore
.
at
(
from
.
zone
,
from
.
controller
,
from
.
sequence
);
if
(
target
)
{
//
更新位置
target
.
location
=
to
;
// 渲染动画
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`
);
}
// 处理超量
const
overlay_location
=
overlay_locations
[
i
];
if
(
overlay_location
.
zone
>
0
)
{
// 如果没有超量素材,后端会全传0
for
(
const
overlay
of
cardStore
.
findOverlay
(
from
.
zone
,
from
.
controller
,
from
.
sequence
))
{
// 更新sequence
overlay
.
location
.
sequence
=
overlay_location
.
sequence
;
// 渲染动画
await
eventbus
.
call
(
Task
.
Move
,
overlay
.
uuid
);
// 这里其实有个疑惑,如果超量素材也跟着洗切的话,洗切的意义好像就没有了,感觉算是个k社没想好的设计?
}
}
}
};
src/service/duel/updateData.ts
View file @
feb483cc
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