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
e62cf7c5
Commit
e62cf7c5
authored
Mar 30, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add checkCounterModal.tsx
parent
729e089c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
0 deletions
+79
-0
src/ui/Duel/checkCounterModal.tsx
src/ui/Duel/checkCounterModal.tsx
+77
-0
src/ui/Duel/main.tsx
src/ui/Duel/main.tsx
+2
-0
No files found.
src/ui/Duel/checkCounterModal.tsx
0 → 100644
View file @
e62cf7c5
import
{
Button
,
Row
,
Col
,
Card
,
InputNumber
}
from
"
antd
"
;
import
React
,
{
useRef
,
useState
}
from
"
react
"
;
import
{
sendSelectCounterResponse
}
from
"
../../api/ocgcore/ocgHelper
"
;
import
{
fetchStrings
}
from
"
../../api/strings
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
clearCheckCounter
}
from
"
../../reducers/duel/mod
"
;
import
{
selectCheckCounterModal
}
from
"
../../reducers/duel/modal/checkCounterModalSlice
"
;
import
{
store
}
from
"
../../store
"
;
import
DragModal
from
"
./dragModal
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
const
CheckCounterModal
=
()
=>
{
const
dispatch
=
store
.
dispatch
;
const
state
=
useAppSelector
(
selectCheckCounterModal
);
const
isOpen
=
state
.
isOpen
;
const
counterName
=
fetchStrings
(
"
!counter
"
,
`0x
${
state
.
counterType
!
}
`
);
const
min
=
state
.
min
||
0
;
const
options
=
state
.
options
;
const
[
selected
,
setSelected
]
=
useState
(
options
.
map
((
_
)
=>
0
));
const
finishable
=
selected
.
reduce
((
sum
,
current
)
=>
sum
+
current
,
0
)
==
min
;
const
draggleRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
onFinish
=
()
=>
{
sendSelectCounterResponse
(
selected
);
dispatch
(
clearCheckCounter
);
};
return
(
<
DragModal
modalProps=
{
{
title
:
`请移除${min}个${counterName}`
,
open
:
isOpen
,
closable
:
false
,
footer
:
(
<
Button
disabled=
{
!
finishable
}
onClick=
{
onFinish
}
>
finish
</
Button
>
),
}
}
dragRef=
{
draggleRef
}
draggable=
{
true
}
>
<
Row
>
{
options
.
map
((
option
,
idx
)
=>
{
return
(
<
Col
span=
{
4
}
key=
{
idx
}
>
<
Card
hoverable
style=
{
{
width
:
120
}
}
cover=
{
<
img
alt=
{
option
.
code
.
toString
()
}
src=
{
`${NeosConfig.cardImgUrl}/${option.code}.jpg`
}
/>
}
>
<
InputNumber
min=
{
0
}
max=
{
option
.
max
}
defaultValue=
{
0
}
onChange=
{
(
value
)
=>
{
setSelected
((
prev
)
=>
({
...
prev
,
[
idx
]:
value
||
0
,
}));
}
}
/>
</
Card
>
</
Col
>
);
})
}
</
Row
>
</
DragModal
>
);
};
export
default
CheckCounterModal
;
src/ui/Duel/main.tsx
View file @
e62cf7c5
...
@@ -27,6 +27,7 @@ import SendBox from "./sendBox";
...
@@ -27,6 +27,7 @@ import SendBox from "./sendBox";
import
PlayerStatus
from
"
./status
"
;
import
PlayerStatus
from
"
./status
"
;
import
Alert
from
"
./alert
"
;
import
Alert
from
"
./alert
"
;
import
CheckCardModalV3
from
"
./checkCardModalV3
"
;
import
CheckCardModalV3
from
"
./checkCardModalV3
"
;
import
CheckCounterModal
from
"
./checkCounterModal
"
;
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126
const
NeosDuel
=
()
=>
{
const
NeosDuel
=
()
=>
{
...
@@ -48,6 +49,7 @@ const NeosDuel = () => {
...
@@ -48,6 +49,7 @@ const NeosDuel = () => {
<
OptionModal
/>
<
OptionModal
/>
<
CheckCardModalV2
/>
<
CheckCardModalV2
/>
<
CheckCardModalV3
/>
<
CheckCardModalV3
/>
<
CheckCounterModal
/>
</>
</>
);
);
};
};
...
...
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