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
4f8fd00d
Commit
4f8fd00d
authored
Apr 28, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix move.ts
parent
7b1fabba
Pipeline
#21410
passed with stages
in 15 minutes and 30 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
11 deletions
+33
-11
src/service/duel/move.ts
src/service/duel/move.ts
+4
-1
src/stores/matStore/store.ts
src/stores/matStore/store.ts
+11
-5
src/stores/matStore/types.ts
src/stores/matStore/types.ts
+7
-3
src/ui/WaitRoom.tsx
src/ui/WaitRoom.tsx
+11
-2
No files found.
src/service/duel/move.ts
View file @
4f8fd00d
...
...
@@ -72,7 +72,10 @@ export default (move: MsgMove) => {
case
ygopro
.
CardZone
.
GRAVE
:
case
ygopro
.
CardZone
.
EXTRA
:
case
ygopro
.
CardZone
.
HAND
:
{
matStore
.
in
(
to
.
location
).
of
(
to
.
controler
).
insert
(
to
.
sequence
,
code
);
matStore
.
in
(
to
.
location
)
.
of
(
to
.
controler
)
.
insert
(
code
,
to
.
sequence
,
to
.
position
);
break
;
}
case
ygopro
.
CardZone
.
OVERLAY
:
{
...
...
src/stores/matStore/store.ts
View file @
4f8fd00d
...
...
@@ -24,11 +24,17 @@ class CardArray extends Array<CardState> implements ArrayCardState {
public
__proto__
=
CardArray
.
prototype
;
public
zone
:
ygopro
.
CardZone
=
ygopro
.
CardZone
.
MZONE
;
public
getController
:
()
=>
number
=
()
=>
1
;
private
genCard
=
async
(
controller
:
number
,
id
:
number
)
=>
({
private
genCard
=
async
(
controller
:
number
,
id
:
number
,
position
?:
ygopro
.
CardPosition
)
=>
({
occupant
:
await
fetchCard
(
id
,
true
),
location
:
{
controler
:
controller
,
location
:
this
.
zone
,
position
:
position
==
undefined
?
ygopro
.
CardPosition
.
FACEUP_ATTACK
:
position
,
},
counters
:
{},
idleInteractivities
:
[],
...
...
@@ -37,13 +43,13 @@ class CardArray extends Array<CardState> implements ArrayCardState {
remove
(
sequence
:
number
)
{
this
.
splice
(
sequence
,
1
);
}
async
insert
(
sequence
:
number
,
id
:
number
)
{
const
card
=
await
this
.
genCard
(
this
.
getController
(),
id
);
async
insert
(
sequence
:
number
,
id
:
number
,
position
?:
ygopro
.
CardPosition
)
{
const
card
=
await
this
.
genCard
(
this
.
getController
(),
id
,
position
);
this
.
splice
(
sequence
,
0
,
card
);
}
async
add
(
ids
:
number
[])
{
async
add
(
ids
:
number
[]
,
position
?:
ygopro
.
CardPosition
)
{
const
cards
=
await
Promise
.
all
(
ids
.
map
(
async
(
id
)
=>
this
.
genCard
(
this
.
getController
(),
id
))
ids
.
map
(
async
(
id
)
=>
this
.
genCard
(
this
.
getController
(),
id
,
position
))
);
this
.
splice
(
this
.
length
,
0
,
...
cards
);
}
...
...
src/stores/matStore/types.ts
View file @
4f8fd00d
...
...
@@ -15,10 +15,14 @@ export interface BothSide<T> {
export
interface
DuelFieldState
extends
Array
<
CardState
>
{
/** 移除特定位置的卡片 */
remove
:
(
sequence
:
number
)
=>
void
;
/** 在末尾添加卡片 */
insert
:
(
sequence
:
number
,
id
:
number
)
=>
Promise
<
void
>
;
/** 在指定位置插入卡片 */
add
:
(
ids
:
number
[])
=>
Promise
<
void
>
;
insert
:
(
id
:
number
,
sequence
:
number
,
position
?:
ygopro
.
CardPosition
)
=>
Promise
<
void
>
;
/** 在末尾添加卡片 */
add
:
(
ids
:
number
[],
position
?:
ygopro
.
CardPosition
)
=>
Promise
<
void
>
;
/** 设置占据这个位置的卡片信息 */
setOccupant
:
(
sequence
:
number
,
...
...
src/ui/WaitRoom.tsx
View file @
4f8fd00d
...
...
@@ -25,7 +25,13 @@ import rustInit from "rust-src";
import
{
useSnapshot
}
from
"
valtio
"
;
import
YGOProDeck
from
"
ygopro-deck-encode
"
;
import
{
initStrings
,
sendHsReady
,
sendHsStart
,
sendUpdateDeck
}
from
"
@/api
"
;
import
{
initStrings
,
sendHsReady
,
sendHsStart
,
sendUpdateDeck
,
ygopro
,
}
from
"
@/api
"
;
import
{
DeckManager
,
fetchDeck
,
type
IDeck
}
from
"
@/api/deck
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
socketMiddleWare
,
{
socketCmd
}
from
"
@/middleware/socket
"
;
...
...
@@ -137,7 +143,10 @@ const WaitRoom = () => {
const
onDeckReady
=
async
(
deck
:
IDeck
)
=>
{
sendUpdateDeck
(
deck
);
store
.
matStore
.
extraDecks
.
me
.
add
(
deck
.
extra
?.
reverse
()
||
[]);
store
.
matStore
.
extraDecks
.
me
.
add
(
deck
.
extra
?.
reverse
()
||
[],
ygopro
.
CardPosition
.
FACEDOWN_ATTACK
);
setChoseDeck
(
true
);
};
...
...
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