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
647eaabc
Commit
647eaabc
authored
Mar 10, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "format"
This reverts commit
803df485
.
parent
d6372030
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
53 deletions
+55
-53
src/ui/Duel/PlayMat/Card/index.tsx
src/ui/Duel/PlayMat/Card/index.tsx
+0
-1
src/ui/Duel/PlayMat/Card/springs/attack.ts
src/ui/Duel/PlayMat/Card/springs/attack.ts
+9
-7
src/ui/Duel/PlayMat/Card/springs/moveToGround.ts
src/ui/Duel/PlayMat/Card/springs/moveToGround.ts
+21
-4
src/ui/Duel/PlayMat/Card/springs/moveToOutside.ts
src/ui/Duel/PlayMat/Card/springs/moveToOutside.ts
+3
-4
src/ui/Duel/PlayMat/Card/springs/types.ts
src/ui/Duel/PlayMat/Card/springs/types.ts
+0
-7
src/ui/Shared/YgoCard/index.tsx
src/ui/Shared/YgoCard/index.tsx
+22
-30
No files found.
src/ui/Duel/PlayMat/Card/index.tsx
View file @
647eaabc
...
...
@@ -54,7 +54,6 @@ export const Card: React.FC<{ idx: number }> = React.memo(({ idx }) => {
focusOpacity
:
1
,
subZ
:
0
,
opacity
:
1
,
config
:
{
mass
:
1
,
tension
:
800
,
friction
:
30
},
})
satisfies
SpringApiProps
,
);
...
...
src/ui/Duel/PlayMat/Card/springs/attack.ts
View file @
647eaabc
...
...
@@ -52,17 +52,16 @@ export const attack: AttackFunc = async (props) => {
z
:
200
,
});
// 后撤半个卡位,并调整倾斜角
//
await asyncStart(api)({
//
y:
//
current.y +
//
(BLOCK_HEIGHT_M / 2) * (isMe(card.location.controller) ? 1 : -1),
//
rz,
//
});
await
asyncStart
(
api
)({
y
:
current
.
y
+
(
BLOCK_HEIGHT_M
/
2
)
*
(
isMe
(
card
.
location
.
controller
)
?
1
:
-
1
),
rz
,
});
// 加速前冲
await
asyncStart
(
api
)({
x
,
y
,
rz
,
config
:
{
easing
:
easings
.
easeInOutSine
,
},
...
...
@@ -73,5 +72,8 @@ export const attack: AttackFunc = async (props) => {
y
:
current
.
y
,
z
:
current
.
z
,
rz
:
current
.
rz
,
config
:
{
easing
:
easings
.
easeInOutQuad
,
},
});
};
src/ui/Duel/PlayMat/Card/springs/moveToGround.ts
View file @
647eaabc
import
{
easings
}
from
"
@react-spring/web
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
isMe
}
from
"
@/stores
"
;
import
{
matConfig
}
from
"
@/ui/Shared
"
;
...
...
@@ -96,17 +98,32 @@ export const moveToGround: MoveFunc = async (props) => {
rz
,
height
:
0
,
});
}
else
{
await
asyncStart
(
api
)({
x
,
y
,
height
,
z
:
is_overlay
?
120
:
200
,
ry
,
rz
,
config
:
{
tension
:
250
,
clamp
:
true
,
easing
:
easings
.
easeOutSine
,
},
});
}
await
asyncStart
(
api
)({
height
,
x
,
y
,
z
:
0
,
ry
,
rz
,
subZ
:
isToken
?
100
:
0
,
zIndex
:
is_overlay
?
1
:
3
,
config
:
{
easing
:
easings
.
easeInQuad
,
duration
:
200
,
clamp
:
true
,
},
});
if
(
isToken
)
api
.
set
({
subZ
:
0
});
};
src/ui/Duel/PlayMat/Card/springs/moveToOutside.ts
View file @
647eaabc
...
...
@@ -32,10 +32,6 @@ export const moveToOutside: MoveFunc = async (props) => {
x
=
-
x
;
y
=
-
y
;
}
api
.
set
({
z
:
0
,
subZ
:
100
,
});
await
asyncStart
(
api
)({
x
,
y
,
...
...
@@ -45,6 +41,9 @@ export const moveToOutside: MoveFunc = async (props) => {
ry
:
[
ygopro
.
CardPosition
.
FACEDOWN
].
includes
(
position
)
?
180
:
0
,
subZ
:
100
,
zIndex
:
sequence
,
config
:
{
tension
:
140
,
},
});
api
.
set
({
subZ
:
0
});
};
src/ui/Duel/PlayMat/Card/springs/types.ts
View file @
647eaabc
...
...
@@ -20,13 +20,6 @@ export interface SpringApiProps {
// <<< focus
subZ
:
number
;
// 0 -> 100,这是为了让卡片移动过程中,稍微上浮一些,避免一些奇怪的遮挡问题
config
?:
Partial
<
{
mass
:
number
;
tension
:
number
;
friction
:
number
;
clamp
:
boolean
;
}
>
;
}
export
type
SpringApi
=
SpringRef
<
SpringApiProps
>
;
...
...
src/ui/Shared/YgoCard/index.tsx
View file @
647eaabc
import
classNames
from
"
classnames
"
;
import
{
CSSProperties
,
use
Effect
,
useState
}
from
"
react
"
;
import
{
CSSProperties
,
use
Memo
}
from
"
react
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
isSuperReleaseCard
}
from
"
@/superPreRelease
"
;
...
...
@@ -21,41 +21,33 @@ export const YgoCard: React.FC<Props> = (props) => {
const
{
className
,
code
=
0
,
// cardName,
isBack
=
false
,
width
,
style
,
onClick
,
onLoad
,
}
=
props
;
const
[
src
,
setSrc
]
=
useState
(
"
https://img2.imgtp.com/2024/03/06/G6wTJRz9.png
"
,
);
useEffect
(()
=>
{
const
img
=
new
Image
();
img
.
onload
=
()
=>
{
console
.
timeEnd
(
code
.
toString
());
setSrc
(
img
.
src
);
// 图片加载完成后更新src状态
};
// 直接设置图片路径,无需url()包裹
img
.
src
=
getCardImgUrl
(
code
,
isBack
);
console
.
time
(
code
.
toString
());
},
[
code
,
isBack
]);
// useEffect的依赖数组中加入isBack
return
(
<
div
className=
{
classNames
(
styles
[
"
ygo-card
"
],
className
)
}
style=
{
{
width
,
"
--src
"
:
`url(${src})`
,
...
style
,
}
as
any
}
onClick=
{
onClick
}
onLoad=
{
onLoad
}
></
div
>
return
useMemo
(
()
=>
(
<
div
className=
{
classNames
(
styles
[
"
ygo-card
"
],
className
)
}
style=
{
{
width
,
"
--src
"
:
`url(${getCardImgUrl(code, isBack)})`
,
...
style
,
}
as
any
}
onClick=
{
onClick
}
// 加载完成
onLoad=
{
onLoad
}
>
{
/* 暂时不能这么写...但如果用onload的话来判断可能又很消耗性能,再看看吧 */
}
{
/* {cardName} */
}
</
div
>
),
[
code
],
);
};
...
...
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