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
b31c944e
Commit
b31c944e
authored
May 28, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: chaining animation
parent
52e966b5
Pipeline
#21961
passed with stages
in 19 minutes and 3 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
54 additions
and
14 deletions
+54
-14
src/env.d.ts
src/env.d.ts
+1
-0
src/service/duel/chaining.ts
src/service/duel/chaining.ts
+1
-0
src/ui/Duel/NewPlayMat/Card/index.tsx
src/ui/Duel/NewPlayMat/Card/index.tsx
+21
-8
src/ui/Duel/NewPlayMat/Card/springs/chaining.ts
src/ui/Duel/NewPlayMat/Card/springs/chaining.ts
+24
-0
src/ui/Duel/NewPlayMat/Card/springs/index.ts
src/ui/Duel/NewPlayMat/Card/springs/index.ts
+5
-4
src/ui/Duel/NewPlayMat/Card/springs/moveToDeck.ts
src/ui/Duel/NewPlayMat/Card/springs/moveToDeck.ts
+0
-0
src/ui/Duel/NewPlayMat/Card/springs/moveToGround.ts
src/ui/Duel/NewPlayMat/Card/springs/moveToGround.ts
+0
-0
src/ui/Duel/NewPlayMat/Card/springs/moveToHand.ts
src/ui/Duel/NewPlayMat/Card/springs/moveToHand.ts
+1
-1
src/ui/Duel/NewPlayMat/Card/springs/moveToOutside.ts
src/ui/Duel/NewPlayMat/Card/springs/moveToOutside.ts
+0
-0
src/ui/Duel/NewPlayMat/Card/springs/utils.ts
src/ui/Duel/NewPlayMat/Card/springs/utils.ts
+1
-1
No files found.
src/env.d.ts
View file @
b31c944e
...
...
@@ -20,6 +20,7 @@ declare global {
var
myExtraDeckCodes
:
number
[];
enum
Report
{
Move
=
"
move
"
,
Chaining
=
"
chaining
"
,
}
interface
Console
{
color
:
(
...
...
src/service/duel/chaining.ts
View file @
b31c944e
...
...
@@ -22,6 +22,7 @@ export default async (chaining: ygopro.StocGameMessage.MsgChaining) => {
const
target
=
cardStore
.
find
(
location
);
if
(
target
)
{
target
.
chainIndex
=
matStore
.
chains
.
length
;
eventBus
.
emit
(
Report
.
Chaining
,
target
.
uuid
);
}
else
{
console
.
warn
(
`<Chaining>target from
${
location
}
is null`
);
}
...
...
src/ui/Duel/NewPlayMat/Card/index.tsx
View file @
b31c944e
...
...
@@ -10,7 +10,13 @@ import { useConfig } from "@/config";
import
{
cardStore
,
CardType
,
messageStore
}
from
"
@/stores
"
;
import
{
interactTypeToString
}
from
"
../../utils
"
;
import
{
moveToDeck
,
moveToGround
,
moveToHand
,
moveToOutside
}
from
"
./springs
"
;
import
{
moveToDeck
,
moveToGround
,
moveToHand
,
moveToOutside
,
chaining
,
}
from
"
./springs
"
;
const
NeosConfig
=
useConfig
();
...
...
@@ -50,8 +56,12 @@ export const Card: FC<{ idx: number }> = React.memo(({ idx }) => {
case
REMOVED
:
await
moveToOutside
({
card
:
state
,
api
});
break
;
case
TZONE
:
// TODO: 衍生物直接消散
break
;
}
};
useEffect
(()
=>
{
move
(
state
.
zone
);
},
[]);
...
...
@@ -62,14 +72,17 @@ export const Card: FC<{ idx: number }> = React.memo(({ idx }) => {
/** 动画序列的promise,当不是undefined,就说明现在这个卡有动画 */
let
animation
:
Promise
<
void
>
|
undefined
=
undefined
;
eventBus
.
on
(
Report
.
Move
,
(
uuid
)
=>
{
eventBus
.
on
(
Report
.
Move
,
(
uuid
:
string
)
=>
{
if
(
uuid
===
state
.
uuid
)
{
if
(
animation
)
{
// 当前有动画,move等当前动画完成之后再播放
animation
=
animation
.
then
(()
=>
move
(
state
.
zone
));
}
else
{
animation
=
move
(
state
.
zone
);
}
const
p
=
move
(
state
.
zone
);
animation
=
animation
?
animation
.
then
(()
=>
p
)
:
p
;
}
});
eventBus
.
on
(
Report
.
Chaining
,
(
uuid
:
string
)
=>
{
if
(
uuid
===
state
.
uuid
)
{
const
p
=
chaining
({
card
:
state
,
api
});
animation
=
animation
?
animation
.
then
(()
=>
p
)
:
p
;
}
});
...
...
src/ui/Duel/NewPlayMat/Card/springs/chaining.ts
0 → 100644
View file @
b31c944e
import
{
easings
}
from
"
@react-spring/web
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
type
CardType
,
isMe
,
matStore
}
from
"
@/stores
"
;
import
{
matConfig
}
from
"
../../utils
"
;
import
{
SpringApi
}
from
"
./types
"
;
import
{
asyncStart
}
from
"
./utils
"
;
/** 发动效果的动画 */
export
const
chaining
=
async
(
props
:
{
card
:
CardType
;
api
:
SpringApi
})
=>
{
const
{
card
,
api
}
=
props
;
const
current
=
api
.
current
[
0
].
get
();
if
(
card
.
zone
===
ygopro
.
CardZone
.
HAND
)
{
await
asyncStart
(
api
)({
y
:
current
.
y
+
(
matStore
.
isMe
(
card
.
controller
)
?
-
1
:
1
)
*
200
,
// TODO: 放到config之中
rz
:
0
,
});
await
asyncStart
(
api
)({
y
:
current
.
y
,
rz
:
current
.
rz
});
}
else
{
await
asyncStart
(
api
)({
z
:
200
});
await
asyncStart
(
api
)({
z
:
current
.
z
});
}
};
src/ui/Duel/NewPlayMat/Card/springs/index.ts
View file @
b31c944e
export
*
from
"
./toDeck
"
;
export
*
from
"
./toGround
"
;
export
*
from
"
./toHand
"
;
export
*
from
"
./toOutside
"
;
export
*
from
"
./moveToDeck
"
;
export
*
from
"
./moveToGround
"
;
export
*
from
"
./moveToHand
"
;
export
*
from
"
./moveToOutside
"
;
export
*
from
"
./chaining
"
;
src/ui/Duel/NewPlayMat/Card/springs/
t
oDeck.ts
→
src/ui/Duel/NewPlayMat/Card/springs/
moveT
oDeck.ts
View file @
b31c944e
File moved
src/ui/Duel/NewPlayMat/Card/springs/
t
oGround.ts
→
src/ui/Duel/NewPlayMat/Card/springs/
moveT
oGround.ts
View file @
b31c944e
File moved
src/ui/Duel/NewPlayMat/Card/springs/
t
oHand.ts
→
src/ui/Duel/NewPlayMat/Card/springs/
moveT
oHand.ts
View file @
b31c944e
import
{
easings
}
from
"
@react-spring/web
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
cardStore
,
type
CardType
,
isM
e
}
from
"
@/stores
"
;
import
{
type
CardType
,
isMe
,
cardStor
e
}
from
"
@/stores
"
;
import
{
matConfig
}
from
"
../../utils
"
;
import
{
SpringApi
}
from
"
./types
"
;
...
...
src/ui/Duel/NewPlayMat/Card/springs/
t
oOutside.ts
→
src/ui/Duel/NewPlayMat/Card/springs/
moveT
oOutside.ts
View file @
b31c944e
File moved
src/ui/Duel/NewPlayMat/Card/springs/utils.ts
View file @
b31c944e
import
{
type
SpringConfig
,
type
SpringRef
}
from
"
@react-spring/web
"
;
export
const
asyncStart
=
<
T
extends
{}
>
(
api
:
SpringRef
<
T
>
)
=>
{
return
(
p
:
Partial
<
T
>
&
{
config
:
SpringConfig
})
=>
return
(
p
:
Partial
<
T
>
&
{
config
?
:
SpringConfig
})
=>
new
Promise
((
resolve
)
=>
{
api
.
start
({
...
p
,
...
...
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