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
BBeretta
Neos
Commits
adadbc76
Commit
adadbc76
authored
May 07, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update selectActionModal
parent
6f35edc4
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
163 additions
and
108 deletions
+163
-108
src/service/duel/selectCard.ts
src/service/duel/selectCard.ts
+1
-0
src/service/duel/selectChain.ts
src/service/duel/selectChain.ts
+1
-0
src/service/duel/selectSum.ts
src/service/duel/selectSum.ts
+1
-0
src/service/duel/selectTribute.ts
src/service/duel/selectTribute.ts
+1
-0
src/service/duel/selectUnselectCard.ts
src/service/duel/selectUnselectCard.ts
+2
-1
src/stores/messageStore/methods/clearSelectActions.ts
src/stores/messageStore/methods/clearSelectActions.ts
+1
-0
src/stores/messageStore/store.ts
src/stores/messageStore/store.ts
+1
-0
src/stores/messageStore/types.ts
src/stores/messageStore/types.ts
+3
-0
src/styles/select-modal.scss
src/styles/select-modal.scss
+25
-0
src/ui/Duel/Message/SelectActionsModal.tsx
src/ui/Duel/Message/SelectActionsModal.tsx
+127
-107
No files found.
src/service/duel/selectCard.ts
View file @
adadbc76
...
...
@@ -20,5 +20,6 @@ export default (selectCard: MsgSelectCard) => {
response
:
card
.
response
,
});
}
messageStore
.
selectCardActions
.
isValid
=
true
;
messageStore
.
selectCardActions
.
isOpen
=
true
;
};
src/service/duel/selectChain.ts
View file @
adadbc76
...
...
@@ -73,6 +73,7 @@ export default (selectChain: MsgSelectChain) => {
fetchSelectHintMeta
({
selectHintData
:
203
,
});
messageStore
.
selectCardActions
.
isValid
=
true
;
messageStore
.
selectCardActions
.
isOpen
=
true
;
break
;
...
...
src/service/duel/selectSum.ts
View file @
adadbc76
...
...
@@ -16,5 +16,6 @@ export default (selectSum: MsgSelectSum) => {
fetchCheckCardMeta
(
option
);
}
messageStore
.
selectCardActions
.
isValid
=
true
;
messageStore
.
selectCardActions
.
isOpen
=
true
;
};
src/service/duel/selectTribute.ts
View file @
adadbc76
...
...
@@ -14,5 +14,6 @@ export default (selectTribute: MsgSelectTribute) => {
fetchCheckCardMeta
(
option
);
}
messageStore
.
selectCardActions
.
isValid
=
true
;
messageStore
.
selectCardActions
.
isOpen
=
true
;
};
src/service/duel/selectUnselectCard.ts
View file @
adadbc76
...
...
@@ -11,12 +11,13 @@ export default ({
selectable_cards
:
selectableCards
,
selected_cards
:
selectedCards
,
}:
MsgSelectUnselectCard
)
=>
{
messageStore
.
selectCardActions
.
isOpen
=
true
;
messageStore
.
selectCardActions
.
finishAble
=
finishable
;
messageStore
.
selectCardActions
.
cancelAble
=
cancelable
;
messageStore
.
selectCardActions
.
min
=
min
;
messageStore
.
selectCardActions
.
max
=
max
;
messageStore
.
selectCardActions
.
single
=
true
;
messageStore
.
selectCardActions
.
isValid
=
true
;
messageStore
.
selectCardActions
.
isOpen
=
true
;
for
(
const
option
of
selectableCards
)
{
fetchCheckCardMeta
(
option
);
...
...
src/stores/messageStore/methods/clearSelectActions.ts
View file @
adadbc76
...
...
@@ -4,6 +4,7 @@ const { selectCardActions } = messageStore;
export
const
clearSelectActions
=
()
=>
{
selectCardActions
.
isOpen
=
false
;
selectCardActions
.
isValid
=
false
;
selectCardActions
.
isChain
=
undefined
;
selectCardActions
.
min
=
undefined
;
selectCardActions
.
max
=
undefined
;
...
...
src/stores/messageStore/store.ts
View file @
adadbc76
...
...
@@ -7,6 +7,7 @@ export const messageStore = proxy<ModalState>({
cardListModal
:
{
isOpen
:
false
,
list
:
[]
},
selectCardActions
:
{
isOpen
:
false
,
isValid
:
false
,
cancelAble
:
false
,
finishAble
:
false
,
selecteds
:
[],
...
...
src/stores/messageStore/types.ts
View file @
adadbc76
...
...
@@ -31,7 +31,10 @@ export interface ModalState {
};
// 卡牌选择状态
selectCardActions
:
{
// 是否打开
isOpen
:
boolean
;
// 是否有效,当有`MSG_SELECT_xxx`到前端时为true,用户选择完成后设置为false
isValid
:
boolean
;
// 如果是连锁,发response给后端的方式稍微有点不同,这里标记下
isChain
?:
boolean
;
min
?:
number
;
...
...
src/styles/select-modal.scss
0 → 100644
View file @
adadbc76
.select-modal
{
position
:
fixed
;
left
:
0
;
bottom
:
0
;
width
:
100%
;
height
:
60px
;
background
:
rgba
(
#333
,
0
.5
);
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
transition
:
0
.4s
;
&
-button
{
font-family
:
"Nunito"
,
sans-serif
;
font-size
:
18px
;
cursor
:
pointer
;
border
:
0
;
outline
:
0
;
padding
:
10px
40px
;
border-radius
:
30px
;
box-shadow
:
0
10px
40px
rgba
(
0
,
0
,
0
,
0
.16
);
transition
:
0
.3s
;
}
}
src/ui/Duel/Message/SelectActionsModal.tsx
View file @
adadbc76
import
"
@/styles/select-modal.scss
"
;
import
{
ThunderboltOutlined
}
from
"
@ant-design/icons
"
;
import
{
CheckCard
,
CheckCardProps
}
from
"
@ant-design/pro-components
"
;
import
{
Button
,
Card
,
Col
,
Popover
,
Row
}
from
"
antd
"
;
...
...
@@ -23,6 +25,7 @@ const { selectCardActions } = messageStore;
export
const
SelectActionsModal
=
()
=>
{
const
snap
=
useSnapshot
(
selectCardActions
);
const
isOpen
=
snap
.
isOpen
;
const
isValid
=
snap
.
isValid
;
const
isChain
=
snap
.
isChain
;
const
min
=
snap
.
min
??
0
;
const
max
=
snap
.
max
??
0
;
...
...
@@ -56,117 +59,134 @@ export const SelectActionsModal = () => {
:
response
.
length
>=
min
&&
response
.
length
<=
max
&&
levelMatched
;
return
(
<
DragModal
title=
{
`${preHintMsg} ${selectHintMsg} ${min}-${max} ${
single ? "每次选择一张" : ""
}`
}
open=
{
isOpen
}
closable=
{
false
}
footer=
{
<>
<
Button
disabled=
{
!
submitable
}
onClick=
{
()
=>
{
const
values
=
mustSelects
.
concat
(
response
)
.
map
((
option
)
=>
option
.
response
);
<>
<
DragModal
title=
{
`${preHintMsg} ${selectHintMsg} ${min}-${max} ${
single ? "每次选择一张" : ""
}`
}
open=
{
isOpen
&&
isValid
}
onCancel=
{
()
=>
{
selectCardActions
.
isOpen
=
false
;
}
}
footer=
{
<>
<
button
disabled=
{
!
submitable
}
onClick=
{
()
=>
{
const
values
=
mustSelects
.
concat
(
response
)
.
map
((
option
)
=>
option
.
response
);
if
(
isChain
)
{
sendSelectSingleResponse
(
values
[
0
]);
}
else
{
sendSelectMultiResponse
(
values
);
}
clearSelectActions
();
}
}
onFocus=
{
()
=>
{}
}
onBlur=
{
()
=>
{}
}
>
{
fetchStrings
(
"
!system
"
,
1211
)
}
</
B
utton
>
<
B
utton
disabled=
{
!
finishable
}
onClick=
{
()
=>
{
sendSelectSingleResponse
(
FINISH_RESPONSE
);
clearSelectActions
();
}
}
onFocus=
{
()
=>
{}
}
onBlur=
{
()
=>
{}
}
>
{
fetchStrings
(
"
!system
"
,
1296
)
}
</
B
utton
>
if
(
isChain
)
{
sendSelectSingleResponse
(
values
[
0
]);
}
else
{
sendSelectMultiResponse
(
values
);
}
clearSelectActions
();
}
}
onFocus=
{
()
=>
{}
}
onBlur=
{
()
=>
{}
}
>
{
fetchStrings
(
"
!system
"
,
1211
)
}
</
b
utton
>
<
b
utton
disabled=
{
!
finishable
}
onClick=
{
()
=>
{
sendSelectSingleResponse
(
FINISH_RESPONSE
);
clearSelectActions
();
}
}
onFocus=
{
()
=>
{}
}
onBlur=
{
()
=>
{}
}
>
{
fetchStrings
(
"
!system
"
,
1296
)
}
</
b
utton
>
<
Button
disabled=
{
!
cancelable
}
<
button
disabled=
{
!
cancelable
}
onClick=
{
()
=>
{
sendSelectSingleResponse
(
CANCEL_RESPONSE
);
clearSelectActions
();
}
}
onFocus=
{
()
=>
{}
}
onBlur=
{
()
=>
{}
}
>
{
fetchStrings
(
"
!system
"
,
1295
)
}
</
button
>
</>
}
width=
{
800
}
>
<
CheckCard
.
Group
multiple
bordered
size=
"small"
onChange=
{
(
value
)
=>
{
// @ts-ignore
setResponse
(
value
);
}
}
>
<
Row
>
{
selectables
.
map
((
option
,
idx
)
=>
{
return
(
<
Col
span=
{
4
}
key=
{
idx
}
>
<
HoverCheckCard
hoverContent=
{
option
.
effectDesc
}
style=
{
{
width
:
120
}
}
cover=
{
<
img
alt=
{
option
.
code
.
toString
()
}
src=
{
option
.
code
?
`${NeosConfig.cardImgUrl}/${option.code}.jpg`
:
`${NeosConfig.assetsPath}/card_back.jpg`
}
style=
{
{
width
:
100
}
}
/>
}
value=
{
option
}
/>
</
Col
>
);
})
}
</
Row
>
<
p
>
{
selecteds
.
length
>
0
?
fetchStrings
(
"
!system
"
,
212
)
:
""
}
</
p
>
<
Row
>
{
selecteds
.
concat
(
mustSelects
).
map
((
option
,
idx
)
=>
{
return
(
<
Col
span=
{
4
}
key=
{
idx
}
>
<
Card
style=
{
{
width
:
120
}
}
cover=
{
<
img
alt=
{
option
.
code
.
toString
()
}
src=
{
option
.
code
?
`${NeosConfig.cardImgUrl}/${option.code}.jpg`
:
`${NeosConfig.assetsPath}/card_back.jpg`
}
/>
}
/>
</
Col
>
);
})
}
</
Row
>
</
CheckCard
.
Group
>
</
DragModal
>
{
isValid
&&
!
isOpen
?
(
<
div
className=
"select-modal"
>
<
button
className=
"select-modal-button"
onClick=
{
()
=>
{
sendSelectSingleResponse
(
CANCEL_RESPONSE
);
clearSelectActions
();
selectCardActions
.
isOpen
=
true
;
}
}
onFocus=
{
()
=>
{}
}
onBlur=
{
()
=>
{}
}
>
{
fetchStrings
(
"
!system
"
,
1295
)
}
</
Button
>
</>
}
width=
{
800
}
>
<
CheckCard
.
Group
multiple
bordered
size=
"small"
onChange=
{
(
value
)
=>
{
// @ts-ignore
setResponse
(
value
);
}
}
>
<
Row
>
{
selectables
.
map
((
option
,
idx
)
=>
{
return
(
<
Col
span=
{
4
}
key=
{
idx
}
>
<
HoverCheckCard
hoverContent=
{
option
.
effectDesc
}
style=
{
{
width
:
120
}
}
cover=
{
<
img
alt=
{
option
.
code
.
toString
()
}
src=
{
option
.
code
?
`${NeosConfig.cardImgUrl}/${option.code}.jpg`
:
`${NeosConfig.assetsPath}/card_back.jpg`
}
style=
{
{
width
:
100
}
}
/>
}
value=
{
option
}
/>
</
Col
>
);
})
}
</
Row
>
<
p
>
{
fetchStrings
(
"
!system
"
,
212
)
}
</
p
>
<
Row
>
{
selecteds
.
concat
(
mustSelects
).
map
((
option
,
idx
)
=>
{
return
(
<
Col
span=
{
4
}
key=
{
idx
}
>
<
Card
style=
{
{
width
:
120
}
}
cover=
{
<
img
alt=
{
option
.
code
.
toString
()
}
src=
{
option
.
code
?
`${NeosConfig.cardImgUrl}/${option.code}.jpg`
:
`${NeosConfig.assetsPath}/card_back.jpg`
}
/>
}
/>
</
Col
>
);
})
}
</
Row
>
</
CheckCard
.
Group
>
</
DragModal
>
></
button
>
SCROLL UP
</
div
>
)
:
(
<></>
)
}
</>
);
};
...
...
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