Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
FT_06
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
FT_06
Commits
926ee851
Commit
926ee851
authored
Oct 28, 2020
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: animeNode为空的check
parent
d75cd232
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
36 deletions
+24
-36
FT_06.js
play/assets/tmpGame/scene/FT_06.js
+22
-12
utils.js
play/assets/tmpGame/script/utils.js
+2
-24
No files found.
play/assets/tmpGame/scene/FT_06.js
View file @
926ee851
...
@@ -193,14 +193,6 @@ cc.Class({
...
@@ -193,14 +193,6 @@ cc.Class({
optionNode
.
x
=
posNode
.
x
*
optionPosListBase
.
scaleX
;
optionNode
.
x
=
posNode
.
x
*
optionPosListBase
.
scaleX
;
optionNode
.
y
=
posNode
.
y
;
optionNode
.
y
=
posNode
.
y
;
const
animeNode
=
await
asyncLoadDragonBoneAnime
(
cc
.
find
(
'
OptionDragonBoneBaseNode
'
,
optionNode
),
data
.
optionDragonBone
);
animeNode
.
scale
=
Math
.
min
(
260
/
animeNode
.
width
,
360
/
animeNode
.
height
,
1
);
animeNode
.
name
=
'
animeNode
'
;
animeNode
.
addComponent
(
cc
.
Button
);
animeNode
.
on
(
'
click
'
,
()
=>
{
this
.
onOptionClicked
(
optionNode
,
idx
);
});
const
btnFlower
=
cc
.
find
(
'
OptionSpeakerBtn/BtnFlower
'
,
optionNode
);
const
btnFlower
=
cc
.
find
(
'
OptionSpeakerBtn/BtnFlower
'
,
optionNode
);
const
btnFlowerP
=
cc
.
find
(
'
OptionSpeakerBtn/BtnFlower_P
'
,
optionNode
);
const
btnFlowerP
=
cc
.
find
(
'
OptionSpeakerBtn/BtnFlower_P
'
,
optionNode
);
const
optionSpeakerBtn
=
cc
.
find
(
'
OptionSpeakerBtn
'
,
optionNode
);
const
optionSpeakerBtn
=
cc
.
find
(
'
OptionSpeakerBtn
'
,
optionNode
);
...
@@ -218,11 +210,25 @@ cc.Class({
...
@@ -218,11 +210,25 @@ cc.Class({
blinkNode
(
optionNode
,
btnFlowerP
,
btnFlower
);
blinkNode
(
optionNode
,
btnFlowerP
,
btnFlower
);
await
asyncPlayEffectByUrl
(
data
.
optionAudio
);
await
asyncPlayEffectByUrl
(
data
.
optionAudio
);
const
animeNode
=
await
asyncLoadDragonBoneAnime
(
cc
.
find
(
'
OptionDragonBoneBaseNode
'
,
optionNode
),
data
.
optionDragonBone
);
if
(
animeNode
)
{
asyncPlayDragonBoneAnimation
(
animeNode
,
'
normal
'
,
1
);
asyncPlayDragonBoneAnimation
(
animeNode
,
'
normal
'
,
1
);
}
stopBlinkNode
(
optionNode
,
btnFlowerP
,
btnFlower
);
stopBlinkNode
(
optionNode
,
btnFlowerP
,
btnFlower
);
optionSpeakerBtn
.
canNotClick
=
false
;
optionSpeakerBtn
.
canNotClick
=
false
;
});
});
const
animeNode
=
await
asyncLoadDragonBoneAnime
(
cc
.
find
(
'
OptionDragonBoneBaseNode
'
,
optionNode
),
data
.
optionDragonBone
);
if
(
!
animeNode
)
{
return
;
}
animeNode
.
scale
=
Math
.
min
(
260
/
animeNode
.
width
,
360
/
animeNode
.
height
,
1
);
animeNode
.
name
=
'
animeNode
'
;
animeNode
.
addComponent
(
cc
.
Button
);
animeNode
.
on
(
'
click
'
,
()
=>
{
this
.
onOptionClicked
(
optionNode
,
idx
);
});
});
});
},
},
...
@@ -240,7 +246,9 @@ cc.Class({
...
@@ -240,7 +246,9 @@ cc.Class({
onOptionWrong
(
optionNode
)
{
onOptionWrong
(
optionNode
)
{
const
animeNode
=
cc
.
find
(
'
OptionDragonBoneBaseNode/animeNode
'
,
optionNode
);
const
animeNode
=
cc
.
find
(
'
OptionDragonBoneBaseNode/animeNode
'
,
optionNode
);
if
(
animeNode
)
{
animeNode
.
color
=
cc
.
color
(
150
,
150
,
150
,
255
);
animeNode
.
color
=
cc
.
color
(
150
,
150
,
150
,
255
);
}
playEffect
(
'
wrong
'
);
playEffect
(
'
wrong
'
);
},
},
...
@@ -264,9 +272,11 @@ cc.Class({
...
@@ -264,9 +272,11 @@ cc.Class({
if
(
option
!=
optionNode
)
{
if
(
option
!=
optionNode
)
{
const
animeNode
=
cc
.
find
(
'
OptionDragonBoneBaseNode/animeNode
'
,
option
);
const
animeNode
=
cc
.
find
(
'
OptionDragonBoneBaseNode/animeNode
'
,
option
);
if
(
animeNode
)
{
animeNode
.
color
=
cc
.
color
(
255
,
255
,
255
,
255
);
animeNode
.
color
=
cc
.
color
(
255
,
255
,
255
,
255
);
asyncPlayDragonBoneAnimation
(
animeNode
,
'
normal
'
,
-
1
);
asyncPlayDragonBoneAnimation
(
animeNode
,
'
normal
'
,
-
1
);
}
}
}
});
});
},
},
...
...
play/assets/tmpGame/script/utils.js
View file @
926ee851
...
@@ -247,7 +247,8 @@ export function addButtonListener(btnNode, func) {
...
@@ -247,7 +247,8 @@ export function addButtonListener(btnNode, func) {
export
async
function
asyncLoadDragonBoneAnime
(
node
,
{
skeJsonData
:
{
url
:
skeJsonDataUrl
},
texJsonData
:
{
url
:
texJsonDataUrl
},
texPngData
:
{
url
:
texPngDataUrl
}
})
{
export
async
function
asyncLoadDragonBoneAnime
(
node
,
{
skeJsonData
:
{
url
:
skeJsonDataUrl
},
texJsonData
:
{
url
:
texJsonDataUrl
},
texPngData
:
{
url
:
texPngDataUrl
}
})
{
if
(
!
texPngDataUrl
||
!
texJsonDataUrl
||
!
texPngDataUrl
)
{
if
(
!
texPngDataUrl
||
!
texJsonDataUrl
||
!
texPngDataUrl
||
texPngDataUrl
==
''
||
texJsonDataUrl
==
''
||
texPngDataUrl
==
''
)
{
return
;
return
;
}
}
...
@@ -263,29 +264,6 @@ export async function asyncLoadDragonBoneAnime(node, { skeJsonData: { url: skeJs
...
@@ -263,29 +264,6 @@ export async function asyncLoadDragonBoneAnime(node, { skeJsonData: { url: skeJs
const
dragonDisplay
=
animaNode
.
addComponent
(
dragonBones
.
ArmatureDisplay
);
const
dragonDisplay
=
animaNode
.
addComponent
(
dragonBones
.
ArmatureDisplay
);
// cc.assetManager.loadRemote(texPngDataUrl, (error, texture) => {
// cc.assetManager.loadAny({ url: texJsonDataUrl }, (error, atlasJson) => {
// cc.assetManager.loadAny({ url: skeJsonDataUrl }, (error, dragonBonesJson) => {
// const atlas = new dragonBones.DragonBonesAtlasAsset();
// atlas.atlasJson = JSON.stringify(atlasJson);
// atlas.texture = texture;
// const asset = new dragonBones.DragonBonesAsset();
// asset.dragonBonesJson = JSON.stringify(dragonBonesJson);
// dragonDisplay.dragonAtlasAsset = atlas;
// dragonDisplay.dragonAsset = asset;
// let armatureNames = dragonBonesJson.armature.map(data => data.name);
// if (armatureNames.length > 0) {
// dragonDisplay.armatureName = armatureNames[0];
// }
// resolve(animaNode);
// });
// });
// });
const
loadTexture
=
new
Promise
((
resolve
,
reject
)
=>
{
const
loadTexture
=
new
Promise
((
resolve
,
reject
)
=>
{
cc
.
assetManager
.
loadRemote
(
texPngDataUrl
,
(
error
,
texture
)
=>
{
cc
.
assetManager
.
loadRemote
(
texPngDataUrl
,
(
error
,
texture
)
=>
{
if
(
error
)
{
if
(
error
)
{
...
...
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