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
78a03e35
Commit
78a03e35
authored
Apr 28, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish AnnounceModal
parent
bcfa9ca4
Pipeline
#26760
passed with stages
in 8 minutes and 22 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
20 deletions
+36
-20
src/service/duel/announce.ts
src/service/duel/announce.ts
+3
-12
src/ui/Duel/Message/AnnounceModal/index.module.scss
src/ui/Duel/Message/AnnounceModal/index.module.scss
+0
-4
src/ui/Duel/Message/AnnounceModal/index.tsx
src/ui/Duel/Message/AnnounceModal/index.tsx
+33
-4
No files found.
src/service/duel/announce.ts
View file @
78a03e35
import
{
fetch
Card
,
fetch
Strings
,
Region
,
ygopro
}
from
"
@/api
"
;
import
{
fetchStrings
,
Region
,
ygopro
}
from
"
@/api
"
;
import
{
displayOptionModal
}
from
"
@/ui/Duel/Message
"
;
import
MsgAnnounce
=
ygopro
.
StocGameMessage
.
MsgAnnounce
;
import
{
displayAnnounceModal
}
from
"
@/ui/Duel/Message/AnnounceModal
"
;
export
default
async
(
announce
:
MsgAnnounce
)
=>
{
const
type_
=
announce
.
announce_type
;
...
...
@@ -38,17 +39,7 @@ export default async (announce: MsgAnnounce) => {
break
;
}
case
MsgAnnounce
.
AnnounceType
.
Card
:
{
const
options
=
[];
for
(
const
option
of
announce
.
options
)
{
const
meta
=
fetchCard
(
option
.
code
);
if
(
meta
.
text
.
name
)
{
options
.
push
({
info
:
meta
.
text
.
name
,
response
:
option
.
response
,
});
}
}
await
displayOptionModal
(
fetchStrings
(
Region
.
System
,
564
),
options
,
min
);
await
displayAnnounceModal
(
announce
.
options
.
map
((
option
)
=>
option
.
code
));
break
;
}
...
...
src/ui/Duel/Message/AnnounceModal/index.module.scss
View file @
78a03e35
...
...
@@ -5,8 +5,4 @@
.input
{
display
:
flex
;
}
.list
{
}
}
src/ui/Duel/Message/AnnounceModal/index.tsx
View file @
78a03e35
import
{
SearchOutlined
}
from
"
@ant-design/icons
"
;
import
{
Avatar
,
Button
,
Input
,
List
}
from
"
antd
"
;
import
{
Avatar
,
Button
,
Checkbox
,
Input
,
List
}
from
"
antd
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
CardMeta
,
searchCards
,
sendSelectOptionResponse
}
from
"
@/api
"
;
import
{
isToken
}
from
"
@/common
"
;
import
{
is
Declarable
,
is
Token
}
from
"
@/common
"
;
import
{
emptySearchConditions
}
from
"
@/middleware/sqlite/fts
"
;
import
{
getCardImgUrl
}
from
"
@/ui/Shared
"
;
...
...
@@ -36,8 +36,13 @@ export const AnnounceModal: React.FC = () => {
const
result
=
searchCards
({
query
:
searchWord
,
conditions
:
emptySearchConditions
,
}).
filter
((
card
)
=>
!
isToken
(
card
.
data
.
type
??
0
));
}).
filter
(
(
card
)
=>
isDeclarable
(
card
,
store
.
opcodes
)
&&
!
isToken
(
card
.
data
.
type
??
0
),
);
// 清掉之前选中的记录
setSelected
(
undefined
);
setCardList
(
result
);
};
const
onSummit
=
()
=>
{
...
...
@@ -84,7 +89,23 @@ export const AnnounceModal: React.FC = () => {
}
}
dataSource=
{
cardList
}
renderItem=
{
(
item
,
index
)
=>
(
<
List
.
Item
key=
{
index
}
>
<
List
.
Item
key=
{
index
}
actions=
{
[
<
Checkbox
checked=
{
item
.
id
===
selected
}
onClick=
{
()
=>
{
if
(
item
.
id
===
selected
)
{
// 之前选的就是这个,则取消选中
setSelected
(
undefined
);
}
else
{
// 选中
setSelected
(
item
.
id
);
}
}
}
/>,
]
}
>
<
List
.
Item
.
Meta
avatar=
{
<
Avatar
src=
{
getCardImgUrl
(
item
.
id
)
}
/>
}
title=
{
<
a
>
{
item
.
text
.
name
}
</
a
>
}
...
...
@@ -99,3 +120,11 @@ export const AnnounceModal: React.FC = () => {
};
let
rs
:
(
v
?:
any
)
=>
void
=
()
=>
{};
export
const
displayAnnounceModal
=
async
(
opcodes
:
number
[])
=>
{
store
.
opcodes
=
opcodes
;
store
.
isOpen
=
true
;
await
new
Promise
((
resolve
)
=>
(
rs
=
resolve
));
store
.
isOpen
=
false
;
store
.
opcodes
=
[];
};
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