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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
Neos
Commits
f83338e9
Commit
f83338e9
authored
Apr 01, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish
parent
e3b0dc68
Pipeline
#21057
passed with stages
in 18 minutes and 31 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
2 deletions
+34
-2
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/mod.ts
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/mod.ts
+6
-0
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/sortCard.ts
...i/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/sortCard.ts
+13
-0
src/api/ocgcore/ocgHelper.ts
src/api/ocgcore/ocgHelper.ts
+13
-0
src/ui/Duel/sortCardModal.tsx
src/ui/Duel/sortCardModal.tsx
+2
-2
No files found.
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/mod.ts
View file @
f83338e9
...
@@ -11,6 +11,7 @@ import adaptSelectOptionResponse from "./selectOption";
...
@@ -11,6 +11,7 @@ import adaptSelectOptionResponse from "./selectOption";
import
adaptSelectBattleCmdResponse
from
"
./selectBattleCmd
"
;
import
adaptSelectBattleCmdResponse
from
"
./selectBattleCmd
"
;
import
adaptSelectUnselectCardResponse
from
"
./selectUnselectCard
"
;
import
adaptSelectUnselectCardResponse
from
"
./selectUnselectCard
"
;
import
adaptSelectCounterResponse
from
"
./selectCounter
"
;
import
adaptSelectCounterResponse
from
"
./selectCounter
"
;
import
adaptSortCardResponse
from
"
./sortCard
"
;
/*
/*
* CTOS CTOS_RESPONSE
* CTOS CTOS_RESPONSE
...
@@ -80,6 +81,11 @@ export default class CtosResponsePacket extends YgoProPacket {
...
@@ -80,6 +81,11 @@ export default class CtosResponsePacket extends YgoProPacket {
break
;
break
;
}
}
case
"
sort_card
"
:
{
extraData
=
adaptSortCardResponse
(
response
.
sort_card
);
break
;
}
default
:
{
default
:
{
break
;
break
;
}
}
...
...
src/api/ocgcore/ocgAdapter/ctos/ctosGameMsgResponse/sortCard.ts
0 → 100644
View file @
f83338e9
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
// @ts-ignore
import
{
BufferWriter
}
from
"
rust-src
"
;
export
default
(
response
:
ygopro
.
CtosGameMsgResponse
.
SortCardResponse
)
=>
{
const
writer
=
new
BufferWriter
();
for
(
const
index
of
response
.
sorted_index
)
{
writer
.
writeUint8
(
index
);
}
return
writer
.
toArray
();
};
src/api/ocgcore/ocgHelper.ts
View file @
f83338e9
...
@@ -282,3 +282,16 @@ export function sendSelectCounterResponse(counts: number[]) {
...
@@ -282,3 +282,16 @@ export function sendSelectCounterResponse(counts: number[]) {
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
});
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
});
}
}
export
function
sendSortCardResponse
(
sortedIndexes
:
number
[])
{
const
response
=
new
ygopro
.
YgoCtosMsg
({
ctos_response
:
new
ygopro
.
CtosGameMsgResponse
({
sort_card
:
new
ygopro
.
CtosGameMsgResponse
.
SortCardResponse
({
sorted_index
:
sortedIndexes
,
}),
}),
});
const
payload
=
new
GameMsgResponse
(
response
).
serialize
();
socketMiddleWare
({
cmd
:
socketCmd
.
SEND
,
payload
});
}
src/ui/Duel/sortCardModal.tsx
View file @
f83338e9
...
@@ -18,7 +18,7 @@ import {
...
@@ -18,7 +18,7 @@ import {
import
{
CSS
}
from
"
@dnd-kit/utilities
"
;
import
{
CSS
}
from
"
@dnd-kit/utilities
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
selectSortCardModal
}
from
"
../../reducers/duel/modal/sortCardModalSlice
"
;
import
{
selectSortCardModal
}
from
"
../../reducers/duel/modal/sortCardModalSlice
"
;
import
{
sendS
elec
tCardResponse
}
from
"
../../api/ocgcore/ocgHelper
"
;
import
{
sendS
or
tCardResponse
}
from
"
../../api/ocgcore/ocgHelper
"
;
import
{
store
}
from
"
../../store
"
;
import
{
store
}
from
"
../../store
"
;
import
{
resetSortCardModal
}
from
"
../../reducers/duel/mod
"
;
import
{
resetSortCardModal
}
from
"
../../reducers/duel/mod
"
;
import
DragModal
from
"
./dragModal
"
;
import
DragModal
from
"
./dragModal
"
;
...
@@ -41,7 +41,7 @@ const SortCardModal = () => {
...
@@ -41,7 +41,7 @@ const SortCardModal = () => {
const
draggleRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
draggleRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
onFinish
=
()
=>
{
const
onFinish
=
()
=>
{
sendS
elec
tCardResponse
(
items
.
map
((
item
)
=>
item
.
response
));
sendS
or
tCardResponse
(
items
.
map
((
item
)
=>
item
.
response
));
dispatch
(
resetSortCardModal
());
dispatch
(
resetSortCardModal
());
};
};
const
onDragEnd
=
(
event
:
DragEndEvent
)
=>
{
const
onDragEnd
=
(
event
:
DragEndEvent
)
=>
{
...
...
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