Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
op_01
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
op_01
Commits
c2787dca
Commit
c2787dca
authored
Sep 24, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: playDragonBoneAnimation
parent
1853fd32
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
op_01.js
play/assets/op_01/scene/op_01.js
+1
-1
util.js
play/assets/op_01/script/util.js
+33
-1
No files found.
play/assets/op_01/scene/op_01.js
View file @
c2787dca
import
{
onHomeworkFinish
,
playAudioByUrl
}
from
"
../script/util
"
;
import
{
onHomeworkFinish
,
playAudioByUrl
,
playDragonBoneAnimation
}
from
"
../script/util
"
;
import
{
defaultData
}
from
"
../script/defaultData
"
;
import
{
defaultData
}
from
"
../script/defaultData
"
;
cc
.
Class
({
cc
.
Class
({
...
...
play/assets/op_01/script/util.js
View file @
c2787dca
...
@@ -351,4 +351,36 @@ export function onHomeworkFinish() {
...
@@ -351,4 +351,36 @@ export function onHomeworkFinish() {
}
else
{
}
else
{
console
.
log
(
'
onHomeworkFinish
'
);
console
.
log
(
'
onHomeworkFinish
'
);
}
}
}
}
\ No newline at end of file
export
async
function
asyncPlayDragonBoneAnimation
(
node
,
animationName
,
time
=
1
,
onFrameEvent
=
null
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
armatureDisplay
=
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
armatureDisplay
.
timeScale
=
1
;
armatureDisplay
.
once
(
dragonBones
.
EventObject
.
COMPLETE
,
()
=>
{
resolve
();
});
armatureDisplay
.
on
(
dragonBones
.
EventObject
.
FRAME_EVENT
,
(
event
)
=>
{
if
(
onFrameEvent
)
{
onFrameEvent
(
event
);
}
});
armatureDisplay
.
playAnimation
(
animationName
,
time
);
});
}
export
function
playDragonBoneAnimation
(
node
,
animationName
,
time
=
1
,
onFinish
=
null
,
onFrameEvent
=
null
)
{
const
armatureDisplay
=
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
armatureDisplay
.
timeScale
=
1
;
armatureDisplay
.
once
(
dragonBones
.
EventObject
.
COMPLETE
,
()
=>
{
if
(
onFinish
)
{
onFinish
();
}
});
armatureDisplay
.
on
(
dragonBones
.
EventObject
.
FRAME_EVENT
,
(
event
)
=>
{
if
(
onFrameEvent
)
{
onFrameEvent
(
event
);
}
});
armatureDisplay
.
playAnimation
(
animationName
,
time
);
}
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