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
Biluo Shen
Neos
Commits
dbd8e7e3
Commit
dbd8e7e3
authored
May 27, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/targeted' into 'main'
添加被取对象提示 See merge request
mycard/Neos!376
parents
595e4e0e
ccdeeb0c
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
67 additions
and
25 deletions
+67
-25
neos-assets/targeted.svg
neos-assets/targeted.svg
+7
-0
src/api/cards.ts
src/api/cards.ts
+21
-0
src/service/utils/fetchCheckCardMeta.ts
src/service/utils/fetchCheckCardMeta.ts
+1
-0
src/ui/Duel/Message/AnnounceModal/index.tsx
src/ui/Duel/Message/AnnounceModal/index.tsx
+6
-2
src/ui/Duel/Message/CardListModal/index.tsx
src/ui/Duel/Message/CardListModal/index.tsx
+1
-0
src/ui/Duel/Message/SelectCardsModal/index.tsx
src/ui/Duel/Message/SelectCardsModal/index.tsx
+9
-1
src/ui/Duel/Message/SortCardModal/index.tsx
src/ui/Duel/Message/SortCardModal/index.tsx
+1
-2
src/ui/Shared/YgoCard/index.module.scss
src/ui/Shared/YgoCard/index.module.scss
+9
-0
src/ui/Shared/YgoCard/index.tsx
src/ui/Shared/YgoCard/index.tsx
+12
-20
No files found.
neos-assets/targeted.svg
0 → 100644
View file @
dbd8e7e3
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
<svg
width=
"800px"
height=
"800px"
viewBox=
"0 0 24 24"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<g
id=
"SVGRepo_bgCarrier"
stroke-width=
"0"
/>
<g
id=
"SVGRepo_tracerCarrier"
stroke-linecap=
"round"
stroke-linejoin=
"round"
/>
<g
id=
"SVGRepo_iconCarrier"
>
<path
opacity=
"0.5"
d=
"M17 9.00195C19.175 9.01406 20.3529 9.11051 21.1213 9.8789C22 10.7576 22 12.1718 22 15.0002V16.0002C22 18.8286 22 20.2429 21.1213 21.1215C20.2426 22.0002 18.8284 22.0002 16 22.0002H8C5.17157 22.0002 3.75736 22.0002 2.87868 21.1215C2 20.2429 2 18.8286 2 16.0002L2 15.0002C2 12.1718 2 10.7576 2.87868 9.87889C3.64706 9.11051 4.82497 9.01406 7 9.00195"
stroke=
"#d9d9d9"
stroke-width=
"1.5"
stroke-linecap=
"round"
/>
<path
d=
"M12 2L12 15M12 15L9 11.5M12 15L15 11.5"
stroke=
"#d9d9d9"
stroke-width=
"1.5"
stroke-linecap=
"round"
stroke-linejoin=
"round"
/>
</g>
</svg>
\ No newline at end of file
src/api/cards.ts
View file @
dbd8e7e3
import
{
useConfig
}
from
"
@/config
"
;
import
sqliteMiddleWare
,
{
sqliteCmd
}
from
"
@/middleware/sqlite
"
;
import
sqliteMiddleWare
,
{
sqliteCmd
}
from
"
@/middleware/sqlite
"
;
import
{
FtsParams
}
from
"
@/middleware/sqlite/fts
"
;
import
{
FtsParams
}
from
"
@/middleware/sqlite/fts
"
;
import
{
isSuperReleaseCard
}
from
"
./superPreRelease
"
;
const
NeosConfig
=
useConfig
();
export
interface
CardMeta
{
export
interface
CardMeta
{
id
:
number
;
id
:
number
;
data
:
CardData
;
data
:
CardData
;
...
@@ -71,3 +76,19 @@ export function getCardStr(meta: CardMeta, idx: number): string | undefined {
...
@@ -71,3 +76,19 @@ export function getCardStr(meta: CardMeta, idx: number): string | undefined {
const
str
=
`str
${
idx
+
1
}
`
as
CardStrRange
;
const
str
=
`str
${
idx
+
1
}
`
as
CardStrRange
;
return
meta
.
text
[
str
];
return
meta
.
text
[
str
];
}
}
export
function
getCardImgUrl
(
code
:
number
,
back
=
false
)
{
const
ASSETS_BASE
=
import
.
meta
.
env
.
BASE_URL
===
"
/
"
?
NeosConfig
.
assetsPath
:
`
${
import
.
meta
.
env
.
BASE_URL
}${
NeosConfig
.
assetsPath
}
`
;
if
(
back
||
code
===
0
)
{
return
`
${
ASSETS_BASE
}
/card_back.jpg`
;
}
if
(
isSuperReleaseCard
(
code
))
{
return
`
${
NeosConfig
.
preReleaseImgUrl
}
/
${
code
}
.jpg`
;
}
else
{
return
`
${
NeosConfig
.
releaseImgUrl
}
/
${
code
}
.jpg`
;
}
}
src/service/utils/fetchCheckCardMeta.ts
View file @
dbd8e7e3
...
@@ -50,6 +50,7 @@ const helper = async (
...
@@ -50,6 +50,7 @@ const helper = async (
level2
,
level2
,
effectDesc
,
effectDesc
,
response
,
response
,
targeted
:
target
?.
targeted
,
};
};
if
(
selected
)
{
if
(
selected
)
{
...
...
src/ui/Duel/Message/AnnounceModal/index.tsx
View file @
dbd8e7e3
...
@@ -3,10 +3,14 @@ import { Avatar, Button, Checkbox, Input, List } from "antd";
...
@@ -3,10 +3,14 @@ import { Avatar, Button, Checkbox, Input, List } from "antd";
import
React
,
{
useState
}
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
CardMeta
,
searchCards
,
sendSelectOptionResponse
}
from
"
@/api
"
;
import
{
CardMeta
,
getCardImgUrl
,
searchCards
,
sendSelectOptionResponse
,
}
from
"
@/api
"
;
import
{
isDeclarable
,
isToken
}
from
"
@/common
"
;
import
{
isDeclarable
,
isToken
}
from
"
@/common
"
;
import
{
emptySearchConditions
}
from
"
@/middleware/sqlite/fts
"
;
import
{
emptySearchConditions
}
from
"
@/middleware/sqlite/fts
"
;
import
{
getCardImgUrl
}
from
"
@/ui/Shared
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
styles
from
"
./index.module.scss
"
;
import
styles
from
"
./index.module.scss
"
;
...
...
src/ui/Duel/Message/CardListModal/index.tsx
View file @
dbd8e7e3
...
@@ -56,6 +56,7 @@ export const CardListModal = () => {
...
@@ -56,6 +56,7 @@ export const CardListModal = () => {
<
YgoCard
<
YgoCard
code=
{
card
.
code
}
code=
{
card
.
code
}
key=
{
card
.
uuid
}
key=
{
card
.
uuid
}
targeted=
{
card
.
targeted
}
width=
{
CARD_WIDTH
}
width=
{
CARD_WIDTH
}
onClick=
{
()
=>
showCardModal
(
card
)
}
onClick=
{
()
=>
showCardModal
(
card
)
}
/>
/>
...
...
src/ui/Duel/Message/SelectCardsModal/index.tsx
View file @
dbd8e7e3
...
@@ -180,6 +180,7 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
...
@@ -180,6 +180,7 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
cover=
{
cover=
{
<
YgoCard
<
YgoCard
code=
{
card
.
meta
.
id
}
code=
{
card
.
meta
.
id
}
targeted=
{
card
.
targeted
}
className=
{
styles
.
card
}
className=
{
styles
.
card
}
/>
/>
}
}
...
@@ -217,7 +218,11 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
...
@@ -217,7 +218,11 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
<
div
>
<
div
>
<
Card
<
Card
cover=
{
cover=
{
<
YgoCard
code=
{
card
.
meta
.
id
}
className=
{
styles
.
card
}
/>
<
YgoCard
code=
{
card
.
meta
.
id
}
targeted=
{
card
.
targeted
}
className=
{
styles
.
card
}
/>
}
}
className=
{
styles
[
"
check-card
"
]
}
className=
{
styles
[
"
check-card
"
]
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
...
@@ -264,6 +269,9 @@ export interface Option {
...
@@ -264,6 +269,9 @@ export interface Option {
level1
?:
number
;
level1
?:
number
;
level2
?:
number
;
level2
?:
number
;
response
?:
number
;
response
?:
number
;
targeted
?:
boolean
;
// 便于直接返回这个信息
// 便于直接返回这个信息
//
// 尽量不要用这个字段
card
?:
CardType
;
card
?:
CardType
;
}
}
src/ui/Duel/Message/SortCardModal/index.tsx
View file @
dbd8e7e3
...
@@ -21,8 +21,7 @@ import React, { useEffect, useState } from "react";
...
@@ -21,8 +21,7 @@ import React, { useEffect, useState } from "react";
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
sendSortCardResponse
}
from
"
@/api
"
;
import
{
sendSortCardResponse
}
from
"
@/api
"
;
import
{
CardMeta
}
from
"
@/api/cards
"
;
import
{
CardMeta
,
getCardImgUrl
}
from
"
@/api/cards
"
;
import
{
getCardImgUrl
}
from
"
@/ui/Shared
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
...
...
src/ui/Shared/YgoCard/index.module.scss
View file @
dbd8e7e3
...
@@ -13,3 +13,12 @@
...
@@ -13,3 +13,12 @@
background-size
:
contain
;
background-size
:
contain
;
text-align
:
center
;
text-align
:
center
;
}
}
.targeted
{
position
:
relative
;
width
:
80%
;
height
:
80%
;
justify-content
:
center
;
z-index
:
2
;
pointer-events
:
none
;
}
src/ui/Shared/YgoCard/index.tsx
View file @
dbd8e7e3
import
classNames
from
"
classnames
"
;
import
classNames
from
"
classnames
"
;
import
{
CSSProperties
,
useMemo
}
from
"
react
"
;
import
{
CSSProperties
,
useMemo
}
from
"
react
"
;
import
{
isSuperReleaseCard
}
from
"
@/api
"
;
import
{
getCardImgUrl
}
from
"
@/api
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
styles
from
"
./index.module.scss
"
;
import
styles
from
"
./index.module.scss
"
;
const
{
assetsPath
}
=
useConfig
();
interface
Props
{
interface
Props
{
className
?:
string
;
className
?:
string
;
isBack
?:
boolean
;
isBack
?:
boolean
;
code
?:
number
;
code
?:
number
;
targeted
?:
boolean
;
// cardName?: string;
// cardName?: string;
style
?:
CSSProperties
;
style
?:
CSSProperties
;
width
?:
number
|
string
;
width
?:
number
|
string
;
...
@@ -23,6 +26,7 @@ export const YgoCard: React.FC<Props> = (props) => {
...
@@ -23,6 +26,7 @@ export const YgoCard: React.FC<Props> = (props) => {
code
=
0
,
code
=
0
,
// cardName,
// cardName,
isBack
=
false
,
isBack
=
false
,
targeted
=
false
,
width
,
width
,
style
,
style
,
onClick
,
onClick
,
...
@@ -45,27 +49,15 @@ export const YgoCard: React.FC<Props> = (props) => {
...
@@ -45,27 +49,15 @@ export const YgoCard: React.FC<Props> = (props) => {
>
>
{
/* 暂时不能这么写...但如果用onload的话来判断可能又很消耗性能,再看看吧 */
}
{
/* 暂时不能这么写...但如果用onload的话来判断可能又很消耗性能,再看看吧 */
}
{
/* {cardName} */
}
{
/* {cardName} */
}
{
targeted
?
(
<
div
className=
{
styles
.
targeted
}
>
<
img
src=
{
`${assetsPath}/targeted.svg`
}
/>
</
div
>
)
:
(
<></>
)
}
</
div
>
</
div
>
),
),
[
code
],
[
code
],
);
);
};
};
const
NeosConfig
=
useConfig
();
// TODO: 这个函数应该从这个文件抽离出来作为公共的函数使用
export
function
getCardImgUrl
(
code
:
number
,
back
=
false
)
{
const
ASSETS_BASE
=
import
.
meta
.
env
.
BASE_URL
===
"
/
"
?
NeosConfig
.
assetsPath
:
`
${
import
.
meta
.
env
.
BASE_URL
}${
NeosConfig
.
assetsPath
}
`
;
if
(
back
||
code
===
0
)
{
return
`
${
ASSETS_BASE
}
/card_back.jpg`
;
}
if
(
isSuperReleaseCard
(
code
))
{
return
`
${
NeosConfig
.
preReleaseImgUrl
}
/
${
code
}
.jpg`
;
}
else
{
return
`
${
NeosConfig
.
releaseImgUrl
}
/
${
code
}
.jpg`
;
}
}
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