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