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