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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
Neos
Commits
122be474
Commit
122be474
authored
May 14, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'optimize/cardListModal' into 'main'
Optimize/card list modal See merge request
mycard/Neos!191
parents
c60754fd
f0bb7d45
Pipeline
#21660
passed with stages
in 11 minutes and 45 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
64 deletions
+83
-64
src/ui/Duel/Message/CardListModal.tsx
src/ui/Duel/Message/CardListModal.tsx
+17
-22
src/ui/Duel/Message/CardModal.tsx
src/ui/Duel/Message/CardModal.tsx
+3
-42
src/ui/Duel/Message/EffectButton.tsx
src/ui/Duel/Message/EffectButton.tsx
+63
-0
No files found.
src/ui/Duel/Message/CardListModal.tsx
View file @
122be474
import
{
Button
,
Drawer
,
List
}
from
"
antd
"
;
import
{
Drawer
,
List
}
from
"
antd
"
;
import
React
from
"
react
"
;
import
React
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
sendSelectIdleCmdResponse
}
from
"
@/api
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
import
{
messageStore
}
from
"
@/stores
"
;
clearAllIdleInteractivities
as
clearAllIdleInteractivities
,
messageStore
,
import
{
EffectButton
}
from
"
./EffectButton
"
;
}
from
"
@/stores
"
;
const
NeosConfig
=
useConfig
();
const
NeosConfig
=
useConfig
();
...
@@ -16,9 +14,9 @@ const CARD_WIDTH = 100;
...
@@ -16,9 +14,9 @@ const CARD_WIDTH = 100;
const
{
cardListModal
}
=
messageStore
;
const
{
cardListModal
}
=
messageStore
;
export
const
CardListModal
=
()
=>
{
export
const
CardListModal
=
()
=>
{
const
snap
CardListModal
=
useSnapshot
(
cardListModal
);
const
snap
=
useSnapshot
(
cardListModal
);
const
isOpen
=
snap
CardListModal
.
isOpen
;
const
isOpen
=
snap
.
isOpen
;
const
list
=
snap
CardListModal
.
list
as
typeof
cardListModal
.
list
;
const
list
=
snap
.
list
as
typeof
cardListModal
.
list
;
const
handleOkOrCancel
=
()
=>
{
const
handleOkOrCancel
=
()
=>
{
cardListModal
.
isOpen
=
false
;
cardListModal
.
isOpen
=
false
;
...
@@ -31,19 +29,12 @@ export const CardListModal = () => {
...
@@ -31,19 +29,12 @@ export const CardListModal = () => {
dataSource=
{
list
}
dataSource=
{
list
}
renderItem=
{
(
item
)
=>
(
renderItem=
{
(
item
)
=>
(
<
List
.
Item
<
List
.
Item
actions=
{
item
.
interactivies
.
map
((
interactivy
,
idx
)
=>
(
actions=
{
[
<
Button
<
EffectButton
key=
{
idx
}
effectInteractivies=
{
item
.
interactivies
}
onClick=
{
()
=>
{
meta=
{
item
.
meta
}
sendSelectIdleCmdResponse
(
interactivy
.
response
);
/>,
cardListModal
.
isOpen
=
false
;
]
}
clearAllIdleInteractivities
(
0
);
clearAllIdleInteractivities
(
1
);
}
}
>
{
interactivy
.
desc
}
</
Button
>
))
}
extra=
{
extra=
{
<
img
<
img
alt=
{
item
.
meta
?.
text
.
name
}
alt=
{
item
.
meta
?.
text
.
name
}
...
@@ -55,6 +46,10 @@ export const CardListModal = () => {
...
@@ -55,6 +46,10 @@ export const CardListModal = () => {
style=
{
{
width
:
CARD_WIDTH
}
}
style=
{
{
width
:
CARD_WIDTH
}
}
/>
/>
}
}
onClick=
{
()
=>
{
messageStore
.
cardModal
.
meta
=
item
.
meta
;
messageStore
.
cardModal
.
isOpen
=
true
;
}
}
>
>
<
List
.
Item
.
Meta
<
List
.
Item
.
Meta
title=
{
item
.
meta
?.
text
.
name
}
title=
{
item
.
meta
?.
text
.
name
}
...
...
src/ui/Duel/Message/CardModal.tsx
View file @
122be474
...
@@ -4,7 +4,7 @@ import classnames from "classnames";
...
@@ -4,7 +4,7 @@ import classnames from "classnames";
import
React
from
"
react
"
;
import
React
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
fetchStrings
,
getCardStr
,
sendSelectIdleCmdResponse
}
from
"
@/api
"
;
import
{
fetchStrings
,
sendSelectIdleCmdResponse
}
from
"
@/api
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
import
{
clearAllIdleInteractivities
as
clearAllIdleInteractivities
,
clearAllIdleInteractivities
as
clearAllIdleInteractivities
,
...
@@ -17,6 +17,7 @@ import {
...
@@ -17,6 +17,7 @@ import {
Race2StringCodeMap
,
Race2StringCodeMap
,
Type2StringCodeMap
,
Type2StringCodeMap
,
}
from
"
../../../common
"
;
}
from
"
../../../common
"
;
import
{
EffectButton
}
from
"
./EffectButton
"
;
const
{
cardModal
}
=
messageStore
;
const
{
cardModal
}
=
messageStore
;
const
NeosConfig
=
useConfig
();
const
NeosConfig
=
useConfig
();
...
@@ -84,47 +85,7 @@ export const CardModal = () => {
...
@@ -84,47 +85,7 @@ export const CardModal = () => {
</
button
>
</
button
>
);
);
})
}
})
}
{
effectInteractivies
.
length
>
0
?
(
<
EffectButton
meta=
{
meta
}
effectInteractivies=
{
effectInteractivies
}
/>
effectInteractivies
.
length
==
1
?
(
// 如果只有一个效果,点击直接触发
<
button
className=
"card-modal-btn"
onClick=
{
()
=>
{
sendSelectIdleCmdResponse
(
effectInteractivies
[
0
].
response
);
cardModal
.
isOpen
=
false
;
clearAllIdleInteractivities
(
0
);
clearAllIdleInteractivities
(
1
);
}
}
>
{
effectInteractivies
[
0
].
desc
}
</
button
>
)
:
(
// 如果有多个效果,点击后进入`OptionModal`选择
<
button
className=
"card-modal-btn"
onClick=
{
()
=>
{
for
(
const
effect
of
effectInteractivies
)
{
const
effectMsg
=
meta
&&
effect
.
effectCode
?
getCardStr
(
meta
,
effect
.
effectCode
&
0xf
)
??
"
[:?]
"
:
"
[:?]
"
;
messageStore
.
optionModal
.
options
.
push
({
msg
:
effectMsg
,
response
:
effect
.
response
,
});
}
cardModal
.
isOpen
=
false
;
clearAllIdleInteractivities
(
0
);
clearAllIdleInteractivities
(
1
);
messageStore
.
optionModal
.
isOpen
=
true
;
}
}
>
发动效果
</
button
>
)
)
:
(
<></>
)
}
</
div
>
</
div
>
</
div
>
</
div
>
);
);
...
...
src/ui/Duel/Message/EffectButton.tsx
0 → 100644
View file @
122be474
import
"
@/styles/card-modal.scss
"
;
import
React
from
"
react
"
;
import
{
CardMeta
,
getCardStr
,
sendSelectIdleCmdResponse
}
from
"
@/api
"
;
import
{
clearAllIdleInteractivities
as
clearAllIdleInteractivities
,
messageStore
,
}
from
"
@/stores
"
;
const
{
cardModal
}
=
messageStore
;
export
const
EffectButton
=
(
props
:
{
meta
?:
CardMeta
;
effectInteractivies
:
{
desc
:
string
;
response
:
number
;
effectCode
?:
number
;
}[];
})
=>
(
<>
{
props
.
effectInteractivies
.
length
>
0
?
(
props
.
effectInteractivies
.
length
==
1
?
(
// 如果只有一个效果,点击直接触发
<
button
className=
"card-modal-btn"
onClick=
{
()
=>
{
sendSelectIdleCmdResponse
(
props
.
effectInteractivies
[
0
].
response
);
cardModal
.
isOpen
=
false
;
clearAllIdleInteractivities
(
0
);
clearAllIdleInteractivities
(
1
);
}
}
>
{
props
.
effectInteractivies
[
0
].
desc
}
</
button
>
)
:
(
// 如果有多个效果,点击后进入`OptionModal`选择
<
button
className=
"card-modal-btn"
onClick=
{
()
=>
{
for
(
const
effect
of
props
.
effectInteractivies
)
{
const
effectMsg
=
props
.
meta
&&
effect
.
effectCode
?
getCardStr
(
props
.
meta
,
effect
.
effectCode
&
0xf
)
??
"
[:?]
"
:
"
[:?]
"
;
messageStore
.
optionModal
.
options
.
push
({
msg
:
effectMsg
,
response
:
effect
.
response
,
});
}
cardModal
.
isOpen
=
false
;
clearAllIdleInteractivities
(
0
);
clearAllIdleInteractivities
(
1
);
messageStore
.
optionModal
.
isOpen
=
true
;
}
}
>
发动效果
</
button
>
)
)
:
(
<></>
)
}
</>
);
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