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
93b891d6
Commit
93b891d6
authored
Dec 06, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: asyncLoadSpriteByUrl
parent
0959f380
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
op_01.js
assets/op_01/scene/op_01.js
+5
-3
No files found.
assets/op_01/scene/op_01.js
View file @
93b891d6
...
@@ -250,9 +250,11 @@ cc.Class({
...
@@ -250,9 +250,11 @@ cc.Class({
asyncLoadSpriteByUrl
(
node
,
url
)
{
asyncLoadSpriteByUrl
(
node
,
url
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
cc
.
loader
.
load
({
url
},
(
err
,
img
)
=>
{
cc
.
loader
.
load
({
url
},
(
err
,
img
)
=>
{
const
spriteFrame
=
new
cc
.
SpriteFrame
(
img
)
if
(
node
)
{
const
spr
=
node
.
getComponent
(
cc
.
Sprite
);
const
spriteFrame
=
new
cc
.
SpriteFrame
(
img
)
spr
.
spriteFrame
=
spriteFrame
;
const
spr
=
node
.
getComponent
(
cc
.
Sprite
);
spr
.
spriteFrame
=
spriteFrame
;
}
resolve
();
resolve
();
});
});
});
});
...
...
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