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
176b19a0
Commit
176b19a0
authored
Jun 25, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: menu dropdown
parent
94bd5f03
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
49 deletions
+59
-49
src/ui/Duel/PlayMat/Card/index.tsx
src/ui/Duel/PlayMat/Card/index.tsx
+1
-2
src/ui/Duel/PlayMat/Menu/index.tsx
src/ui/Duel/PlayMat/Menu/index.tsx
+58
-47
No files found.
src/ui/Duel/PlayMat/Card/index.tsx
View file @
176b19a0
...
@@ -173,7 +173,7 @@ export const Card: React.FC<{ idx: number }> = React.memo(({ idx }) => {
...
@@ -173,7 +173,7 @@ export const Card: React.FC<{ idx: number }> = React.memo(({ idx }) => {
<
div
className=
"card-focus"
/>
<
div
className=
"card-focus"
/>
<
div
className=
"card-shadow"
/>
<
div
className=
"card-shadow"
/>
<
Dropdown
<
Dropdown
menu=
{
{
items
:
menuItems
.
value
as
any
,
onClick
:
onDropdownClick
}
}
menu=
{
{
items
:
menuItems
.
value
as
any
}
}
placement=
"bottom"
placement=
"bottom"
overlayClassName=
"card-dropdown"
overlayClassName=
"card-dropdown"
arrow
arrow
...
@@ -266,7 +266,6 @@ const handleEffectActivation = (
...
@@ -266,7 +266,6 @@ const handleEffectActivation = (
// 2. 如果是非效果发动,那么直接选择哪张卡(单张卡直接选择那张)
// 2. 如果是非效果发动,那么直接选择哪张卡(单张卡直接选择那张)
// 3. 如果是效果发动,那么选择哪张卡,然后选择效果
// 3. 如果是效果发动,那么选择哪张卡,然后选择效果
const
handleDropdownMenu
=
(
cards
:
CardType
[],
isField
:
boolean
)
=>
{
const
handleDropdownMenu
=
(
cards
:
CardType
[],
isField
:
boolean
)
=>
{
console
.
log
(
"
here
"
);
const
map
=
new
Map
<
Interactivity
<
number
>
[
"
interactType
"
],
CardType
[]
>
();
const
map
=
new
Map
<
Interactivity
<
number
>
[
"
interactType
"
],
CardType
[]
>
();
cards
.
forEach
((
card
)
=>
{
cards
.
forEach
((
card
)
=>
{
card
.
idleInteractivities
.
forEach
(({
interactType
})
=>
{
card
.
idleInteractivities
.
forEach
(({
interactType
})
=>
{
...
...
src/ui/Duel/PlayMat/Menu/index.tsx
View file @
176b19a0
...
@@ -8,9 +8,9 @@ import {
...
@@ -8,9 +8,9 @@ import {
theme
,
theme
,
Divider
,
Divider
,
Space
,
Space
,
Popconfirm
,
type
DropdownProps
,
}
from
"
antd
"
;
}
from
"
antd
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
useState
,
cloneElement
}
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
import
{
StepForwardFilled
,
StepForwardFilled
,
...
@@ -65,7 +65,7 @@ export const Menu = () => {
...
@@ -65,7 +65,7 @@ export const Menu = () => {
// [PhaseType.UNKNOWN, "未知阶段", response],
// [PhaseType.UNKNOWN, "未知阶段", response],
];
];
const
i
tems
:
MenuProps
[
"
items
"
]
=
phaseBind
.
map
(
const
phaseSwitchI
tems
:
MenuProps
[
"
items
"
]
=
phaseBind
.
map
(
([
phase
,
str
,
response
],
i
)
=>
({
([
phase
,
str
,
response
],
i
)
=>
({
key
:
i
,
key
:
i
,
label
:
str
,
label
:
str
,
...
@@ -80,38 +80,26 @@ export const Menu = () => {
...
@@ -80,38 +80,26 @@ export const Menu = () => {
})
})
);
);
const
{
token
}
=
useToken
();
const
surrenderMenuItems
:
MenuProps
[
"
items
"
]
=
[
{
const
contentStyle
=
{
key
:
0
,
backgroundColor
:
token
.
colorBgElevated
,
label
:
"
取消
"
,
borderRadius
:
token
.
borderRadiusLG
,
},
boxShadow
:
token
.
boxShadowSecondary
,
{
};
key
:
1
,
label
:
"
确定
"
,
const
menuStyle
=
{
danger
:
true
,
boxShadow
:
"
none
"
,
onClick
:
sendSurrender
,
};
},
];
const
[
showRendererTooltips
,
setShowRendererTooltips
]
=
useState
<
boolean
|
undefined
>
(
undefined
);
const
globalDisable
=
!
matStore
.
isMe
(
currentPlayer
);
const
globalDisable
=
!
matStore
.
isMe
(
currentPlayer
);
return
(
return
(
<>
<>
<
div
className=
"menu-container"
>
<
div
className=
"menu-container"
>
<
Dropdown
<
DropdownWithTitle
menu=
{
{
items
}
}
title=
"请选择要进入的阶段"
dropdownRender=
{
(
menu
)
=>
(
menu=
{
{
items
:
phaseSwitchItems
}
}
<
div
style=
{
contentStyle
}
>
{
React
.
cloneElement
(
menu
as
React
.
ReactElement
,
{
style
:
menuStyle
,
})
}
<
Divider
style=
{
{
margin
:
0
}
}
/>
<
Space
style=
{
{
padding
:
16
}
}
>
请选择要进入的阶段
</
Space
>
</
div
>
)
}
arrow
disabled=
{
globalDisable
}
disabled=
{
globalDisable
}
>
>
<
Button
<
Button
...
@@ -121,7 +109,7 @@ export const Menu = () => {
...
@@ -121,7 +109,7 @@ export const Menu = () => {
>
>
{
phaseBind
.
find
(([
key
])
=>
key
===
currentPhase
)?.[
1
]
}
{
phaseBind
.
find
(([
key
])
=>
key
===
currentPhase
)?.[
1
]
}
</
Button
>
</
Button
>
</
Dropdown
>
</
Dropdown
WithTitle
>
<
Tooltip
title=
"聊天室"
>
<
Tooltip
title=
"聊天室"
>
<
Button
<
Button
icon=
{
<
MessageFilled
/>
}
icon=
{
<
MessageFilled
/>
}
...
@@ -129,23 +117,46 @@ export const Menu = () => {
...
@@ -129,23 +117,46 @@ export const Menu = () => {
disabled=
{
globalDisable
}
disabled=
{
globalDisable
}
></
Button
>
></
Button
>
</
Tooltip
>
</
Tooltip
>
<
Tooltip
title=
"投降"
color=
"red"
open=
{
showRendererTooltips
}
>
<
DropdownWithTitle
<
Popconfirm
title=
"是否投降?"
title=
"投降"
menu=
{
{
items
:
surrenderMenuItems
}
}
description=
"您确认要投降?"
disabled=
{
globalDisable
}
onConfirm=
{
sendSurrender
}
>
okText=
"确认"
<
Button
icon=
{
<
CloseCircleFilled
/>
}
type=
"text"
></
Button
>
cancelText=
"取消"
</
DropdownWithTitle
>
placement=
"topRight"
arrow
onOpenChange=
{
(
open
)
=>
setShowRendererTooltips
(
!
open
?
undefined
:
!
open
)
}
>
<
Button
icon=
{
<
CloseCircleFilled
/>
}
type=
"text"
></
Button
>
</
Popconfirm
>
</
Tooltip
>
</
div
>
</
div
>
</>
</>
);
);
};
};
const
DropdownWithTitle
:
React
.
FC
<
DropdownProps
&
{
title
:
string
}
>
=
(
props
)
=>
{
const
{
token
}
=
useToken
();
const
contentStyle
=
{
backgroundColor
:
token
.
colorBgElevated
,
borderRadius
:
token
.
borderRadiusLG
,
boxShadow
:
token
.
boxShadowSecondary
,
};
const
menuStyle
=
{
boxShadow
:
"
none
"
,
};
return
(
<
Dropdown
{
...
props
}
dropdownRender=
{
(
menu
)
=>
(
<
div
style=
{
contentStyle
}
>
<
Space
style=
{
{
padding
:
"
12px 16px
"
}
}
>
{
props
.
title
}
</
Space
>
<
Divider
style=
{
{
margin
:
0
}
}
/>
{
cloneElement
(
menu
as
React
.
ReactElement
,
{
style
:
menuStyle
,
})
}
</
div
>
)
}
arrow
trigger=
{
[
"
click
"
,
"
hover
"
]
}
>
{
props
.
children
}
</
Dropdown
>
);
};
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