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
a6668f06
Commit
a6668f06
authored
Apr 05, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update hint
parent
359b0289
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
23 deletions
+70
-23
src/reducers/duel/hintSlice.ts
src/reducers/duel/hintSlice.ts
+53
-20
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+7
-1
src/service/duel/hint.ts
src/service/duel/hint.ts
+1
-1
src/service/duel/selectChain.ts
src/service/duel/selectChain.ts
+6
-1
src/service/duel/start.ts
src/service/duel/start.ts
+3
-0
No files found.
src/reducers/duel/hintSlice.ts
View file @
a6668f06
...
@@ -4,13 +4,38 @@ import { RootState } from "../../store";
...
@@ -4,13 +4,38 @@ import { RootState } from "../../store";
import
{
DESCRIPTION_LIMIT
,
fetchStrings
,
getStrings
}
from
"
../../api/strings
"
;
import
{
DESCRIPTION_LIMIT
,
fetchStrings
,
getStrings
}
from
"
../../api/strings
"
;
import
{
judgeSelf
}
from
"
./util
"
;
import
{
judgeSelf
}
from
"
./util
"
;
import
{
fetchCard
}
from
"
../../api/cards
"
;
import
{
fetchCard
}
from
"
../../api/cards
"
;
import
{
DuelReducer
}
from
"
./generic
"
;
export
interface
HintState
{
export
interface
HintState
{
code
:
number
;
code
:
number
;
msg
?:
string
;
msg
?:
string
;
esHint
?:
string
;
esSelectHint
?:
string
;
esSelectHint
?:
string
;
}
}
export
const
initHintImpl
:
DuelReducer
<
number
>
=
(
state
,
action
)
=>
{
const
player
=
action
.
payload
;
if
(
judgeSelf
(
player
,
state
))
{
state
.
meHint
=
{
code
:
0
};
}
else
{
state
.
opHint
=
{
code
:
0
};
}
};
export
const
setEsHintImpl
:
DuelReducer
<
{
player
:
number
;
esHint
:
string
}
>
=
(
state
,
action
)
=>
{
const
player
=
action
.
payload
.
player
;
const
esHint
=
action
.
payload
.
esHint
;
const
hint
=
judgeSelf
(
player
,
state
)
?
state
.
meHint
:
state
.
opHint
;
if
(
hint
)
{
hint
.
esHint
=
esHint
;
}
};
export
const
fetchCommonHintMeta
=
createAsyncThunk
(
export
const
fetchCommonHintMeta
=
createAsyncThunk
(
"
duel/fetchCommonHintMeta
"
,
"
duel/fetchCommonHintMeta
"
,
async
(
param
:
[
number
,
number
])
=>
{
async
(
param
:
[
number
,
number
])
=>
{
...
@@ -26,24 +51,31 @@ export const fetchCommonHintMeta = createAsyncThunk(
...
@@ -26,24 +51,31 @@ export const fetchCommonHintMeta = createAsyncThunk(
export
const
fetchSelectHintMeta
=
createAsyncThunk
(
export
const
fetchSelectHintMeta
=
createAsyncThunk
(
"
duel/fetchSelectHintMeta
"
,
"
duel/fetchSelectHintMeta
"
,
async
(
param
:
[
number
,
number
])
=>
{
async
(
param
:
{
const
player
=
param
[
0
];
player
:
number
;
const
hintData
=
param
[
1
];
selectHintData
:
number
;
esHint
?:
string
;
})
=>
{
const
player
=
param
.
player
;
const
selectHintData
=
param
.
selectHintData
;
let
h
intMeta
=
""
;
let
selectH
intMeta
=
""
;
if
(
h
intData
>
DESCRIPTION_LIMIT
)
{
if
(
selectH
intData
>
DESCRIPTION_LIMIT
)
{
// 针对`MSG_SELECT_PLACE`的特化逻辑
// 针对`MSG_SELECT_PLACE`的特化逻辑
const
cardMeta
=
await
fetchCard
(
h
intData
,
true
);
const
cardMeta
=
await
fetchCard
(
selectH
intData
,
true
);
h
intMeta
=
fetchStrings
(
"
!system
"
,
569
).
replace
(
selectH
intMeta
=
fetchStrings
(
"
!system
"
,
569
).
replace
(
"
[%ls]
"
,
"
[%ls]
"
,
cardMeta
.
text
.
name
||
"
[?]
"
cardMeta
.
text
.
name
||
"
[?]
"
);
);
}
else
{
}
else
{
hintMeta
=
await
getStrings
(
h
intData
);
selectHintMeta
=
await
getStrings
(
selectH
intData
);
}
}
const
response
:
[
number
,
string
]
=
[
player
,
hintMeta
];
return
{
return
response
;
player
,
selectHintMeta
,
esHint
:
param
.
esHint
,
};
}
}
);
);
...
@@ -69,26 +101,27 @@ export const hintCase = (builder: ActionReducerMapBuilder<DuelState>) => {
...
@@ -69,26 +101,27 @@ export const hintCase = (builder: ActionReducerMapBuilder<DuelState>) => {
});
});
builder
.
addCase
(
fetchSelectHintMeta
.
pending
,
(
state
,
action
)
=>
{
builder
.
addCase
(
fetchSelectHintMeta
.
pending
,
(
state
,
action
)
=>
{
const
player
=
action
.
meta
.
arg
[
0
]
;
const
player
=
action
.
meta
.
arg
.
player
;
const
code
=
action
.
meta
.
arg
[
1
]
;
const
code
=
action
.
meta
.
arg
.
selectHintData
;
if
(
judgeSelf
(
player
,
state
))
{
const
hint
=
judgeSelf
(
player
,
state
)
?
state
.
meHint
:
state
.
opHint
;
state
.
meHint
=
{
code
};
if
(
hint
)
{
}
else
{
hint
.
code
=
code
;
state
.
opHint
=
{
code
};
}
}
});
});
builder
.
addCase
(
fetchSelectHintMeta
.
fulfilled
,
(
state
,
action
)
=>
{
builder
.
addCase
(
fetchSelectHintMeta
.
fulfilled
,
(
state
,
action
)
=>
{
const
player
=
action
.
payload
[
0
];
const
player
=
action
.
payload
.
player
;
let
hintMsg
=
action
.
payload
[
1
];
const
selectHintMsg
=
action
.
payload
.
selectHintMeta
;
const
esHint
=
action
.
payload
.
esHint
;
const
hint
=
judgeSelf
(
player
,
state
)
?
state
.
meHint
:
state
.
opHint
;
const
hint
=
judgeSelf
(
player
,
state
)
?
state
.
meHint
:
state
.
opHint
;
if
(
hint
)
{
if
(
hint
)
{
if
(
hint
.
code
>
DESCRIPTION_LIMIT
)
{
if
(
hint
.
code
>
DESCRIPTION_LIMIT
)
{
// 针对`MSG_SELECT_PLACE`的特化逻辑
// 针对`MSG_SELECT_PLACE`的特化逻辑
hint
.
msg
=
h
intMsg
;
hint
.
msg
=
selectH
intMsg
;
}
else
{
}
else
{
hint
.
esSelectHint
=
hintMsg
;
hint
.
esSelectHint
=
selectHintMsg
;
if
(
esHint
)
hint
.
esHint
=
esHint
;
}
}
}
}
});
});
...
...
src/reducers/duel/mod.ts
View file @
a6668f06
...
@@ -23,7 +23,7 @@ import {
...
@@ -23,7 +23,7 @@ import {
setEnableEpImpl
,
setEnableEpImpl
,
}
from
"
./phaseSlice
"
;
}
from
"
./phaseSlice
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
HintState
,
hintCase
}
from
"
./hintSlice
"
;
import
{
HintState
,
hintCase
,
initHintImpl
,
setEsHintImpl
}
from
"
./hintSlice
"
;
import
{
import
{
ModalState
,
ModalState
,
setCardModalIsOpenImpl
,
setCardModalIsOpenImpl
,
...
@@ -296,6 +296,10 @@ const duelSlice = createSlice({
...
@@ -296,6 +296,10 @@ const duelSlice = createSlice({
setSortCardModalIsOpen
:
setSortCardModalIsOpenImpl
,
setSortCardModalIsOpen
:
setSortCardModalIsOpenImpl
,
resetSortCardModal
:
resetSortCardModalImpl
,
resetSortCardModal
:
resetSortCardModalImpl
,
// 提示相关`Reducer`
initHint
:
initHintImpl
,
setEsHint
:
setEsHintImpl
,
// 通用的`Reducer`
// 通用的`Reducer`
clearAllIdleInteractivities
:
clearAllIdleInteractivitiesImpl
,
clearAllIdleInteractivities
:
clearAllIdleInteractivitiesImpl
,
clearAllPlaceInteractivities
:
clearAllPlaceInteractivitiesImpl
,
clearAllPlaceInteractivities
:
clearAllPlaceInteractivitiesImpl
,
...
@@ -413,6 +417,8 @@ export const {
...
@@ -413,6 +417,8 @@ export const {
clearCheckCounter
,
clearCheckCounter
,
setSortCardModalIsOpen
,
setSortCardModalIsOpen
,
resetSortCardModal
,
resetSortCardModal
,
initHint
,
setEsHint
,
}
=
duelSlice
.
actions
;
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
return
state
.
duel
.
meInitInfo
!=
null
;
...
...
src/service/duel/hint.ts
View file @
a6668f06
...
@@ -15,7 +15,7 @@ export default (hint: MsgHint, dispatch: AppDispatch) => {
...
@@ -15,7 +15,7 @@ export default (hint: MsgHint, dispatch: AppDispatch) => {
break
;
break
;
}
}
case
MsgHint
.
HintType
.
HINT_SELECTMSG
:
{
case
MsgHint
.
HintType
.
HINT_SELECTMSG
:
{
dispatch
(
fetchSelectHintMeta
(
[
player
,
hint
.
hint_data
]
));
dispatch
(
fetchSelectHintMeta
(
{
player
,
selectHintData
:
hint
.
hint_data
}
));
break
;
break
;
}
}
default
:
{
default
:
{
...
...
src/service/duel/selectChain.ts
View file @
a6668f06
...
@@ -84,7 +84,12 @@ export default (selectChain: MsgSelectChain, dispatch: AppDispatch) => {
...
@@ -84,7 +84,12 @@ export default (selectChain: MsgSelectChain, dispatch: AppDispatch) => {
})
})
);
);
}
}
dispatch
(
fetchSelectHintMeta
([
player
,
203
]));
dispatch
(
fetchSelectHintMeta
({
player
,
selectHintData
:
203
,
})
);
dispatch
(
setCheckCardModalIsOpen
(
true
));
dispatch
(
setCheckCardModalIsOpen
(
true
));
...
...
src/service/duel/start.ts
View file @
a6668f06
...
@@ -8,6 +8,7 @@ import {
...
@@ -8,6 +8,7 @@ import {
initCemetery
,
initCemetery
,
initDeck
,
initDeck
,
initExclusion
,
initExclusion
,
initHint
,
}
from
"
../../reducers/duel/mod
"
;
}
from
"
../../reducers/duel/mod
"
;
export
default
(
export
default
(
...
@@ -45,4 +46,6 @@ export default (
...
@@ -45,4 +46,6 @@ export default (
dispatch
(
initDeck
({
player
:
1
,
deskSize
:
start
.
deckSize2
}));
dispatch
(
initDeck
({
player
:
1
,
deskSize
:
start
.
deckSize2
}));
dispatch
(
initExclusion
(
0
));
dispatch
(
initExclusion
(
0
));
dispatch
(
initExclusion
(
1
));
dispatch
(
initExclusion
(
1
));
dispatch
(
initHint
(
0
));
dispatch
(
initHint
(
1
));
};
};
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