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
15afe93f
Commit
15afe93f
authored
Aug 24, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: new select card modal 10%
parent
f87c4755
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
2 deletions
+59
-2
src/ui/Duel/Message/NewSelectCardsModal/index.tsx
src/ui/Duel/Message/NewSelectCardsModal/index.tsx
+57
-0
src/ui/Shared/Modal/index.tsx
src/ui/Shared/Modal/index.tsx
+2
-2
No files found.
src/ui/Duel/Message/NewSelectCardsModal/index.tsx
0 → 100644
View file @
15afe93f
import
{
Button
}
from
"
antd
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
CardType
,
matStore
}
from
"
@/stores
"
;
import
{
Footer
,
genModal
,
ReactFcWithOnResult
,
Title
}
from
"
@/ui/Shared
"
;
import
{
CardMeta
,
type
ygopro
}
from
"
@/api
"
;
interface
Props
{
min
:
number
;
max
:
number
;
single
:
boolean
;
selecteds
:
Option
[];
// 已经选择了的卡
selectables
:
Option
[];
// 最多选择多少卡
mustSelects
:
Option
[];
// 单选
cancelable
:
boolean
;
// 能否取消
finishable
:
boolean
;
// 选择足够了之后,能否确认
totalLevels
:
number
;
// 需要的总等级数(用于同调/仪式/...)
overflow
:
boolean
;
// 选择等级时候,是否可以溢出
}
interface
Result
{
result
:
Option
[];
}
export
interface
Option
{
// card id
meta
:
CardMeta
;
location
?:
ygopro
.
CardLocation
;
// 效果
effectDesc
?:
string
;
// 作为素材的cost,比如同调召唤的星级
level1
?:
number
;
level2
?:
number
;
response
?:
number
;
// 便于直接返回这个信息
card
?:
CardType
;
}
const
Content
:
ReactFcWithOnResult
<
Props
,
Result
>
=
({
min
,
max
,
single
,
selecteds
,
selectables
,
mustSelects
,
cancelable
,
finishable
,
totalLevels
,
overflow
,
onResult
,
})
=>
{
const
{
hint
}
=
useSnapshot
(
matStore
);
const
preHintMsg
=
hint
?.
esHint
??
""
;
return
<></>;
};
const
showSelectCardsModal
=
genModal
({
Content
});
src/ui/Shared/Modal/index.tsx
View file @
15afe93f
...
...
@@ -4,7 +4,7 @@ import { MinusOutlined, UpOutlined } from "@ant-design/icons";
import
styles
from
"
./index.module.scss
"
;
import
classNames
from
"
classnames
"
;
import
{
proxy
}
from
"
valtio
"
;
import
{
cloneElement
,
createElement
,
useState
}
from
"
react
"
;
/** 挂到某个节点去,在全局添加这几个静态方法 */
export
const
ModalContext
:
React
.
FC
=
()
=>
{
const
{
message
,
notification
,
modal
}
=
App
.
useApp
();
...
...
@@ -44,7 +44,7 @@ export const genModal = <Props extends {}, Result extends {}>({
Parameters
<
ModalFunc
>
[0],
"content" | "onCancel" | "onOk" | "footer" | "title"
>
) =
>
{
return
(
props
:
Props
)
=>
return
(
props
:
Props
)
:
Promise
<
Result
>
=>
new
Promise
<
Result
>
((
rs
)
=>
{
let
isMini
=
proxy
({
value
:
false
});
const
getClassNames
=
()
=>
...
...
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