Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cc_mz_007
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
cc_mz_007
Commits
2775e0f1
Commit
2775e0f1
authored
Feb 09, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test:
parent
e8504d2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
116 deletions
+36
-116
cc_mz_007.js
assets/cc_mz_007/scene/cc_mz_007.js
+36
-116
No files found.
assets/cc_mz_007/scene/cc_mz_007.js
View file @
2775e0f1
...
...
@@ -745,7 +745,7 @@ cc.Class({
return
;
}
middleLayerNode
.
getComponent
(
'
middleLayer
'
).
l
og
(
str
);
middleLayerNode
.
getComponent
(
'
middleLayer
'
).
showL
og
(
str
);
},
...
...
@@ -943,36 +943,6 @@ cc.Class({
curDragonDisplay
:
null
,
setStakeAnima
(
data
)
{
// const picNode = cc.find('Canvas/centerPart_2/frame/pic');
// // const rate = (this.hotZoneBg.scale * this.hotZoneBg.width) / this.data.bgItem.rect.width;
// const rectNode = new cc.Node();
// // rectNode.name = 'rect' + data.index;
// rectNode = picNode;
// const ctx = rectNode.addComponent(cc.Graphics);
// // 红色矩形
// ctx.lineWidth = 4;
// ctx.strokeColor = cc.Color.BLACK;
// ctx.fillColor = cc.Color.WHITE.setA(100);
// const scale = rate / this.hotZoneBg.scaleY;
// rectNode.width = data.rect.width * scale;
// rectNode.height = data.rect.height * scale;
// rectNode.x = -this.hotZoneBg.width / 2 + data.rect.x * scale;
// rectNode.y = this.hotZoneBg.height / 2 - data.rect.height * scale - data.rect.y * scale;
// rectNode.anchorX = rectNode.anchorY = 0;
// if (this.data.bgItem.isShowDebugLine) {
// ctx.rect(0, 0, rectNode.width, rectNode.height);
// }
// ctx.stroke();
// ctx.fill();
const
picNode
=
this
.
stake
;
console
.
log
(
'
data:
'
,
data
);
...
...
@@ -983,14 +953,6 @@ cc.Class({
animaNode
.
parent
=
picNode
;
picNode
.
animaNode
=
animaNode
;
// if (data.audio_url) {
// cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
// animaNode.audioClip = audioClip;
// });
// }
const
dragonDisplay
=
animaNode
.
addComponent
(
dragonBones
.
ArmatureDisplay
);
this
.
curDragonDisplay
=
dragonDisplay
;
...
...
@@ -1007,94 +969,52 @@ cc.Class({
return
;
}
setTimeout
(()
=>
{
cc
.
loader
.
load
(
image
,
(
error
,
texture
)
=>
{
cc
.
loader
.
load
({
url
:
atlas
,
type
:
'
txt
'
},
(
error
,
atlasJson
)
=>
{
cc
.
loader
.
load
({
url
:
ske
,
type
:
'
txt
'
},
(
error
,
dragonBonesJson
)
=>
{
const
atlas
=
new
dragonBones
.
DragonBonesAtlasAsset
();
atlas
.
atlasJson
=
atlasJson
;
atlas
.
texture
=
texture
;
const
asset
=
new
dragonBones
.
DragonBonesAsset
();
asset
.
dragonBonesJson
=
dragonBonesJson
;
// console.log(' texture: ', texture)
// console.log(' atlasJson: ', atlasJson)
// console.log(' dragonBonesJson: ', dragonBonesJson)
cc
.
loader
.
load
(
image
,
(
error
,
texture
)
=>
{
cc
.
loader
.
load
({
url
:
atlas
,
type
:
'
txt
'
},
(
error
,
atlasJson
)
=>
{
cc
.
loader
.
load
({
url
:
ske
,
type
:
'
txt
'
},
(
error
,
dragonBonesJson
)
=>
{
const
atlas
=
new
dragonBones
.
DragonBonesAtlasAsset
();
atlas
.
atlasJson
=
atlasJson
;
atlas
.
texture
=
texture
;
const
asset
=
new
dragonBones
.
DragonBonesAsset
();
asset
.
dragonBonesJson
=
dragonBonesJson
;
dragonDisplay
.
dragonAtlasAsset
=
atlas
;
dragonDisplay
.
dragonAsset
=
asset
;
dragonDisplay
.
dragonAtlasAsset
=
atlas
;
dragonDisplay
.
dragonAsset
=
asset
;
let
json
=
JSON
.
parse
(
asset
.
dragonBonesJson
);
let
armatures
=
json
[
"
armature
"
];
// console.log('armatures: ', armatures);
let
armatureNames
=
[];
for
(
let
i
=
0
;
i
<
armatures
.
length
;
i
++
)
{
armatureNames
.
push
(
armatures
[
i
].
name
);
let
json
=
JSON
.
parse
(
asset
.
dragonBonesJson
);
let
armatures
=
json
[
"
armature
"
];
// console.log('armatures: ', armatures);
let
armatureNames
=
[];
for
(
let
i
=
0
;
i
<
armatures
.
length
;
i
++
)
{
armatureNames
.
push
(
armatures
[
i
].
name
);
}
// console.log('armatureNames: ', armatureNames);
if
(
armatureNames
.
length
>
0
)
{
let
defaultArmatureName
=
armatureNames
[
0
];
dragonDisplay
.
armatureName
=
defaultArmatureName
;
// let animationNames = dragonDisplay.getAnimationNames(defaultArmatureName);
let
defaultArmature
=
armatures
[
0
];
let
animations
=
defaultArmature
.
animation
;
let
animationNames
=
[];
for
(
let
i
=
0
;
i
<
animations
.
length
;
i
++
)
{
animationNames
.
push
(
animations
[
i
].
name
);
}
// console.log('armatureNames: ', armatureNames);
if
(
armatureNames
.
length
>
0
)
{
let
defaultArmatureName
=
armatureNames
[
0
];
dragonDisplay
.
armatureName
=
defaultArmatureName
;
// let animationNames = dragonDisplay.getAnimationNames(defaultArmatureName);
let
defaultArmature
=
armatures
[
0
];
let
animations
=
defaultArmature
.
animation
;
let
animationNames
=
[];
for
(
let
i
=
0
;
i
<
animations
.
length
;
i
++
)
{
animationNames
.
push
(
animations
[
i
].
name
);
}
console
.
log
(
'
animationNames:
'
,
animationNames
.
toString
())
// rectNode.addComponent(cc.Button);
// rectNode.on('click', () => {
// if (rectNode.isClicked) {
// // return;
// }
// rectNode.isClicked = true;
// console.log('clicked');
// if (animaNode.audioClip) {
// cc.audioEngine.stopAll();
// cc.audioEngine.play(animaNode.audioClip, false, 0.8);
// }
// if (animationNames.length > 0) {
// dragonDisplay.playAnimation(animationNames[0], -1);
// }
// });
dragonDisplay
.
playAnimation
(
'
normal
'
,
-
1
);
dragonDisplay
.
animaNames
=
animationNames
;
animaNode
.
y
-=
30
;
console
.
log
(
'
animationNames:
'
,
animationNames
.
toString
())
if
(
animaNode
.
height
)
{
animaNode
.
scale
=
376
/
animaNode
.
height
;
}
dragonDisplay
.
playAnimation
(
'
normal
'
,
-
1
);
dragonDisplay
.
animaNames
=
animationNames
;
animaNode
.
y
-=
30
;
// animaNode.on('click', () => {
// console.log('anima node clicked ~~~');
// this.showDragonAnima();
// })
if
(
animaNode
.
height
)
{
animaNode
.
scale
=
376
/
animaNode
.
height
;
}
});
}
});
});
},
300
);
});
},
showDragonAnima
()
{
...
...
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