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
c39108a1
Commit
c39108a1
authored
Apr 02, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix small
parent
05aaa932
Pipeline
#21074
passed with stages
in 24 minutes
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
src/api/strings.ts
src/api/strings.ts
+1
-1
src/reducers/duel/hintSlice.ts
src/reducers/duel/hintSlice.ts
+22
-6
No files found.
src/api/strings.ts
View file @
c39108a1
...
...
@@ -2,7 +2,7 @@ import axios from "axios";
import
NeosConfig
from
"
../../neos.config.json
"
;
import
{
getCardStr
,
fetchCard
}
from
"
./cards
"
;
const
DESCRIPTION_LIMIT
=
10000
;
export
const
DESCRIPTION_LIMIT
=
10000
;
export
async
function
initStrings
()
{
const
strings
=
(
await
axios
.
get
<
string
>
(
NeosConfig
.
stringsUrl
)).
data
;
...
...
src/reducers/duel/hintSlice.ts
View file @
c39108a1
import
{
createAsyncThunk
,
ActionReducerMapBuilder
}
from
"
@reduxjs/toolkit
"
;
import
{
DuelState
}
from
"
./mod
"
;
import
{
RootState
}
from
"
../../store
"
;
import
{
fetchStrings
,
getStrings
}
from
"
../../api/strings
"
;
import
{
DESCRIPTION_LIMIT
,
fetchStrings
,
getStrings
}
from
"
../../api/strings
"
;
import
{
judgeSelf
}
from
"
./util
"
;
import
{
fetchCard
}
from
"
../../api/cards
"
;
export
interface
HintState
{
code
:
number
;
...
...
@@ -24,14 +25,24 @@ export const fetchCommonHintMeta = createAsyncThunk(
);
export
const
fetchSelectHintMeta
=
createAsyncThunk
(
"
duel/fetchSelect
Place
HintMeta
"
,
"
duel/fetchSelectHintMeta
"
,
async
(
param
:
[
number
,
number
])
=>
{
const
player
=
param
[
0
];
const
hintData
=
param
[
1
];
const
hintMeta
=
await
getStrings
(
hintData
);
const
response
:
[
number
,
string
]
=
[
player
,
hintMeta
];
let
hintMeta
=
""
;
if
(
hintData
>
DESCRIPTION_LIMIT
)
{
// 针对`MSG_SELECT_PLACE`的特化逻辑
const
cardMeta
=
await
fetchCard
(
hintData
,
true
);
hintMeta
=
fetchStrings
(
"
!system
"
,
569
).
replace
(
"
[%ls]
"
,
cardMeta
.
text
.
name
||
"
[?]
"
);
}
else
{
hintMeta
=
await
getStrings
(
hintData
);
}
const
response
:
[
number
,
string
]
=
[
player
,
hintMeta
];
return
response
;
}
);
...
...
@@ -69,12 +80,17 @@ export const hintCase = (builder: ActionReducerMapBuilder<DuelState>) => {
});
builder
.
addCase
(
fetchSelectHintMeta
.
fulfilled
,
(
state
,
action
)
=>
{
const
player
=
action
.
payload
[
0
];
cons
t
hintMsg
=
action
.
payload
[
1
];
le
t
hintMsg
=
action
.
payload
[
1
];
const
hint
=
judgeSelf
(
player
,
state
)
?
state
.
meHint
:
state
.
opHint
;
if
(
hint
)
{
if
(
hint
.
code
>
DESCRIPTION_LIMIT
)
{
// 针对`MSG_SELECT_PLACE`的特化逻辑
hint
.
msg
=
hintMsg
;
}
else
{
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