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
959654f5
Commit
959654f5
authored
Mar 23, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle select_yes_no
parent
7fcc5c00
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
src/api/strings.ts
src/api/strings.ts
+14
-0
src/reducers/duel/modal/yesNoModalSlice.ts
src/reducers/duel/modal/yesNoModalSlice.ts
+11
-1
src/service/duel/selectYesNo.ts
src/service/duel/selectYesNo.ts
+4
-1
No files found.
src/api/strings.ts
View file @
959654f5
import
axios
from
"
axios
"
;
import
NeosConfig
from
"
../../neos.config.json
"
;
import
{
getCardStr
,
fetchCard
}
from
"
./cards
"
;
const
DESCRIPTION_LIMIT
=
10000
;
export
async
function
initStrings
()
{
const
strings
=
(
await
axios
.
get
<
string
>
(
NeosConfig
.
stringsUrl
)).
data
;
...
...
@@ -16,3 +19,14 @@ export async function initStrings() {
export
function
fetchStrings
(
region
:
string
,
id
:
number
):
string
{
return
localStorage
.
getItem
(
`
${
region
}
_
${
id
}
`
)
||
""
;
}
export
async
function
getStrings
(
description
:
number
):
Promise
<
string
>
{
if
(
description
<
DESCRIPTION_LIMIT
)
{
return
fetchStrings
(
"
!system
"
,
description
);
}
else
{
const
code
=
description
>>
4
;
const
index
=
description
&
0xf
;
return
getCardStr
(
await
fetchCard
(
code
,
true
),
index
)
||
""
;
}
}
src/reducers/duel/modal/yesNoModalSlice.ts
View file @
959654f5
...
...
@@ -6,7 +6,7 @@ import {
}
from
"
@reduxjs/toolkit
"
;
import
{
CardMeta
,
fetchCard
}
from
"
../../../api/cards
"
;
import
{
ygopro
}
from
"
../../../api/ocgcore/idl/ocgcore
"
;
import
{
fetchStrings
}
from
"
../../../api/strings
"
;
import
{
fetchStrings
,
getStrings
}
from
"
../../../api/strings
"
;
import
{
RootState
}
from
"
../../../store
"
;
import
{
DuelState
}
from
"
../mod
"
;
...
...
@@ -39,10 +39,20 @@ export const fetchYesNoMeta = createAsyncThunk(
}
);
export
const
fetchYesNoMetaWithEffecDesc
=
createAsyncThunk
(
"
duel/fetchYesNoMetaWithEffecDesc
"
,
async
(
effectDesc
:
number
)
=>
{
return
getStrings
(
effectDesc
);
}
);
export
const
YesNoModalCase
=
(
builder
:
ActionReducerMapBuilder
<
DuelState
>
)
=>
{
builder
.
addCase
(
fetchYesNoMeta
.
fulfilled
,
(
state
,
action
)
=>
{
state
.
modalState
.
yesNoModal
.
msg
=
action
.
payload
;
});
builder
.
addCase
(
fetchYesNoMetaWithEffecDesc
.
fulfilled
,
(
state
,
action
)
=>
{
state
.
modalState
.
yesNoModal
.
msg
=
action
.
payload
;
});
};
export
const
selectYesNoModalIsOpen
=
(
state
:
RootState
)
=>
...
...
src/service/duel/selectYesNo.ts
View file @
959654f5
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
setYesNoModalIsOpen
}
from
"
../../reducers/duel/mod
"
;
import
{
fetchYesNoMetaWithEffecDesc
}
from
"
../../reducers/duel/modal/yesNoModalSlice
"
;
import
{
AppDispatch
}
from
"
../../store
"
;
import
MsgSelectYesNo
=
ygopro
.
StocGameMessage
.
MsgSelectYesNo
;
...
...
@@ -6,5 +8,6 @@ export default (selectYesNo: MsgSelectYesNo, dispatch: AppDispatch) => {
const
player
=
selectYesNo
.
player
;
const
effect_description
=
selectYesNo
.
effect_description
;
console
.
log
(
`effect_description:
${
effect_description
}
`
);
dispatch
(
fetchYesNoMetaWithEffecDesc
(
effect_description
));
dispatch
(
setYesNoModalIsOpen
(
true
));
};
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