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
7ecd0dca
Commit
7ecd0dca
authored
Dec 06, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update handsCase
parent
de2c697f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
src/reducers/duel/handsSlice.ts
src/reducers/duel/handsSlice.ts
+27
-6
No files found.
src/reducers/duel/handsSlice.ts
View file @
7ecd0dca
...
@@ -38,12 +38,17 @@ export const fetchHandsMeta = createAsyncThunk(
...
@@ -38,12 +38,17 @@ export const fetchHandsMeta = createAsyncThunk(
);
);
export
const
handsCase
=
(
builder
:
ActionReducerMapBuilder
<
DuelState
>
)
=>
{
export
const
handsCase
=
(
builder
:
ActionReducerMapBuilder
<
DuelState
>
)
=>
{
builder
.
addCase
(
fetchHandsMeta
.
fulfilled
,
(
state
,
action
)
=>
{
builder
.
addCase
(
fetchHandsMeta
.
pending
,
(
state
,
action
)
=>
{
const
player
=
action
.
payload
[
0
];
// Meta结果没返回之前先更新手牌`ID`
const
hands
=
action
.
payload
[
1
];
const
player
=
action
.
meta
.
arg
[
0
];
const
ids
=
action
.
meta
.
arg
[
1
];
const
cards
=
hands
.
map
((
meta
)
=>
{
return
{
meta
,
transform
:
{},
interactivities
:
[]
};
const
cards
=
ids
.
map
((
id
)
=>
{
return
{
meta
:
{
id
,
data
:
{},
text
:
{}
},
transform
:
{},
interactivities
:
[],
};
});
});
if
(
judgeSelf
(
player
,
state
))
{
if
(
judgeSelf
(
player
,
state
))
{
if
(
state
.
meHands
)
{
if
(
state
.
meHands
)
{
...
@@ -60,6 +65,22 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => {
...
@@ -60,6 +65,22 @@ export const handsCase = (builder: ActionReducerMapBuilder<DuelState>) => {
}
}
}
}
});
});
builder
.
addCase
(
fetchHandsMeta
.
fulfilled
,
(
state
,
action
)
=>
{
// `Meta`结果回来后更新手牌的`Meta`结果
const
player
=
action
.
payload
[
0
];
const
metas
=
action
.
payload
[
1
];
const
hands
=
judgeSelf
(
player
,
state
)
?
state
.
meHands
:
state
.
opHands
;
if
(
hands
)
{
for
(
let
hand
of
hands
.
cards
)
{
for
(
let
meta
of
metas
)
{
if
(
hand
.
meta
.
id
===
meta
.
id
)
{
hand
.
meta
=
meta
;
}
}
}
}
});
};
};
// 更新手牌的位置和旋转信息
// 更新手牌的位置和旋转信息
...
...
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