Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
FT_12
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_12
Commits
ef8179ed
Commit
ef8179ed
authored
Dec 24, 2020
by
asdf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
done
parent
59a9142a
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
16213 additions
and
12682 deletions
+16213
-12682
anims.meta
play/assets/tmpGame/anims.meta
+1
-1
anim_tryagain.anim
play/assets/tmpGame/anims/anim_tryagain.anim
+47
-0
anim_tryagain.anim.meta
play/assets/tmpGame/anims/anim_tryagain.anim.meta
+5
-0
LayerFive.prefab
play/assets/tmpGame/prefabs/LayerFive.prefab
+6410
-0
LayerFive.prefab.meta
play/assets/tmpGame/prefabs/LayerFive.prefab.meta
+8
-0
LayerOver.prefab
play/assets/tmpGame/prefabs/LayerOver.prefab
+8
-4
LayerSeven.prefab
play/assets/tmpGame/prefabs/LayerSeven.prefab
+8928
-0
LayerSeven.prefab.meta
play/assets/tmpGame/prefabs/LayerSeven.prefab.meta
+8
-0
LayerTryagain.prefab
play/assets/tmpGame/prefabs/LayerTryagain.prefab
+400
-0
LayerTryagain.prefab.meta
play/assets/tmpGame/prefabs/LayerTryagain.prefab.meta
+8
-0
Scene.fire
play/assets/tmpGame/scene/Scene.fire
+176
-12612
ItemAnswer.js
play/assets/tmpGame/script/ItemAnswer.js
+86
-12
Scene.js
play/assets/tmpGame/script/Scene.js
+128
-53
No files found.
play/assets/tmpGame/anim
ation
s.meta
→
play/assets/tmpGame/anims.meta
View file @
ef8179ed
{
"ver": "1.1.2",
"uuid": "
baa17bd2-3214-41ed-8a86-f64677160ad1
",
"uuid": "
36abc766-60c3-40c3-965f-8232c750d9db
",
"isBundle": false,
"bundleName": "",
"priority": 1,
...
...
play/assets/tmpGame/anims/anim_tryagain.anim
0 → 100644
View file @
ef8179ed
{
"__type__": "cc.AnimationClip",
"_name": "anim_tryagain",
"_objFlags": 0,
"_native": "",
"_duration": 0.08333333333333333,
"sample": 60,
"speed": 0.5,
"wrapMode": 1,
"curveData": {
"paths": {
"try_again": {
"props": {
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
}
},
{
"frame": 0.08333333333333333,
"value": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
}
}
],
"angle": [
{
"frame": 0,
"value": 67
},
{
"frame": 0.08333333333333333,
"value": 0
}
]
}
}
}
},
"events": []
}
\ No newline at end of file
play/assets/tmpGame/anims/anim_tryagain.anim.meta
0 → 100644
View file @
ef8179ed
{
"ver": "2.1.0",
"uuid": "d8c5380d-37f7-4077-a13a-83c40acb5270",
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/prefabs/LayerFive.prefab
0 → 100644
View file @
ef8179ed
This diff is collapsed.
Click to expand it.
play/assets/tmpGame/prefabs/LayerFive.prefab.meta
0 → 100644
View file @
ef8179ed
{
"ver": "1.2.7",
"uuid": "d0bbc3e4-1049-4c6e-acd5-5e98b8b1d919",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/prefabs/LayerOver.prefab
View file @
ef8179ed
...
...
@@ -266,8 +266,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width":
98
1,
"height":
332
"width":
83
1,
"height":
147
},
"_anchorPoint": {
"__type__": "cc.Vec2",
...
...
@@ -318,7 +318,9 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_spriteFrame": {
"__uuid__": "f71e311f-c5c6-41d5-a4fc-2c059466b6cb"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
...
...
@@ -875,7 +877,9 @@
"__id__": 1
},
"_enabled": true,
"audOver": null,
"audOver": {
"__uuid__": "90b82b64-80fd-47f9-bfb4-5040cb380e10"
},
"_id": ""
},
{
...
...
play/assets/tmpGame/prefabs/LayerSeven.prefab
0 → 100644
View file @
ef8179ed
This diff is collapsed.
Click to expand it.
play/assets/tmpGame/prefabs/LayerSeven.prefab.meta
0 → 100644
View file @
ef8179ed
{
"ver": "1.2.7",
"uuid": "88f15fa0-f590-4044-949c-b337e6a0b06f",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/prefabs/LayerTryagain.prefab
0 → 100644
View file @
ef8179ed
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "LayerTryagain",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 7
}
],
"_active": true,
"_components": [
{
"__id__": 10
},
{
"__id__": 11
}
],
"_prefab": {
"__id__": 12
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
640,
360,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "New Sprite(Splash)",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 4
},
{
"__id__": 5
}
],
"_prefab": {
"__id__": 6
},
"_opacity": 116,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.BlockInputEvents",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "691a13e4-7edf-4b61-aea4-dbb03cab0683"
},
"fileId": "cek8AJ1MVK2KRobwLsREFo",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "try_again",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 8
}
],
"_prefab": {
"__id__": 9
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 871,
"height": 156
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
0,
0,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "57881bfb-e62e-47ce-bd3a-a5ddac7263b8"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "691a13e4-7edf-4b61-aea4-dbb03cab0683"
},
"fileId": "0cD0tS5WZKPKmwll1tkTYD",
"sync": false
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_defaultClip": {
"__uuid__": "d8c5380d-37f7-4077-a13a-83c40acb5270"
},
"_clips": [
{
"__uuid__": "d8c5380d-37f7-4077-a13a-83c40acb5270"
}
],
"playOnLoad": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "691a13e4-7edf-4b61-aea4-dbb03cab0683"
},
"fileId": "5ckqtmVohCXqnkLS1LiOq1",
"sync": false
}
]
\ No newline at end of file
play/assets/tmpGame/prefabs/LayerTryagain.prefab.meta
0 → 100644
View file @
ef8179ed
{
"ver": "1.2.7",
"uuid": "691a13e4-7edf-4b61-aea4-dbb03cab0683",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/scene/Scene.fire
View file @
ef8179ed
This diff is collapsed.
Click to expand it.
play/assets/tmpGame/script/ItemAnswer.js
View file @
ef8179ed
...
...
@@ -12,6 +12,12 @@ cc.Class({
},
onLoad
()
{
if
(
this
.
startPos
){
this
.
node
.
position
=
this
.
startPos
;
this
.
node
.
scale
=
this
.
startScale
;
}
this
.
startPos
=
this
.
node
.
position
;
this
.
startScale
=
this
.
node
.
scale
;
this
.
nodLight
=
this
.
node
.
getChildByName
(
'
light
'
);
this
.
nodMask
=
this
.
node
.
getChildByName
(
'
mask
'
);
this
.
btnAudio
=
this
.
node
.
getChildByName
(
'
btnAudio
'
);
...
...
@@ -19,6 +25,8 @@ cc.Class({
this
.
sprAudio
=
this
.
btnAudio
.
getChildByName
(
'
sprAudio
'
).
getComponent
(
cc
.
Sprite
);
this
.
label
=
this
.
node
.
getChildByName
(
'
label
'
).
getComponent
(
cc
.
Label
);
this
.
nodCross
=
this
.
node
.
getChildByName
(
'
cross
'
);
this
.
labelMask
=
this
.
node
.
getChildByName
(
'
labelMask
'
);
this
.
labelGreen
=
this
.
labelMask
.
getChildByName
(
'
labelGreen
'
).
getComponent
(
cc
.
Label
);
this
.
nodCross
.
active
=
false
;
},
...
...
@@ -35,6 +43,10 @@ cc.Class({
EventMgr
.
off
(
'
showAudioButton
'
,
this
.
showAudioButton
,
this
);
},
onTouchStart
()
{
if
(
GameData
.
_showDragonbones
)
{
this
.
playLabelGreen
();
return
;
}
if
(
!
GameData
.
startStepDone
)
{
return
;
}
...
...
@@ -50,6 +62,7 @@ cc.Class({
showAudioButton
()
{
this
.
nodMask
.
runAction
(
cc
.
fadeOut
(
1
))
this
.
btnAudio
.
active
=
true
;
this
.
playShowAudioButton
();
},
init
()
{
this
.
nodLight
.
active
=
false
;
...
...
@@ -65,6 +78,11 @@ cc.Class({
this
.
loadDragonBone
();
this
.
label
.
string
=
data
.
text
;
this
.
labelGreen
.
string
=
data
.
text
;
this
.
scheduleOnce
(()
=>
{
this
.
labelMask
.
x
=
this
.
label
.
node
.
x
-
this
.
label
.
node
.
width
/
2
;
this
.
labelMask
.
y
=
this
.
label
.
node
.
y
;
})
},
loadDragonBone
()
{
this
.
dragonBone
.
dragonAtlasAsset
=
null
;
...
...
@@ -73,9 +91,12 @@ cc.Class({
var
imageUrl
=
this
.
data
.
optionDragonBone
.
texPngData
.
url
;
var
skeUrl
=
this
.
data
.
optionDragonBone
.
skeJsonData
.
url
;
var
atlasUrl
=
this
.
data
.
optionDragonBone
.
texJsonData
.
url
;
imageUrl
=
'
http://127.0.0.1/NewProject_2_tex.png
'
;
skeUrl
=
'
http://127.0.0.1/NewProject_2_ske.json
'
;
atlasUrl
=
'
http://127.0.0.1/NewProject_2_tex.json
'
;
// imageUrl = 'http://127.0.0.1/NewProject_2_tex.png';
// skeUrl = 'http://127.0.0.1/NewProject_2_ske.json';
// atlasUrl = 'http://127.0.0.1/NewProject_2_tex.json';
imageUrl
=
'
http://127.0.0.1/walkingfish_tex.png
'
;
skeUrl
=
'
http://127.0.0.1/walkingfish_ske.json
'
;
atlasUrl
=
'
http://127.0.0.1/walkingfish_tex.json
'
;
cc
.
assetManager
.
loadAny
([{
url
:
atlasUrl
,
ext
:
'
.txt
'
},
{
url
:
skeUrl
,
ext
:
'
.txt
'
}],
(
error
,
assets
)
=>
{
if
(
error
)
{
console
.
log
(
error
)
...
...
@@ -126,8 +147,8 @@ cc.Class({
let
id
=
cc
.
audioEngine
.
play
(
this
.
audRight
,
false
,
1
);
cc
.
audioEngine
.
setFinishCallback
(
id
,
()
=>
{
GameData
.
audioCount
--
;
this
.
scene
.
onClickAnswer
(
this
,
this
.
isRight
);
})
this
.
scene
.
onClickAnswer
(
this
,
this
.
isRight
);
},
playAudioWrong
()
{
GameData
.
audioCount
++
;
...
...
@@ -146,7 +167,21 @@ cc.Class({
cc
.
sequence
(
cc
.
scaleTo
(
0.2
,
1.2
),
cc
.
scaleTo
(
0.4
,
0
),
cc
.
callFunc
(()
=>
{
cc
.
callFunc
(()
=>
{
})
)
)
},
playShowAudioButton
()
{
this
.
btnAudio
.
runAction
(
cc
.
sequence
(
cc
.
callFunc
(()
=>
{
this
.
btnAudio
.
scale
=
0
;
}),
cc
.
scaleTo
(
0.4
,
1.2
),
cc
.
scaleTo
(
0.2
,
1
),
cc
.
callFunc
(()
=>
{
})
)
...
...
@@ -159,7 +194,7 @@ cc.Class({
cc
.
sequence
(
cc
.
scaleTo
(
0.1
,
1.2
),
cc
.
scaleTo
(
0.2
,
1
),
cc
.
callFunc
(()
=>
{
cc
.
callFunc
(()
=>
{
this
.
playHideCross
();
})
)
...
...
@@ -171,7 +206,7 @@ cc.Class({
cc
.
sequence
(
cc
.
scaleTo
(
0.2
,
1.2
),
cc
.
scaleTo
(
0.4
,
0
),
cc
.
callFunc
(()
=>
{
cc
.
callFunc
(()
=>
{
this
.
playAnswerDown
();
})
)
...
...
@@ -181,11 +216,47 @@ cc.Class({
playAnswerDown
()
{
this
.
node
.
runAction
(
cc
.
spawn
(
cc
.
rotateBy
(
1
,
720
),
cc
.
rotateBy
(
1
,
720
),
cc
.
moveBy
(
1
,
0
,
-
1000
)
),
)
},
playLabelGreen
()
{
this
.
dragonBone
.
playAnimation
(
this
.
animationName
,
1
);
this
.
playAudioOption
((
duration
)
=>
{
this
.
scheduleDuration
=
duration
/
2
/
this
.
label
.
node
.
width
;
this
.
schedule
(
this
.
playLabelGreenCb
,
this
.
scheduleDuration
)
},
()
=>
{
this
.
unschedule
(
this
.
changeAudioSpfCb
)
this
.
sprAudio
.
spriteFrame
=
this
.
spfAudioOn
;
GameData
.
isAudio
=
false
;
});
},
playLabelGreenCb
()
{
this
.
labelMask
.
width
+=
2
;
if
(
this
.
labelMask
.
width
>=
this
.
label
.
node
.
width
)
{
this
.
unschedule
(
this
.
playLabelGreenCb
)
this
.
labelMask
.
anchorX
=
1
;
this
.
labelMask
.
x
=
this
.
label
.
node
.
x
+
this
.
label
.
node
.
width
/
2
;
this
.
labelGreen
.
node
.
anchorX
=
1
;
this
.
labelGreen
.
node
.
x
=
0
;
this
.
playLabelWhite
();
}
},
playLabelWhite
()
{
this
.
schedule
(
this
.
playLabelWhiteCb
,
this
.
scheduleDuration
)
},
playLabelWhiteCb
()
{
this
.
labelMask
.
width
-=
2
;
if
(
this
.
labelMask
.
width
<=
0
)
{
this
.
unschedule
(
this
.
playLabelWhiteCb
)
this
.
labelMask
.
anchorX
=
0
;
this
.
labelMask
.
x
=
this
.
label
.
node
.
x
-
this
.
label
.
node
.
width
/
2
;
this
.
labelGreen
.
node
.
anchorX
=
0
;
this
.
labelGreen
.
node
.
x
=
0
;
}
},
changeAudioSpfCb
()
{
this
.
sprAudio
.
spriteFrame
=
this
.
sprAudio
.
spriteFrame
==
this
.
spfAudioOff
?
this
.
spfAudioOn
:
this
.
spfAudioOff
;
...
...
@@ -194,17 +265,18 @@ cc.Class({
if
(
GameData
.
audioCount
>
0
)
{
return
;
}
this
.
dragonBone
.
playAnimation
(
this
.
animationName
,
0
);
this
.
sprAudio
.
spriteFrame
=
this
.
spfAudioOff
;
this
.
schedule
(
this
.
changeAudioSpfCb
,
0.2
)
this
.
playAudioOption
(()
=>
{
this
.
playAudioOption
((
duration
)
=>
{
},
()
=>
{
this
.
unschedule
(
this
.
changeAudioSpfCb
)
this
.
sprAudio
.
spriteFrame
=
this
.
spfAudioOn
;
GameData
.
isAudio
=
false
;
});
},
playAudioOption
(
cb
)
{
playAudioOption
(
cb
1
,
cb2
)
{
GameData
.
audioCount
++
;
let
url
=
this
.
data
.
optionAudio
;
url
=
'
http://127.0.0.1/iamflying.mp3
'
;
...
...
@@ -214,12 +286,14 @@ cc.Class({
return
;
}
let
id
=
cc
.
audioEngine
.
play
(
clip
,
false
,
1
);
let
duration
=
cc
.
audioEngine
.
getDuration
(
id
);
cb1
&&
cb1
(
duration
);
cc
.
audioEngine
.
setFinishCallback
(
id
,
()
=>
{
if
(
!
cc
.
isValid
(
this
))
{
return
;
}
GameData
.
audioCount
--
;
cb
&&
cb
();
cb
2
&&
cb2
();
})
});
},
...
...
play/assets/tmpGame/script/Scene.js
View file @
ef8179ed
...
...
@@ -11,8 +11,10 @@ cc.Class({
audTryAgain
:
cc
.
AudioClip
,
audDown
:
cc
.
AudioClip
,
pfbItemAnswer
:
cc
.
Prefab
,
pfbItemQuestion
:
cc
.
Prefab
,
layerOver
:
cc
.
Prefab
,
layerTryAgain
:
cc
.
Prefab
,
layerFive
:
cc
.
Prefab
,
layerSeven
:
cc
.
Prefab
,
dragonBone
:
dragonBones
.
ArmatureDisplay
,
spfAudio
:
[
cc
.
SpriteFrame
],
},
...
...
@@ -42,6 +44,8 @@ cc.Class({
initNodes
()
{
this
.
sprAudio
=
this
.
nodeDict
.
sprAudio
.
getComponent
(
cc
.
Sprite
);
this
.
sprAudio
.
node
.
active
=
false
;
this
.
startDragonbonePos
=
this
.
dragonBone
.
node
.
position
;
},
onEnable
()
{
...
...
@@ -134,21 +138,23 @@ cc.Class({
this
.
startGame
();
this
.
dragonBone
.
on
(
dragonBones
.
EventObject
.
COMPLETE
,
(
event
)
=>
{
if
(
event
.
animationState
.
name
==
'
wrong
'
)
{
this
.
dragonBone
.
on
(
dragonBones
.
EventObject
.
COMPLETE
,
(
event
)
=>
{
if
(
event
.
animationState
.
name
==
'
wrong
'
)
{
this
.
playNormal
();
}
},
this
)
},
this
)
},
initData
()
{
// 所有全局变量 默认都是null
this
.
questionList
=
[];
GameData
.
audioCount
=
0
;
this
.
nodeDict
.
nodButtons
.
zIndex
=
4
;
let
optionList
=
this
.
data
.
questionList
[
GameData
.
questionIndex
].
optionList
;
this
.
optionList
=
[];
for
(
let
i
=
0
;
i
<
optionList
.
length
;
i
++
)
{
this
.
optionList
[
i
]
=
i
;
this
.
questionList
[
i
]
=
i
;
}
this
.
initAnswer
();
this
.
initTitle
();
...
...
@@ -170,14 +176,16 @@ cc.Class({
// 初始化选项
initAnswer
()
{
this
.
nodeDict
.
nodLayerAnswer
.
destroyAllChildren
();
let
optionList
=
this
.
data
.
questionList
[
GameData
.
questionIndex
].
optionList
;
if
(
optionList
.
length
<=
5
)
{
this
.
layerAnser
=
this
.
nodeDict
.
LayerFive
;
this
.
layerAnser
=
cc
.
instantiate
(
this
.
layerFive
);
this
.
layerAnser
.
parent
=
this
.
nodeDict
.
nodLayerAnswer
;
}
else
{
this
.
layerAnser
=
this
.
nodeDict
.
LayerSeven
;
this
.
layerAnser
=
cc
.
instantiate
(
this
.
layerSeven
);
this
.
layerAnser
.
parent
=
this
.
nodeDict
.
nodLayerAnswer
;
}
this
.
nodeDict
.
LayerFive
.
active
=
false
;
this
.
nodeDict
.
LayerSeven
.
active
=
false
;
this
.
nodeDict
.
nodLayerAnswer
.
zIndex
=
2
;
this
.
layerAnser
.
active
=
true
;
for
(
let
i
=
0
;
i
<
optionList
.
length
;
i
++
)
{
let
node
=
this
.
layerAnser
.
children
[
i
];
...
...
@@ -243,28 +251,6 @@ cc.Class({
EventMgr
.
emit
(
'
showAudioButton
'
);
},
showNext
(
index
)
{
for
(
let
i
=
0
;
i
<
this
.
optionList
.
length
;
i
++
)
{
if
(
this
.
optionList
[
i
]
==
index
)
{
this
.
optionList
.
splice
(
i
,
1
);
break
;
}
}
if
(
this
.
optionList
.
length
==
0
)
{
this
.
checkOver
();
}
else
{
this
.
showRandomQuestion
();
}
},
checkOver
()
{
if
(
GameData
.
questionIndex
!=
this
.
data
.
questionList
.
length
-
1
)
{
return
;
}
let
node
=
cc
.
instantiate
(
this
.
layerOver
);
node
.
parent
=
this
.
node
;
},
updateBtnStatus
()
{
if
(
GameData
.
questionIndex
==
0
)
{
this
.
nodeDict
.
btnLast
.
getComponent
(
cc
.
Button
).
interactable
=
false
;
...
...
@@ -278,45 +264,134 @@ cc.Class({
}
},
onClickAnswer
(
itemAnser
,
isRight
)
{
for
(
let
i
=
0
;
i
<
this
.
layerAnser
.
children
.
length
;
i
++
)
{
onClickAnswer
(
itemAnser
,
isRight
)
{
for
(
let
i
=
0
;
i
<
this
.
layerAnser
.
children
.
length
;
i
++
)
{
this
.
layerAnser
.
children
[
i
].
getComponent
(
'
ItemAnswer
'
).
playHideAudioButton
();
}
if
(
isRight
){
}
else
{
if
(
isRight
)
{
this
.
showDragonBonesMove
(
itemAnser
.
node
);
}
else
{
this
.
scheduleOnce
(()
=>
{
for
(
let
i
=
0
;
i
<
this
.
layerAnser
.
children
.
length
;
i
++
)
{
this
.
layerAnser
.
children
[
i
].
getComponent
(
'
ItemAnswer
'
).
playShowAudioButton
();
}
},
2
)
this
.
playWrong
();
GameData
.
audioCount
++
;
this
.
scheduleOnce
(()
=>
{
this
.
showLayerTryagain
();
},
0.8
)
}
},
onTurnLast
()
{
this
.
nodeDict
.
nodAnswerParent
.
destroyAllChildren
();
this
.
nodeDict
.
nodQuestionParent
.
destroyAllChildren
();
showDragonBonesMove
(
target
)
{
GameData
.
_showDragonbones
=
true
;
let
pos
=
target
.
parent
.
convertToWorldSpaceAR
(
target
.
position
);
pos
=
this
.
node
.
convertToNodeSpaceAR
(
pos
);
pos
=
pos
.
add
(
cc
.
v2
(
180
,
-
100
))
this
.
dragonBone
.
node
.
zIndex
=
3
;
this
.
dragonBone
.
node
.
runAction
(
cc
.
sequence
(
cc
.
moveTo
(
1
,
pos
),
cc
.
callFunc
(()
=>
{
})
)
)
this
.
playRight
();
this
.
scheduleOnce
(()
=>
{
if
(
cc
.
isValid
(
target
))
{
this
.
showChooseRight
(
target
);
}
},
2.2
)
},
showChooseRight
(
target
)
{
let
itemAnswer
=
target
.
getComponent
(
'
ItemAnswer
'
);
this
.
questionList
.
splice
(
itemAnswer
.
index
,
1
);
this
.
nodeDict
.
nodMask
.
active
=
true
;
this
.
nodeDict
.
nodMask
.
parent
=
this
.
layerAnser
;
target
.
zIndex
=
2
;
this
.
playNormal
();
this
.
dragonBone
.
node
.
runAction
(
cc
.
sequence
(
cc
.
moveTo
(
1
,
this
.
startDragonbonePos
),
cc
.
callFunc
(()
=>
{
// GameData._showDragonbones = false;
this
.
dragonBone
.
node
.
zIndex
=
1
;
})
)
)
target
.
runAction
(
cc
.
sequence
(
cc
.
spawn
(
cc
.
moveTo
(
0.5
,
0
,
0
),
cc
.
scaleTo
(
0.5
,
1.2
)
),
cc
.
callFunc
(()
=>
{
if
(
this
.
checkOver
())
{
this
.
showLayerOver
();
return
;
}
itemAnswer
.
playLabelGreen
();
GameData
.
_showDragonbones
=
false
;
})
))
},
checkOver
()
{
if
(
this
.
questionList
.
length
==
0
)
{
return
true
;
}
},
showLayerOver
()
{
let
node
=
cc
.
instantiate
(
this
.
layerOver
);
node
.
parent
=
this
.
node
;
node
.
zIndex
=
6
;
},
showLayerTryagain
()
{
let
node
=
cc
.
instantiate
(
this
.
layerTryAgain
);
node
.
parent
=
this
.
node
;
node
.
zIndex
=
5
;
GameData
.
audioCount
--
;
this
.
playAudioTryagain
();
this
.
scheduleOnce
(()
=>
{
node
.
destroy
();
},
1.7
)
},
playAudioTryagain
()
{
GameData
.
audioCount
++
;
let
id
=
cc
.
audioEngine
.
play
(
this
.
audTryAgain
,
false
,
1
);
cc
.
audioEngine
.
setFinishCallback
(
id
,
()
=>
{
GameData
.
audioCount
--
;
})
},
resetDate
()
{
this
.
nodeDict
.
nodMask
.
active
=
false
;
this
.
nodeDict
.
nodMask
.
parent
=
this
.
node
;
cc
.
audioEngine
.
stopAll
();
GameData
.
questionIndex
--
;
this
.
initData
();
this
.
playAudioQuestion
();
GameData
.
startStepDone
=
false
;
},
onTurnLast
()
{
GameData
.
questionIndex
--
;
this
.
resetDate
();
},
onReplay
()
{
this
.
nodeDict
.
nodAnswerParent
.
destroyAllChildren
();
this
.
nodeDict
.
nodQuestionParent
.
destroyAllChildren
();
cc
.
audioEngine
.
stopAll
();
this
.
initData
();
this
.
playAudioQuestion
();
GameData
.
startStepDone
=
false
;
this
.
resetDate
();
},
onTurnNext
()
{
this
.
nodeDict
.
nodAnswerParent
.
destroyAllChildren
();
this
.
nodeDict
.
nodQuestionParent
.
destroyAllChildren
();
cc
.
audioEngine
.
stopAll
();
GameData
.
questionIndex
++
;
this
.
initData
();
this
.
playAudioQuestion
();
GameData
.
startStepDone
=
false
;
this
.
resetDate
();
},
buttonListener
(
button
)
{
if
(
GameData
.
_showDragonbones
)
{
return
;
}
if
(
button
.
node
.
name
==
'
btnTitle
'
)
{
if
(
GameData
.
audioCount
!=
0
)
{
return
;
...
...
@@ -335,7 +410,7 @@ cc.Class({
playNormal
()
{
this
.
dragonBone
.
playAnimation
(
'
normal
'
,
1
);
this
.
dragonBone
.
playAnimation
(
'
normal
'
,
0
);
},
playWrong
()
{
this
.
dragonBone
.
playAnimation
(
'
wrong
'
,
1
);
...
...
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