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
4
Merge Requests
4
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
79d58872
Commit
79d58872
authored
Jan 23, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init extraDeck
parent
390c9585
Pipeline
#19772
passed with stages
in 5 minutes and 47 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
16 deletions
+12
-16
src/reducers/duel/extraDeckSlice.ts
src/reducers/duel/extraDeckSlice.ts
+7
-15
src/reducers/duel/generic.ts
src/reducers/duel/generic.ts
+1
-1
src/ui/WaitRoom.tsx
src/ui/WaitRoom.tsx
+4
-0
No files found.
src/reducers/duel/extraDeckSlice.ts
View file @
79d58872
...
...
@@ -19,7 +19,7 @@ import { judgeSelf } from "./util";
export
interface
ExtraDeckState
extends
DuelFieldState
{}
// 初始化额外卡组
export
const
initExtraDeckMeta
=
createAsyncRepeatedMetaThunk
(
export
const
init
Me
ExtraDeckMeta
=
createAsyncRepeatedMetaThunk
(
"
duel/initExtraDeckMeta
"
);
...
...
@@ -29,34 +29,26 @@ export const fetchExtraDeckMeta = createAsyncMetaThunk(
);
export
const
extraDeckCase
=
(
builder
:
ActionReducerMapBuilder
<
DuelState
>
)
=>
{
builder
.
addCase
(
initExtraDeckMeta
.
pending
,
(
state
,
action
)
=>
{
const
player
=
action
.
meta
.
arg
.
controler
;
builder
.
addCase
(
init
Me
ExtraDeckMeta
.
pending
,
(
state
,
action
)
=>
{
const
_
=
action
.
meta
.
arg
.
controler
;
const
ids
=
action
.
meta
.
arg
.
codes
;
const
cards
=
ids
.
map
((
id
)
=>
{
return
{
occupant
:
{
id
,
data
:
{},
text
:
{}
},
location
:
{
controler
:
player
,
location
:
ygopro
.
CardZone
.
EXTRA
,
},
idleInteractivities
:
[],
};
});
if
(
judgeSelf
(
player
,
state
))
{
state
.
meExtraDeck
=
{
inner
:
cards
};
}
else
{
state
.
opExtraDeck
=
{
inner
:
cards
};
}
state
.
meExtraDeck
=
{
inner
:
cards
};
});
builder
.
addCase
(
initExtraDeckMeta
.
fulfilled
,
(
state
,
action
)
=>
{
const
player
=
action
.
payload
.
controler
;
builder
.
addCase
(
init
Me
ExtraDeckMeta
.
fulfilled
,
(
state
,
action
)
=>
{
const
_
=
action
.
payload
.
controler
;
const
metas
=
action
.
payload
.
metas
;
const
extraDeck
=
judgeSelf
(
player
,
state
)
?
state
.
meExtraDeck
:
state
.
opExtraDeck
;
updateCardMeta
(
extraDeck
,
metas
);
updateCardMeta
(
state
.
meExtraDeck
,
metas
);
});
builder
.
addCase
(
fetchExtraDeckMeta
.
pending
,
(
state
,
action
)
=>
{
...
...
src/reducers/duel/generic.ts
View file @
79d58872
...
...
@@ -18,7 +18,7 @@ export interface DuelFieldState {
export
interface
CardState
{
occupant
?:
CardMeta
;
// 占据此位置的卡牌元信息
location
:
{
controler
:
number
;
controler
?
:
number
;
location
?:
number
;
position
?:
ygopro
.
CardPosition
;
overlay_sequence
?:
number
;
...
...
src/ui/WaitRoom.tsx
View file @
79d58872
...
...
@@ -23,6 +23,8 @@ import {
import
socketMiddleWare
,
{
socketCmd
}
from
"
../middleware/socket
"
;
import
sqliteMiddleWare
,
{
sqliteCmd
}
from
"
../middleware/sqlite
"
;
import
{
Button
}
from
"
antd
"
;
import
{
store
}
from
"
../store
"
;
import
{
initMeExtraDeckMeta
}
from
"
../reducers/duel/extraDeckSlice
"
;
const
READY_STATE
=
"
ready
"
;
...
...
@@ -56,6 +58,7 @@ export default function WaitRoom() {
});
},
[]);
const
dispatch
=
store
.
dispatch
;
const
joined
=
useAppSelector
(
selectJoined
);
const
chat
=
useAppSelector
(
selectChat
);
const
isHost
=
useAppSelector
(
selectIsHost
);
...
...
@@ -67,6 +70,7 @@ export default function WaitRoom() {
const
deck
=
await
fetchDeck
(
"
hero.ydk
"
);
sendUpdateDeck
(
deck
);
dispatch
(
initMeExtraDeckMeta
({
controler
:
0
,
codes
:
deck
.
extra
||
[]
}));
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