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
5bbb6526
Commit
5bbb6526
authored
Jun 10, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add attack spring
parent
803137c9
Pipeline
#22177
failed with stages
in 13 minutes and 18 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
6 deletions
+32
-6
src/infra/eventbus.ts
src/infra/eventbus.ts
+1
-0
src/service/duel/attack.ts
src/service/duel/attack.ts
+3
-6
src/ui/Duel/PlayMat/Card/index.tsx
src/ui/Duel/PlayMat/Card/index.tsx
+14
-0
src/ui/Duel/PlayMat/Card/springs/attack.ts
src/ui/Duel/PlayMat/Card/springs/attack.ts
+13
-0
src/ui/Duel/PlayMat/Card/springs/index.ts
src/ui/Duel/PlayMat/Card/springs/index.ts
+1
-0
No files found.
src/infra/eventbus.ts
View file @
5bbb6526
...
...
@@ -6,6 +6,7 @@ const eventEmitter = new EventEmitter();
export
enum
Task
{
Move
=
"
move
"
,
Focus
=
"
focus
"
,
Attack
=
"
attack
"
,
}
const
getEnd
=
(
task
:
Task
)
=>
`
${
task
}
-end`
;
...
...
src/service/duel/attack.ts
View file @
5bbb6526
import
{
ygopro
}
from
"
@/api
"
;
import
{
eventbus
,
Task
}
from
"
@/infra
"
;
import
{
cardStore
,
fetchEsHintMeta
}
from
"
@/stores
"
;
export
default
async
(
attack
:
ygopro
.
StocGameMessage
.
MsgAttack
)
=>
{
...
...
@@ -15,7 +16,7 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
if
(
attacker
)
{
if
(
attack
.
direct_attack
)
{
// TODO: 实现直接攻击的动画
await
eventbus
.
call
(
Task
.
Attack
,
attacker
.
uuid
,
true
);
}
else
{
const
target
=
cardStore
.
at
(
attack
.
target_location
.
zone
,
...
...
@@ -23,11 +24,7 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
attack
.
target_location
.
sequence
);
if
(
target
)
{
// TODO: 实现攻击`target`的动画
}
else
{
console
.
warn
(
`<Attack>target from
${
attack
.
target_location
}
is null`
);
}
await
eventbus
.
call
(
Task
.
Attack
,
attacker
.
uuid
,
false
,
target
);
}
}
else
{
console
.
warn
(
`<Attack>attacker from
${
attack
.
attacker_location
}
is null`
);
...
...
src/ui/Duel/PlayMat/Card/index.tsx
View file @
5bbb6526
...
...
@@ -12,6 +12,7 @@ import { cardStore, CardType, messageStore } from "@/stores";
import
{
interactTypeToString
}
from
"
../../utils
"
;
import
{
attack
,
focus
,
moveToDeck
,
moveToGround
,
...
...
@@ -90,6 +91,19 @@ export const Card: FC<{ idx: number }> = React.memo(({ idx }) => {
await
addToAnimation
(()
=>
focus
({
card
:
state
,
api
}));
}
});
eventbus
.
register
(
Task
.
Attack
,
async
(
uuid
:
string
,
directAttack
:
boolean
,
target
?:
ygopro
.
CardLocation
)
=>
{
if
(
uuid
===
state
.
uuid
)
{
await
attack
({
card
:
state
,
api
,
target
,
directAttack
});
}
}
);
// <<< 动画 <<<
useEffect
(()
=>
{
...
...
src/ui/Duel/PlayMat/Card/springs/attack.ts
0 → 100644
View file @
5bbb6526
import
{
ygopro
}
from
"
@/api
"
;
import
{
CardType
}
from
"
@/stores
"
;
import
{
SpringApi
}
from
"
./types
"
;
export
const
attack
=
async
(
props
:
{
card
:
CardType
;
api
:
SpringApi
;
target
?:
ygopro
.
CardLocation
;
directAttack
:
boolean
;
})
=>
{
// TODO
};
src/ui/Duel/PlayMat/Card/springs/index.ts
View file @
5bbb6526
export
*
from
"
./attack
"
;
export
*
from
"
./focus
"
;
export
*
from
"
./moveToDeck
"
;
export
*
from
"
./moveToGround
"
;
...
...
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