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
ad1a91ea
Commit
ad1a91ea
authored
Jun 21, 2023
by
timel
Committed by
Chunchi Che
Jun 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: card dropdown action:
parent
d5a5441b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
27 deletions
+64
-27
src/ui/Duel/PlayMat/Card/index.scss
src/ui/Duel/PlayMat/Card/index.scss
+11
-8
src/ui/Duel/PlayMat/Card/index.tsx
src/ui/Duel/PlayMat/Card/index.tsx
+53
-19
No files found.
src/ui/Duel/PlayMat/Card/index.scss
View file @
ad1a91ea
...
@@ -40,12 +40,13 @@ section#mat {
...
@@ -40,12 +40,13 @@ section#mat {
}
}
}
}
.card-shadow
{
.card-shadow
{
// position: absolute;
display
:
none
;
// left: 0;
position
:
absolute
;
// top: 0;
left
:
0
;
// width: 100%;
top
:
0
;
// height: 100%;
width
:
100%
;
// background-color: #0000005e;
height
:
100%
;
background-color
:
transparent
;
// filter: blur(2px);
// filter: blur(2px);
}
}
...
@@ -97,8 +98,10 @@ section#mat {
...
@@ -97,8 +98,10 @@ section#mat {
}
}
}
}
.mat-card
.highlight
{
.mat-card.highlight
.card-shadow
{
box-shadow
:
0
0
10px
2px
#5db7ff
;
display
:
block
!
important
;
background
:
linear-gradient
(
to
right
,
#0079c6
,
#009cff
)
!
important
;
filter
:
blur
(
8px
);
}
}
@keyframes
focus
{
@keyframes
focus
{
...
...
src/ui/Duel/PlayMat/Card/index.tsx
View file @
ad1a91ea
...
@@ -22,15 +22,15 @@ import {
...
@@ -22,15 +22,15 @@ import {
import
type
{
SpringApiProps
}
from
"
./springs/types
"
;
import
type
{
SpringApiProps
}
from
"
./springs/types
"
;
import
{
YgoCard
}
from
"
@/ui/Shared
"
;
import
{
YgoCard
}
from
"
@/ui/Shared
"
;
import
{
showCardModal
}
from
"
@/ui/Duel/Message/CardModal
"
;
import
{
showCardModal
,
closeCardModal
}
from
"
@/ui/Duel/Message/CardModal
"
;
import
{
Button
,
Dropdown
}
from
"
antd
"
;
import
{
Button
,
Dropdown
,
type
MenuProps
}
from
"
antd
"
;
import
{
import
{
UploadOutlined
,
UploadOutlined
,
DownloadOutlined
,
DownloadOutlined
,
UpOutlined
,
UpOutlined
,
}
from
"
@ant-design/icons
"
;
}
from
"
@ant-design/icons
"
;
import
{
fetchStrings
,
sendSelectIdleCmdResponse
,
type
CardMeta
}
from
"
@/api
"
;
const
NeosConfig
=
useConfig
();
const
NeosConfig
=
useConfig
();
const
{
HAND
,
GRAVE
,
REMOVED
,
DECK
,
EXTRA
,
MZONE
,
SZONE
,
TZONE
}
=
const
{
HAND
,
GRAVE
,
REMOVED
,
DECK
,
EXTRA
,
MZONE
,
SZONE
,
TZONE
}
=
...
@@ -134,24 +134,58 @@ export const Card: FC<{ idx: number }> = React.memo(({ idx }) => {
...
@@ -134,24 +134,58 @@ export const Card: FC<{ idx: number }> = React.memo(({ idx }) => {
// <<< 动画 <<<
// <<< 动画 <<<
// >>> 效果 >>>
const
idleInteractivities
=
snap
.
idleInteractivities
;
const
idleInteractivities
=
snap
.
idleInteractivities
;
useEffect
(()
=>
{
useEffect
(()
=>
{
setHighlight
(
!!
idleInteractivities
.
length
);
setHighlight
(
!!
idleInteractivities
.
length
);
},
[
idleInteractivities
]);
},
[
idleInteractivities
]);
const
items
=
[
{
const
interactivies
=
idleInteractivities
.
map
((
interactivity
)
=>
({
key
:
"
1
"
,
desc
:
interactTypeToString
(
interactivity
.
interactType
),
label
:
"
正面攻表召唤
"
,
response
:
interactivity
.
response
,
},
effectCode
:
interactivity
.
activateIndex
,
{
}));
key
:
"
2
"
,
const
EFFECT_ACTIVATION_DESC
=
"
发动效果
"
;
label
:
"
反面守表召唤
"
,
const
nonEffectInteractivies
=
interactivies
.
filter
(
},
(
item
)
=>
item
.
desc
!==
EFFECT_ACTIVATION_DESC
{
);
key
:
"
3
"
,
const
effectInteractivies
=
interactivies
.
filter
(
label
:
"
效果发动
"
,
(
item
)
=>
item
.
desc
===
EFFECT_ACTIVATION_DESC
},
);
];
const
menuItems
:
MenuProps
[
"
items
"
]
=
nonEffectInteractivies
.
map
(
({
desc
},
key
)
=>
({
key
,
label
:
desc
,
})
);
if
(
effectInteractivies
.
length
)
{
menuItems
.
push
({
key
:
menuItems
.
length
,
label
:
EFFECT_ACTIVATION_DESC
,
});
}
const
onDropdownClick
:
MenuProps
[
"
onClick
"
]
=
({
key
})
=>
{
const
index
=
Number
(
key
);
if
(
index
>=
nonEffectInteractivies
.
length
)
{
// 是效果发动
handleEffectActivation
();
}
else
{
// 非效果发动
sendSelectIdleCmdResponse
(
nonEffectInteractivies
[
index
].
response
);
}
closeCardModal
();
};
const
handleEffectActivation
=
()
=>
{
// 不用考虑为0的情况,因为已经判断了不可能为0
if
(
effectInteractivies
.
length
===
1
)
{
// 如果只有一个效果,点击直接触发
sendSelectIdleCmdResponse
(
effectInteractivies
[
0
].
response
);
}
else
{
// optionsModal
}
};
// <<< 效果 <<<
return
(
return
(
<
animated
.
div
<
animated
.
div
className=
"mat-card"
className=
"mat-card"
...
@@ -182,10 +216,10 @@ export const Card: FC<{ idx: number }> = React.memo(({ idx }) => {
...
@@ -182,10 +216,10 @@ export const Card: 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
}
}
menu=
{
{
items
:
menuItems
,
onClick
:
onDropdownClick
}
}
placement=
"bottom"
placement=
"bottom"
overlayClassName=
"card-dropdown"
overlayClassName=
"card-dropdown"
arrow
=
{
{
pointAtCenter
:
true
}
}
arrow
trigger=
{
[
"
click
"
]
}
trigger=
{
[
"
click
"
]
}
>
>
<
div
className=
{
classnames
(
"
card-img-wrap
"
,
{
focus
:
classFocus
})
}
>
<
div
className=
{
classnames
(
"
card-img-wrap
"
,
{
focus
:
classFocus
})
}
>
...
...
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