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
adf33d4a
Commit
adf33d4a
authored
Jun 20, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: cardModal complete
parent
8e04d9b4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
30 deletions
+51
-30
src/ui/Duel/Message/CardListModal.tsx
src/ui/Duel/Message/CardListModal.tsx
+3
-4
src/ui/Duel/Message/CardModal/index.tsx
src/ui/Duel/Message/CardModal/index.tsx
+40
-11
src/ui/Duel/Message/NewSelectActionModal/index.tsx
src/ui/Duel/Message/NewSelectActionModal/index.tsx
+4
-0
src/ui/Duel/PlayMat/Card/index.tsx
src/ui/Duel/PlayMat/Card/index.tsx
+4
-15
No files found.
src/ui/Duel/Message/CardListModal.tsx
View file @
adf33d4a
...
...
@@ -7,6 +7,8 @@ import { messageStore } from "@/stores";
import
{
EffectButton
}
from
"
./EffectButton
"
;
import
{
showCardModal
}
from
"
./CardModal
"
;
const
NeosConfig
=
useConfig
();
const
CARD_WIDTH
=
100
;
...
...
@@ -47,10 +49,7 @@ export const CardListModal = () => {
/>
}
onClick=
{
()
=>
{
messageStore
.
cardModal
.
meta
=
item
.
meta
;
messageStore
.
cardModal
.
interactivies
=
item
.
interactivies
;
messageStore
.
cardModal
.
counters
=
[];
messageStore
.
cardModal
.
isOpen
=
true
;
showCardModal
(
item
);
}
}
>
<
List
.
Item
.
Meta
...
...
src/ui/Duel/Message/CardModal/index.tsx
View file @
adf33d4a
...
...
@@ -2,11 +2,11 @@ import "@/styles/card-modal.scss";
import
classnames
from
"
classnames
"
;
import
React
,
{
FC
}
from
"
react
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
useSnapshot
,
proxy
}
from
"
valtio
"
;
import
{
fetchStrings
,
sendSelectIdleCmdResponse
}
from
"
@/api
"
;
import
{
fetchStrings
,
sendSelectIdleCmdResponse
,
type
CardMeta
}
from
"
@/api
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
cardStore
,
messageStore
}
from
"
@/stores
"
;
import
{
cardStore
,
messageStore
,
type
CardType
}
from
"
@/stores
"
;
import
{
Attribute2StringCodeMap
,
...
...
@@ -25,15 +25,33 @@ import { YgoCard } from "@/ui/Shared";
import
{
Desc
}
from
"
./Desc
"
;
const
{
cardModal
}
=
messageStore
;
const
NeosConfig
=
useConfig
();
const
CARD_WIDTH
=
140
;
const
{
Title
,
Paragraph
,
Text
,
Link
}
=
Typography
;
const
defaultStore
=
{
isOpen
:
false
,
meta
:
{
id
:
0
,
data
:
{},
text
:
{
name
:
""
,
desc
:
""
,
},
}
satisfies
CardMeta
as
CardMeta
,
interactivies
:
[]
as
{
desc
:
string
;
response
:
number
;
effectCode
?:
number
;
}[],
counters
:
{}
as
Record
<
number
,
number
>
,
};
const
store
=
proxy
(
defaultStore
);
export
const
CardModal
=
()
=>
{
const
snap
=
useSnapshot
(
cardModal
);
const
snap
=
useSnapshot
(
store
);
const
isOpen
=
snap
.
isOpen
;
const
meta
=
snap
.
meta
;
const
{
isOpen
,
meta
,
counters
}
=
snap
;
const
name
=
meta
?.
text
.
name
;
const
types
=
meta
?.
data
.
type
;
...
...
@@ -42,7 +60,6 @@ export const CardModal = () => {
const
desc
=
meta
?.
text
.
desc
;
const
atk
=
meta
?.
data
.
atk
;
const
def
=
meta
?.
data
.
def
;
const
counters
=
snap
.
counters
;
const
nonEffectInteractivies
=
snap
.
interactivies
.
filter
(
(
item
)
=>
item
.
desc
!=
"
发动效果
"
...
...
@@ -56,10 +73,9 @@ export const CardModal = () => {
<
Drawer
open=
{
isOpen
}
placement=
"left"
onClose=
{
()
=>
(
cardModal
.
isOpen
=
false
)
}
onClose=
{
()
=>
(
store
.
isOpen
=
false
)
}
rootClassName=
"card-modal-root"
className=
"card-modal-drawer"
headerStyle=
{
{}
}
mask=
{
false
}
title=
{
name
}
closeIcon=
{
<
LeftOutlined
/>
}
...
...
@@ -83,6 +99,7 @@ export const CardModal = () => {
attribute=
{
attribute
}
/>
{
/* TODO: 只有怪兽卡需要展示攻击防御 */
}
{
/* TODO: 展示星级/LINK数 */
}
{
/* <CounterLine counters={counters} /> */
}
</
Space
>
</
Space
>
...
...
@@ -168,3 +185,15 @@ const CounterLine = (props: { counters: { [type: number]: number } }) => {
</>
);
};
export
const
showCardModal
=
(
card
:
Partial
<
Pick
<
typeof
store
,
"
meta
"
|
"
counters
"
>>
)
=>
{
store
.
isOpen
=
true
;
store
.
meta
=
card
?.
meta
??
defaultStore
.
meta
;
store
.
counters
=
card
?.
counters
??
defaultStore
.
counters
;
};
export
const
closeCardModal
=
()
=>
{
store
.
isOpen
=
false
;
};
src/ui/Duel/Message/NewSelectActionModal/index.tsx
View file @
adf33d4a
...
...
@@ -28,6 +28,7 @@ import { groupBy } from "../../utils";
import
{
NeosModal
}
from
"
../NewModal
"
;
import
{
YgoCard
}
from
"
@/ui/Shared
"
;
import
"
./index.scss
"
;
import
{
showCardModal
}
from
"
../CardModal
"
;
const
CANCEL_RESPONSE
=
-
1
;
const
FINISH_RESPONSE
=
-
1
;
...
...
@@ -206,6 +207,9 @@ export const NewSelectActionsModal: FC = () => {
flexShrink
:
0
,
}
}
value=
{
card
}
onClick=
{
()
=>
{
showCardModal
(
card
);
}
}
/>
</
div
>
</
Tooltip
>
...
...
src/ui/Duel/PlayMat/Card/index.tsx
View file @
adf33d4a
...
...
@@ -22,7 +22,7 @@ import {
import
type
{
SpringApiProps
}
from
"
./springs/types
"
;
import
{
YgoCard
}
from
"
@/ui/Shared
"
;
import
{
showCardModal
}
from
"
@/ui/Duel/Message/CardModal
"
;
const
NeosConfig
=
useConfig
();
const
{
HAND
,
GRAVE
,
REMOVED
,
DECK
,
EXTRA
,
MZONE
,
SZONE
,
TZONE
}
=
...
...
@@ -173,20 +173,9 @@ export const Card: FC<{ idx: number }> = React.memo(({ idx }) => {
const
onCardClick
=
(
card
:
CardType
)
=>
{
// 中央弹窗展示选中卡牌信息
messageStore
.
cardModal
.
meta
=
{
id
:
card
.
code
,
text
:
card
.
meta
.
text
,
data
:
card
.
meta
.
data
,
};
messageStore
.
cardModal
.
interactivies
=
card
.
idleInteractivities
.
map
(
(
interactivity
)
=>
({
desc
:
interactTypeToString
(
interactivity
.
interactType
),
response
:
interactivity
.
response
,
effectCode
:
interactivity
.
activateIndex
,
})
);
messageStore
.
cardModal
.
counters
=
card
.
counters
;
messageStore
.
cardModal
.
isOpen
=
true
;
// TODO: 对方的卡片/未知的卡片,点击应该是没有效果的
// TODO: 同一张卡片,是否重复点击会关闭CardModal?
showCardModal
(
card
);
// 侧边栏展示超量素材信息
const
overlayMaterials
=
cardStore
.
findOverlay
(
...
...
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