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
baichixing
Neos
Commits
3d30aa6c
Commit
3d30aa6c
authored
Jun 28, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix single
parent
6a432a7e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
10 deletions
+19
-10
src/service/duel/selectUnselectCard.ts
src/service/duel/selectUnselectCard.ts
+1
-0
src/ui/Duel/Message/SelectActionsModal/index.tsx
src/ui/Duel/Message/SelectActionsModal/index.tsx
+8
-5
src/ui/Duel/Message/SelectCardsModal/index.tsx
src/ui/Duel/Message/SelectCardsModal/index.tsx
+8
-4
src/ui/Duel/Message/SimpleSelectCardsModal/index.tsx
src/ui/Duel/Message/SimpleSelectCardsModal/index.tsx
+2
-1
No files found.
src/service/duel/selectUnselectCard.ts
View file @
3d30aa6c
...
...
@@ -27,6 +27,7 @@ export default async ({
cancelable
,
min
:
min
,
max
:
max
,
single
:
true
,
selecteds
:
[...
selecteds1
,
...
selecteds2
],
mustSelects
:
[...
mustSelect1
,
...
mustSelect2
],
selectables
:
[...
selectable1
,
...
selectable2
],
...
...
src/ui/Duel/Message/SelectActionsModal/index.tsx
View file @
3d30aa6c
...
...
@@ -19,11 +19,12 @@ const defaultProps: Omit<
>
&
{
isChain
:
boolean
}
=
{
isOpen
:
false
,
isChain
:
false
,
min
:
0
,
max
:
0
,
selecteds
:
[]
as
Option
[],
// 最少选择多少卡
selectables
:
[]
as
Option
[],
// 最多选择多少卡
mustSelects
:
[]
as
Option
[],
// 单选
min
:
0
,
// 最少选择多少卡
max
:
0
,
// 最多选择多少卡
single
:
false
,
// 是否只能单选
selecteds
:
[]
as
Option
[],
selectables
:
[]
as
Option
[],
mustSelects
:
[]
as
Option
[],
cancelable
:
false
,
// 能否取消
finishable
:
false
,
// 选择足够了之后,能否确认
totalLevels
:
0
,
// 需要的总等级数(用于同调/仪式/...)
...
...
@@ -38,6 +39,7 @@ export const SelectActionsModal: React.FC = () => {
isChain
,
min
,
max
,
single
,
selecteds
,
selectables
,
mustSelects
,
...
...
@@ -73,6 +75,7 @@ export const SelectActionsModal: React.FC = () => {
isOpen
,
min
,
max
,
single
,
selecteds
,
selectables
,
mustSelects
,
...
...
src/ui/Duel/Message/SelectCardsModal/index.tsx
View file @
3d30aa6c
...
...
@@ -18,6 +18,7 @@ export interface SelectCardsModalProps {
isOpen
:
boolean
;
min
:
number
;
max
:
number
;
single
:
boolean
;
selecteds
:
Snapshot
<
Option
[]
>
;
// 已经选择了的卡
selectables
:
Snapshot
<
Option
[]
>
;
// 最多选择多少卡
mustSelects
:
Snapshot
<
Option
[]
>
;
// 单选
...
...
@@ -34,6 +35,7 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
isOpen
,
min
,
max
,
single
,
selecteds
:
_selecteds
,
selectables
,
mustSelects
,
...
...
@@ -48,7 +50,6 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
// FIXME: handle `selecteds`
const
[
result
,
setResult
]
=
useState
<
Option
[]
>
([]);
const
[
submitable
,
setSubmitable
]
=
useState
(
false
);
const
single
=
min
===
1
&&
max
===
1
;
// 是否是单选
const
hint
=
useSnapshot
(
matStore
.
hint
);
const
preHintMsg
=
hint
?.
esHint
||
""
;
...
...
@@ -56,6 +57,8 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
const
minMaxText
=
min
===
max
?
min
:
`
${
min
}
-
${
max
}
`
;
const
isMultiple
=
!
single
&&
min
>
1
;
// 判断是否可以提交
useEffect
(()
=>
{
const
[
sumLevel1
,
sumLevel2
]
=
([
"
level1
"
,
"
level2
"
]
as
const
).
map
((
key
)
=>
...
...
@@ -96,7 +99,8 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
<>
<
span
>
{
preHintMsg
}
</
span
>
<
span
>
{
selectHintMsg
}
</
span
>
<
span
>
(请选择
{
single
?
1
:
minMaxText
}
张卡)
</
span
>
<
span
>
(请选择
{
minMaxText
}
张卡)
</
span
>
<
span
>
{
single
?
"
每次选择一张
"
:
""
}
</
span
>
</>
}
// TODO: 这里可以再细化一些
width=
{
600
}
...
...
@@ -138,10 +142,10 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
<
div
className=
"checkcard-container"
key=
{
i
}
>
<
CheckCard
.
Group
onChange=
{
(
res
)
=>
{
setResult
((
single
?
[
res
]
:
res
)
as
any
);
setResult
((
isMultiple
?
res
:
[
res
]
)
as
any
);
}
}
// TODO 考虑如何设置默认值,比如只有一个的,就直接选中
multiple=
{
!
sing
le
}
multiple=
{
isMultip
le
}
style=
{
{
display
:
"
grid
"
,
gridTemplateColumns
:
"
repeat(6, 1fr)
"
,
...
...
src/ui/Duel/Message/SimpleSelectCardsModal/index.tsx
View file @
3d30aa6c
...
...
@@ -17,12 +17,13 @@ export const SimpleSelectCardsModal: React.FC = () => {
isOpen=
{
isOpen
}
min=
{
1
}
max=
{
1
}
single=
{
false
}
selecteds=
{
[]
}
mustSelects=
{
[]
}
selectables=
{
selectables
}
cancelable
finishable=
{
false
}
totalLevels=
{
1
}
totalLevels=
{
0
}
overflow
onSubmit=
{
rs
}
onFinish=
{
()
=>
rs
([])
}
...
...
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