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
9b77151a
Commit
9b77151a
authored
Apr 02, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
udpate fetchSelectHintMeta
parent
7350658f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
13 deletions
+8
-13
src/reducers/duel/hintSlice.ts
src/reducers/duel/hintSlice.ts
+8
-13
No files found.
src/reducers/duel/hintSlice.ts
View file @
9b77151a
import
{
createAsyncThunk
,
ActionReducerMapBuilder
}
from
"
@reduxjs/toolkit
"
;
import
{
createAsyncThunk
,
ActionReducerMapBuilder
}
from
"
@reduxjs/toolkit
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
fetchStrings
}
from
"
../../api/strings
"
;
import
{
fetchStrings
,
getStrings
}
from
"
../../api/strings
"
;
import
{
fetchCard
}
from
"
../../api/cards
"
;
import
{
judgeSelf
}
from
"
./util
"
;
import
{
judgeSelf
}
from
"
./util
"
;
export
interface
HintState
{
export
interface
HintState
{
code
:
number
;
code
:
number
;
msg
?:
string
;
msg
?:
string
;
esSelectHint
?:
string
;
}
}
export
const
fetchCommonHintMeta
=
createAsyncThunk
(
export
const
fetchCommonHintMeta
=
createAsyncThunk
(
...
@@ -23,13 +23,13 @@ export const fetchCommonHintMeta = createAsyncThunk(
...
@@ -23,13 +23,13 @@ export const fetchCommonHintMeta = createAsyncThunk(
}
}
);
);
export
const
fetchSelect
Place
HintMeta
=
createAsyncThunk
(
export
const
fetchSelectHintMeta
=
createAsyncThunk
(
"
duel/fetchSelectPlaceHintMeta
"
,
"
duel/fetchSelectPlaceHintMeta
"
,
async
(
param
:
[
number
,
number
])
=>
{
async
(
param
:
[
number
,
number
])
=>
{
const
player
=
param
[
0
];
const
player
=
param
[
0
];
const
hintData
=
param
[
1
];
const
hintData
=
param
[
1
];
const
hintMeta
=
(
await
fetchCard
(
hintData
,
true
)).
text
.
name
||
"
[?]
"
;
const
hintMeta
=
await
getStrings
(
hintData
)
;
const
response
:
[
number
,
string
]
=
[
player
,
hintMeta
];
const
response
:
[
number
,
string
]
=
[
player
,
hintMeta
];
return
response
;
return
response
;
...
@@ -57,7 +57,7 @@ export const hintCase = (builder: ActionReducerMapBuilder<DuelState>) => {
...
@@ -57,7 +57,7 @@ export const hintCase = (builder: ActionReducerMapBuilder<DuelState>) => {
}
}
});
});
builder
.
addCase
(
fetchSelect
Place
HintMeta
.
pending
,
(
state
,
action
)
=>
{
builder
.
addCase
(
fetchSelectHintMeta
.
pending
,
(
state
,
action
)
=>
{
const
player
=
action
.
meta
.
arg
[
0
];
const
player
=
action
.
meta
.
arg
[
0
];
const
code
=
action
.
meta
.
arg
[
1
];
const
code
=
action
.
meta
.
arg
[
1
];
...
@@ -67,18 +67,13 @@ export const hintCase = (builder: ActionReducerMapBuilder<DuelState>) => {
...
@@ -67,18 +67,13 @@ export const hintCase = (builder: ActionReducerMapBuilder<DuelState>) => {
state
.
opHint
=
{
code
};
state
.
opHint
=
{
code
};
}
}
});
});
builder
.
addCase
(
fetchSelect
Place
HintMeta
.
fulfilled
,
(
state
,
action
)
=>
{
builder
.
addCase
(
fetchSelectHintMeta
.
fulfilled
,
(
state
,
action
)
=>
{
const
player
=
action
.
payload
[
0
];
const
player
=
action
.
payload
[
0
];
const
hintMeta
=
action
.
payload
[
1
];
const
hintMsg
=
action
.
payload
[
1
];
// TODO: 国际化文案
const
hintMsg
=
judgeSelf
(
player
,
state
)
?
`请为我方的<
${
hintMeta
}
>选择位置`
:
`请为对方的<
${
hintMeta
}
>选择位置`
;
const
hint
=
judgeSelf
(
player
,
state
)
?
state
.
meHint
:
state
.
opHint
;
const
hint
=
judgeSelf
(
player
,
state
)
?
state
.
meHint
:
state
.
opHint
;
if
(
hint
)
{
if
(
hint
)
{
hint
.
msg
=
hintMsg
;
hint
.
esSelectHint
=
hintMsg
;
}
}
});
});
};
};
...
...
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