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
6191b422
Commit
6191b422
authored
Jan 02, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add fetchCheckCardMeta and checkCardModalCase
parent
97944531
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
2 deletions
+68
-2
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+2
-0
src/reducers/duel/modalSlice.ts
src/reducers/duel/modalSlice.ts
+66
-2
No files found.
src/reducers/duel/mod.ts
View file @
6191b422
...
@@ -25,6 +25,7 @@ import {
...
@@ -25,6 +25,7 @@ import {
setCardModalInteractiviesImpl
,
setCardModalInteractiviesImpl
,
setCardListModalIsOpenImpl
,
setCardListModalIsOpenImpl
,
setCardListModalInfoImpl
,
setCardListModalInfoImpl
,
checkCardModalCase
,
}
from
"
./modalSlice
"
;
}
from
"
./modalSlice
"
;
import
{
import
{
MonsterState
,
MonsterState
,
...
@@ -124,6 +125,7 @@ const duelSlice = createSlice({
...
@@ -124,6 +125,7 @@ const duelSlice = createSlice({
monsterCase
(
builder
);
monsterCase
(
builder
);
magicCase
(
builder
);
magicCase
(
builder
);
cemeteryCase
(
builder
);
cemeteryCase
(
builder
);
checkCardModalCase
(
builder
);
},
},
});
});
...
...
src/reducers/duel/modalSlice.ts
View file @
6191b422
import
{
PayloadAction
,
CaseReducer
}
from
"
@reduxjs/toolkit
"
;
import
{
PayloadAction
,
CaseReducer
,
createAsyncThunk
,
ActionReducerMapBuilder
,
}
from
"
@reduxjs/toolkit
"
;
import
{
fetchCard
}
from
"
../../api/cards
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
DuelState
}
from
"
./mod
"
;
...
@@ -28,9 +34,9 @@ export interface ModalState {
...
@@ -28,9 +34,9 @@ export interface ModalState {
tags
:
{
tags
:
{
tagName
:
string
;
tagName
:
string
;
options
:
{
options
:
{
code
:
number
;
name
?:
string
;
name
?:
string
;
desc
?:
string
;
desc
?:
string
;
imgUrl
?:
string
;
response
:
number
;
response
:
number
;
}[];
}[];
}[];
}[];
...
@@ -108,6 +114,64 @@ export const setCheckCardModalMinMaxImpl: CaseReducer<
...
@@ -108,6 +114,64 @@ export const setCheckCardModalMinMaxImpl: CaseReducer<
state
.
modalState
.
checkCardModal
.
selectMax
=
action
.
payload
.
max
;
state
.
modalState
.
checkCardModal
.
selectMax
=
action
.
payload
.
max
;
};
};
// 增加卡牌选择选项
export
const
fetchCheckCardMeta
=
createAsyncThunk
(
"
duel/fetchCheckCardMeta
"
,
async
(
param
:
{
tagName
:
string
;
option
:
{
code
:
number
;
response
:
number
};
})
=>
{
const
meta
=
await
fetchCard
(
param
.
option
.
code
);
const
response
=
{
tagName
:
param
.
tagName
,
meta
:
{
code
:
meta
.
id
,
name
:
meta
.
text
.
name
,
desc
:
meta
.
text
.
desc
,
},
};
return
response
;
}
);
export
const
checkCardModalCase
=
(
builder
:
ActionReducerMapBuilder
<
DuelState
>
)
=>
{
builder
.
addCase
(
fetchCheckCardMeta
.
pending
,
(
state
,
action
)
=>
{
const
tagName
=
action
.
meta
.
arg
.
tagName
;
const
code
=
action
.
meta
.
arg
.
option
.
code
;
const
response
=
action
.
meta
.
arg
.
option
.
response
;
for
(
const
tag
of
state
.
modalState
.
checkCardModal
.
tags
)
{
if
(
tag
.
tagName
===
tagName
)
{
tag
.
options
.
push
({
code
,
response
});
return
;
}
}
state
.
modalState
.
checkCardModal
.
tags
.
push
({
tagName
,
options
:
[{
code
,
response
}],
});
});
builder
.
addCase
(
fetchCheckCardMeta
.
fulfilled
,
(
state
,
action
)
=>
{
const
tagName
=
action
.
payload
.
tagName
;
const
meta
=
action
.
payload
.
meta
;
for
(
const
tag
of
state
.
modalState
.
checkCardModal
.
tags
)
{
if
(
tag
.
tagName
===
tagName
)
{
for
(
const
option
of
tag
.
options
)
{
if
(
option
.
code
==
meta
.
code
)
{
option
.
name
=
meta
.
name
;
option
.
desc
=
meta
.
desc
;
}
}
}
}
});
};
export
const
selectCardModalIsOpen
=
(
state
:
RootState
)
=>
export
const
selectCardModalIsOpen
=
(
state
:
RootState
)
=>
state
.
duel
.
modalState
.
cardModal
.
isOpen
;
state
.
duel
.
modalState
.
cardModal
.
isOpen
;
export
const
selectCardModalName
=
(
state
:
RootState
)
=>
export
const
selectCardModalName
=
(
state
:
RootState
)
=>
...
...
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