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
94bd5f03
Commit
94bd5f03
authored
Jun 25, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev/async_yesno_modal' into 'dev/async'
migrate yesno modal See merge request
mycard/Neos!236
parents
12eb6029
ee4bb39f
Pipeline
#22405
failed with stages
in 14 minutes and 34 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
69 additions
and
15 deletions
+69
-15
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+2
-2
src/service/duel/selectEffectYn.ts
src/service/duel/selectEffectYn.ts
+2
-3
src/service/duel/selectYesNo.ts
src/service/duel/selectYesNo.ts
+3
-3
src/service/utils/fetchCheckCardMeta.ts
src/service/utils/fetchCheckCardMeta.ts
+1
-1
src/stores/messageStore/store.ts
src/stores/messageStore/store.ts
+0
-1
src/stores/messageStore/types.ts
src/stores/messageStore/types.ts
+0
-5
src/ui/Duel/Message/YesNoModal/index.scss
src/ui/Duel/Message/YesNoModal/index.scss
+0
-0
src/ui/Duel/Message/YesNoModal/index.tsx
src/ui/Duel/Message/YesNoModal/index.tsx
+60
-0
src/ui/Duel/Message/index.ts
src/ui/Duel/Message/index.ts
+1
-0
No files found.
src/service/duel/gameMsg.ts
View file @
94bd5f03
...
...
@@ -135,7 +135,7 @@ async function _handleGameMsg(pb: ygopro.YgoStocMsg) {
break
;
}
case
"
select_effect_yn
"
:
{
onMsgSelectEffectYn
(
msg
.
select_effect_yn
);
await
onMsgSelectEffectYn
(
msg
.
select_effect_yn
);
break
;
}
...
...
@@ -170,7 +170,7 @@ async function _handleGameMsg(pb: ygopro.YgoStocMsg) {
break
;
}
case
"
select_yes_no
"
:
{
onMsgSelectYesNo
(
msg
.
select_yes_no
);
await
onMsgSelectYesNo
(
msg
.
select_yes_no
);
break
;
}
...
...
src/service/duel/selectEffectYn.ts
View file @
94bd5f03
import
{
fetchStrings
,
ygopro
}
from
"
@/api
"
;
import
{
CardMeta
,
fetchCard
}
from
"
@/api/cards
"
;
import
{
messageStore
}
from
"
@/stores
"
;
import
{
displayYesNoModal
}
from
"
@/ui/Duel/Message
"
;
type
MsgSelectEffectYn
=
ygopro
.
StocGameMessage
.
MsgSelectEffectYn
;
...
...
@@ -33,6 +33,5 @@ export default async (selectEffectYn: MsgSelectEffectYn) => {
const
desc
=
fetchStrings
(
"
!system
"
,
effect_description
);
const
meta
=
await
fetchCard
(
code
);
messageStore
.
yesNoModal
.
msg
=
textGenerator
(
desc
,
meta
,
location
);
messageStore
.
yesNoModal
.
isOpen
=
true
;
await
displayYesNoModal
(
textGenerator
(
desc
,
meta
,
location
));
};
src/service/duel/selectYesNo.ts
View file @
94bd5f03
import
{
getStrings
,
ygopro
}
from
"
@/api
"
;
import
{
messageStore
}
from
"
@/stores
"
;
import
{
displayYesNoModal
}
from
"
@/ui/Duel/Message
"
;
type
MsgSelectYesNo
=
ygopro
.
StocGameMessage
.
MsgSelectYesNo
;
...
...
@@ -7,6 +7,6 @@ export default async (selectYesNo: MsgSelectYesNo) => {
const
_player
=
selectYesNo
.
player
;
const
effect_description
=
selectYesNo
.
effect_description
;
messageStore
.
yesNoModal
.
msg
=
await
getStrings
(
effect_description
);
messageStore
.
yesNoModal
.
isOpen
=
true
;
const
msg
=
await
getStrings
(
effect_description
);
await
displayYesNoModal
(
msg
)
;
};
src/service/utils/fetchCheckCardMeta.ts
View file @
94bd5f03
import
type
{
ygopro
}
from
"
@/api
"
;
import
{
fetchCard
,
getCardStr
}
from
"
@/api/cards
"
;
import
{
cardStore
}
from
"
@/stores
"
;
import
type
{
Option
}
from
"
@/ui/Duel/Message
/SelectActionsModal
"
;
import
type
{
Option
}
from
"
@/ui/Duel/Message
"
;
const
helper
=
async
(
{
...
...
src/stores/messageStore/store.ts
View file @
94bd5f03
...
...
@@ -3,7 +3,6 @@ import { proxy } from "valtio";
import
type
{
ModalState
}
from
"
./types
"
;
export
const
messageStore
=
proxy
<
ModalState
>
({
yesNoModal
:
{
isOpen
:
false
},
positionModal
:
{
isOpen
:
false
,
positions
:
[]
},
checkCounterModal
:
{
isOpen
:
false
,
...
...
src/stores/messageStore/types.ts
View file @
94bd5f03
import
type
{
CardMeta
,
ygopro
}
from
"
@/api
"
;
export
interface
ModalState
{
// Yes or No弹窗
yesNoModal
:
{
isOpen
:
boolean
;
msg
?:
string
;
};
// 表示形式选择弹窗
positionModal
:
{
isOpen
:
boolean
;
...
...
src/ui/Duel/Message/YesNoModal/index.scss
0 → 100644
View file @
94bd5f03
src/ui/Duel/Message/YesNoModal.tsx
→
src/ui/Duel/Message/YesNoModal
/index
.tsx
View file @
94bd5f03
import
{
Button
}
from
"
antd
"
;
import
React
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
sendSelectEffectYnResponse
}
from
"
@/api
"
;
import
{
matStore
,
messageStore
}
from
"
@/stores
"
;
import
{
matStore
}
from
"
@/stores
"
;
import
{
DragModal
}
from
"
./Drag
Modal
"
;
import
{
NeosModal
}
from
"
../Neos
Modal
"
;
const
{
yesNoModal
}
=
messageStore
;
interface
YesNoModalProps
{
isOpen
:
boolean
;
msg
?:
string
;
}
const
defaultProps
=
{
isOpen
:
false
};
export
const
YesNoModal
=
()
=>
{
const
snapYesNoModal
=
useSnapshot
(
yesNoModal
);
const
isOpen
=
snapYesNoModal
.
isOpen
;
const
msg
=
snapYesNoModal
.
msg
;
const
localStore
=
proxy
<
YesNoModalProps
>
(
defaultProps
);
export
const
YesNoModal
:
React
.
FC
=
()
=>
{
const
{
isOpen
,
msg
}
=
useSnapshot
(
localStore
)
;
const
hint
=
useSnapshot
(
matStore
.
hint
);
const
preHintMsg
=
hint
?.
esHint
||
""
;
return
(
<
Drag
Modal
<
Neos
Modal
title=
{
`${preHintMsg} ${msg}`
}
open=
{
isOpen
}
closable=
{
false
}
...
...
@@ -27,8 +31,7 @@ export const YesNoModal = () => {
<
Button
onClick=
{
()
=>
{
sendSelectEffectYnResponse
(
true
);
// dispatch(setYesNoModalIsOpen(false));
yesNoModal
.
isOpen
=
false
;
rs
();
}
}
>
Yes
...
...
@@ -36,8 +39,7 @@ export const YesNoModal = () => {
<
Button
onClick=
{
()
=>
{
sendSelectEffectYnResponse
(
false
);
// dispatch(setYesNoModalIsOpen(false));
yesNoModal
.
isOpen
=
false
;
rs
();
}
}
>
No
...
...
@@ -47,3 +49,12 @@ export const YesNoModal = () => {
/>
);
};
let
rs
:
(
arg
?:
any
)
=>
void
=
()
=>
{};
export
const
displayYesNoModal
=
async
(
msg
:
string
)
=>
{
localStore
.
msg
=
msg
;
localStore
.
isOpen
=
true
;
await
new
Promise
<
void
>
((
resolve
)
=>
(
rs
=
resolve
));
// 等待在组件内resolve
localStore
.
isOpen
=
false
;
};
src/ui/Duel/Message/index.ts
View file @
94bd5f03
...
...
@@ -8,6 +8,7 @@ export * from "./HintNotification";
export
*
from
"
./OptionModal
"
;
export
*
from
"
./PositionModal
"
;
export
*
from
"
./SelectActionsModal
"
;
export
{
type
Option
}
from
"
./SelectCardsModal
"
;
export
*
from
"
./SimpleSelectCardsModal
"
;
export
*
from
"
./SortCardModal
"
;
export
*
from
"
./YesNoModal
"
;
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