Commit 3d22ca50 authored by 李维's avatar 李维

Bug fix

parent fc5f6b3c
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 51 "__id__": 53
} }
], ],
"_active": false, "_active": false,
...@@ -78,31 +78,31 @@ ...@@ -78,31 +78,31 @@
"__id__": 5 "__id__": 5
}, },
{ {
"__id__": 12 "__id__": 14
}, },
{ {
"__id__": 19 "__id__": 21
}, },
{ {
"__id__": 25 "__id__": 27
}, },
{ {
"__id__": 29 "__id__": 31
}, },
{ {
"__id__": 41 "__id__": 43
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 48 "__id__": 50
}, },
{ {
"__id__": 49 "__id__": 51
}, },
{ {
"__id__": 50 "__id__": 52
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -192,7 +192,7 @@ ...@@ -192,7 +192,7 @@
"array": [ "array": [
0, 0,
0, 0,
416.55821922031504, 394.0353459072324,
0, 0,
0, 0,
0, 0,
...@@ -267,6 +267,9 @@ ...@@ -267,6 +267,9 @@
}, },
{ {
"__id__": 10 "__id__": 10
},
{
"__id__": 12
} }
], ],
"_active": true, "_active": true,
...@@ -415,7 +418,7 @@ ...@@ -415,7 +418,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "bg_A", "_name": "bubble",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 5 "__id__": 5
...@@ -436,6 +439,100 @@ ...@@ -436,6 +439,100 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_contentSize": {
"__type__": "cc.Size",
"width": 1210,
"height": 478
},
"_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": "370mS4vE1IvJM3sTWCQgt0"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "2ecbaeb7-1546-4264-91fc-471289a5404e"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "f1FLR+PKFKIIx+PYMDUdnY"
},
{
"__type__": "cc.Node",
"_name": "bg_A",
"_objFlags": 0,
"_parent": {
"__id__": 5
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 11
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1280, "width": 1280,
...@@ -480,7 +577,7 @@ ...@@ -480,7 +577,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 8 "__id__": 10
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -518,7 +615,7 @@ ...@@ -518,7 +615,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 11 "__id__": 13
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -574,7 +671,7 @@ ...@@ -574,7 +671,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 10 "__id__": 12
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -607,14 +704,14 @@ ...@@ -607,14 +704,14 @@
"__id__": 2 "__id__": 2
}, },
"_children": [ "_children": [
{
"__id__": 13
},
{ {
"__id__": 15 "__id__": 15
}, },
{ {
"__id__": 17 "__id__": 17
},
{
"__id__": 19
} }
], ],
"_active": true, "_active": true,
...@@ -672,13 +769,13 @@ ...@@ -672,13 +769,13 @@
"_name": "video", "_name": "video",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 12 "__id__": 14
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 14 "__id__": 16
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -734,7 +831,7 @@ ...@@ -734,7 +831,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 13 "__id__": 15
}, },
"_enabled": true, "_enabled": true,
"_resourceType": 1, "_resourceType": 1,
...@@ -754,13 +851,13 @@ ...@@ -754,13 +851,13 @@
"_name": "bg_A", "_name": "bg_A",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 12 "__id__": 14
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 16 "__id__": 18
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -816,7 +913,7 @@ ...@@ -816,7 +913,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 15 "__id__": 17
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -848,13 +945,13 @@ ...@@ -848,13 +945,13 @@
"_name": "bg_D", "_name": "bg_D",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 12 "__id__": 14
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 18 "__id__": 20
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -910,7 +1007,7 @@ ...@@ -910,7 +1007,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 17 "__id__": 19
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -945,14 +1042,14 @@ ...@@ -945,14 +1042,14 @@
"__id__": 2 "__id__": 2
}, },
"_children": [ "_children": [
{
"__id__": 20
},
{ {
"__id__": 22 "__id__": 22
}, },
{ {
"__id__": 24 "__id__": 24
},
{
"__id__": 26
} }
], ],
"_active": true, "_active": true,
...@@ -1010,13 +1107,13 @@ ...@@ -1010,13 +1107,13 @@
"_name": "bg_A", "_name": "bg_A",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 19 "__id__": 21
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 21 "__id__": 23
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1072,7 +1169,7 @@ ...@@ -1072,7 +1169,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 20 "__id__": 22
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -1104,13 +1201,13 @@ ...@@ -1104,13 +1201,13 @@
"_name": "bg_D", "_name": "bg_D",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 19 "__id__": 21
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 23 "__id__": 25
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1166,7 +1263,7 @@ ...@@ -1166,7 +1263,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 22 "__id__": 24
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -1198,7 +1295,7 @@ ...@@ -1198,7 +1295,7 @@
"_name": "DB", "_name": "DB",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 19 "__id__": 21
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
...@@ -1260,10 +1357,10 @@ ...@@ -1260,10 +1357,10 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 26 "__id__": 28
}, },
{ {
"__id__": 28 "__id__": 30
} }
], ],
"_active": true, "_active": true,
...@@ -1321,13 +1418,13 @@ ...@@ -1321,13 +1418,13 @@
"_name": "bg", "_name": "bg",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 25 "__id__": 27
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 27 "__id__": 29
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1383,7 +1480,7 @@ ...@@ -1383,7 +1480,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 26 "__id__": 28
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -1415,7 +1512,7 @@ ...@@ -1415,7 +1512,7 @@
"_name": "dragonBones", "_name": "dragonBones",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 25 "__id__": 27
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
...@@ -1477,13 +1574,13 @@ ...@@ -1477,13 +1574,13 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 30 "__id__": 32
}, },
{ {
"__id__": 33 "__id__": 35
}, },
{ {
"__id__": 36 "__id__": 38
} }
], ],
"_active": false, "_active": false,
...@@ -1541,11 +1638,11 @@ ...@@ -1541,11 +1638,11 @@
"_name": "font", "_name": "font",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 29 "__id__": 31
}, },
"_children": [ "_children": [
{ {
"__id__": 31 "__id__": 33
} }
], ],
"_active": true, "_active": true,
...@@ -1603,13 +1700,13 @@ ...@@ -1603,13 +1700,13 @@
"_name": "Comic Sans MS", "_name": "Comic Sans MS",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 30 "__id__": 32
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 32 "__id__": 34
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1665,7 +1762,7 @@ ...@@ -1665,7 +1762,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 31 "__id__": 33
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -1697,11 +1794,11 @@ ...@@ -1697,11 +1794,11 @@
"_name": "img", "_name": "img",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 29 "__id__": 31
}, },
"_children": [ "_children": [
{ {
"__id__": 34 "__id__": 36
} }
], ],
"_active": true, "_active": true,
...@@ -1759,13 +1856,13 @@ ...@@ -1759,13 +1856,13 @@
"_name": "black", "_name": "black",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 33 "__id__": 35
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 35 "__id__": 37
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1821,7 +1918,7 @@ ...@@ -1821,7 +1918,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 34 "__id__": 36
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -1849,14 +1946,14 @@ ...@@ -1849,14 +1946,14 @@
"_name": "audio", "_name": "audio",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 29 "__id__": 31
}, },
"_children": [ "_children": [
{ {
"__id__": 37 "__id__": 39
}, },
{ {
"__id__": 39 "__id__": 41
} }
], ],
"_active": true, "_active": true,
...@@ -1914,13 +2011,13 @@ ...@@ -1914,13 +2011,13 @@
"_name": "sm_btn", "_name": "sm_btn",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 36 "__id__": 38
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 38 "__id__": 40
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1976,7 +2073,7 @@ ...@@ -1976,7 +2073,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 37 "__id__": 39
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -1994,13 +2091,13 @@ ...@@ -1994,13 +2091,13 @@
"_name": "sm_join", "_name": "sm_join",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 36 "__id__": 38
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 40 "__id__": 42
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2056,7 +2153,7 @@ ...@@ -2056,7 +2153,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 39 "__id__": 41
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -2077,14 +2174,14 @@ ...@@ -2077,14 +2174,14 @@
"__id__": 2 "__id__": 2
}, },
"_children": [ "_children": [
{
"__id__": 42
},
{ {
"__id__": 44 "__id__": 44
}, },
{ {
"__id__": 46 "__id__": 46
},
{
"__id__": 48
} }
], ],
"_active": true, "_active": true,
...@@ -2142,13 +2239,13 @@ ...@@ -2142,13 +2239,13 @@
"_name": "btn_right", "_name": "btn_right",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 41 "__id__": 43
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 43 "__id__": 45
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2204,7 +2301,7 @@ ...@@ -2204,7 +2301,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 42 "__id__": 44
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -2236,13 +2333,13 @@ ...@@ -2236,13 +2333,13 @@
"_name": "btn_left", "_name": "btn_left",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 41 "__id__": 43
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 45 "__id__": 47
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2298,7 +2395,7 @@ ...@@ -2298,7 +2395,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 44 "__id__": 46
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -2330,13 +2427,13 @@ ...@@ -2330,13 +2427,13 @@
"_name": "btn_restart", "_name": "btn_restart",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 41 "__id__": 43
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 47 "__id__": 49
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2392,7 +2489,7 @@ ...@@ -2392,7 +2489,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 46 "__id__": 48
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
......
...@@ -167,8 +167,11 @@ export default class Cartoon { ...@@ -167,8 +167,11 @@ export default class Cartoon {
}) })
} }
stopVideo(videoPlayer) {
videoPlayer.stop()
}
playVideo(videoPlayer, callback) { playVideo(videoPlayer, callback) {
console.log(videoPlayer)
if(videoPlayer && videoPlayer.isPlaying) { if(videoPlayer && videoPlayer.isPlaying) {
videoPlayer.stop() videoPlayer.stop()
} }
...@@ -347,13 +350,6 @@ class DragonBones { ...@@ -347,13 +350,6 @@ class DragonBones {
cc.loader.load(image, (error, texture) => { cc.loader.load(image, (error, texture) => {
cc.loader.load({url: atlas, type: 'txt'}, (error, atlasJson) => { cc.loader.load({url: atlas, type: 'txt'}, (error, atlasJson) => {
cc.loader.load({url: ske, type: 'txt'}, (error, dragonBonesJson) => { cc.loader.load({url: ske, type: 'txt'}, (error, dragonBonesJson) => {
// cc.loader.loadRes(image, (error, texture) => {
// console.log(error)
// cc.loader.loadRes(atlas, (error, atlasJson) => {
// console.log(error)
// cc.loader.loadRes(ske, (error, dragonBonesJson) => {
// console.log(error)
// console.log(atlasJson)
const atlas = new dragonBones.DragonBonesAtlasAsset(); const atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = (atlasJson); atlas.atlasJson = (atlasJson);
atlas.texture = texture; atlas.texture = texture;
...@@ -396,14 +392,14 @@ class DragonBones { ...@@ -396,14 +392,14 @@ class DragonBones {
}) })
} }
if(callback) {
callback(this)
}
let sx = parentNode.width / animaNode.width; let sx = parentNode.width / animaNode.width;
let sy = parentNode.height / animaNode.height; let sy = parentNode.height / animaNode.height;
animaNode.setScale(Math.min(sx, sy)); animaNode.setScale(Math.min(sx, sy));
if(callback) {
callback(this)
}
}); });
}); });
}); });
...@@ -416,6 +412,10 @@ class DragonBones { ...@@ -416,6 +412,10 @@ class DragonBones {
} }
} }
stopDragonBones() {
this._animationLoaded.armature().animation.stop();
}
showDragonBones(times = 1, animaName, callBack) { showDragonBones(times = 1, animaName, callBack) {
let animaNameIndex = this._animationLoaded.animaNames.indexOf(animaName) let animaNameIndex = this._animationLoaded.animaNames.indexOf(animaName)
if (this._animationLoaded && this._animationLoaded.animaNames.length > 0) { if (this._animationLoaded && this._animationLoaded.animaNames.length > 0) {
......
...@@ -98,7 +98,11 @@ export default class GameLogic { ...@@ -98,7 +98,11 @@ export default class GameLogic {
} }
initBg() { initBg() {
console.log(this.g_formData.theme) const bgBubble = cc.find('Canvas/bgMain/bubble');
bgBubble.scale = this.g_systemOption.mapScaleMin;
// bgBubble.width = cc.winSize.width
// bgBubble.height = cc.winSize.height
const bgNode_A = cc.find('Canvas/bgMain/bg_A'); const bgNode_A = cc.find('Canvas/bgMain/bg_A');
// bgNode_A.scale = this.g_systemOption.mapScaleMin; // bgNode_A.scale = this.g_systemOption.mapScaleMin;
bgNode_A.width = cc.winSize.width bgNode_A.width = cc.winSize.width
...@@ -242,30 +246,43 @@ export default class GameLogic { ...@@ -242,30 +246,43 @@ export default class GameLogic {
} }
} }
stopCurrentPlaying() {
let rightDragon = this.g_cartoon.getCartoonElement("rightDragonContainer")
let videoContainer = this.g_cartoon.getCartoonElement("video_container_video")
let textContainer = this.g_cartoon.getCartoonElement("textDragonContainer")
textContainer.dragonBones.stopDragonBones()
rightDragon.dragonBones.stopDragonBones()
this.g_cartoon.stopVideo(videoContainer.node.getComponent(cc.VideoPlayer))
this.g_cartoon.stopAllAudio()
}
playCurrentQuestion() { playCurrentQuestion() {
const play = ()=>{ const play = ()=>{
let rightDragon = this.g_cartoon.getCartoonElement("rightDragonContainer") let rightDragon = this.g_cartoon.getCartoonElement("rightDragonContainer")
var container = this.g_cartoon.getCartoonElement("video_container_video") var container = this.g_cartoon.getCartoonElement("video_container_video")
this.g_cartoon.getCartoonElement("textDragonContainer").play() this.g_cartoon.getCartoonElement("textDragonContainer").play()
if(this.g_formData.dataArray[this.m_currentQuestion].text_audio_url) { if(this.g_formData.dataArray[this.m_currentQuestion].text_audio_url) {
this.g_cartoon.playAudio(this.g_formData.dataArray[this.m_currentQuestion].text_audio_url) this.g_cartoon.playAudio(this.g_formData.dataArray[this.m_currentQuestion].text_audio_url)
} }
this.g_cartoon.playVideo(container.node.getComponent(cc.VideoPlayer), ()=>{ this.g_cartoon.playVideo(container.node.getComponent(cc.VideoPlayer), ()=>{
rightDragon.play() rightDragon.play()
console.log("ADV")
if(this.g_formData.dataArray[this.m_currentQuestion].right_audio_url) { if(this.g_formData.dataArray[this.m_currentQuestion].right_audio_url) {
this.g_cartoon.playAudio(this.g_formData.dataArray[this.m_currentQuestion].right_audio_url) this.g_cartoon.playAudio(this.g_formData.dataArray[this.m_currentQuestion].right_audio_url)
} }
}) })
} }
if(this.m_firstEnter) { if(!this.g_formData.dataArray[this.m_currentQuestion].played) {
this.m_firstEnter = false; this.g_formData.dataArray[this.m_currentQuestion].played = true;
this.g_cartoon.playAudio("sm_join", () => { this.g_cartoon.playAudio("sm_join", () => {
this.stopCurrentPlaying();
play() play()
}) })
} else { } else {
this.stopCurrentPlaying();
play() play()
} }
...@@ -302,14 +319,20 @@ export default class GameLogic { ...@@ -302,14 +319,20 @@ export default class GameLogic {
} }
} }
textDragon.setDragonBones = (dragon) => { textDragon.setDragonBones = (dragon, callback) => {
if(dragon && dragon.texPngData.url && dragon.skeJsonData.url && dragon.texJsonData.url) { if(dragon && dragon.texPngData.url && dragon.skeJsonData.url && dragon.texJsonData.url) {
textDragon.dragonBones.setDragonBones(dragon, null, (handle)=>{ textDragon.dragonBones.setDragonBones(dragon, null, (handle)=>{
textDragon.dragonBonesLoaded = handle; textDragon.dragonBonesLoaded = handle;
if(callback) {
callback()
}
}) })
} else{ } else{
textDragon.dragonBones.deleteDragonBones() textDragon.dragonBones.deleteDragonBones()
textDragon.dragonBonesLoaded = null; textDragon.dragonBonesLoaded = null;
if(callback) {
callback()
}
} }
} }
...@@ -317,12 +340,12 @@ export default class GameLogic { ...@@ -317,12 +340,12 @@ export default class GameLogic {
rightDragon.node.opacity = 255; rightDragon.node.opacity = 255;
rightDragon.show = (callBack) => { rightDragon.show = (callBack) => {
if(rightDragon.node.opacity == 255) { if(rightDragon.node.opacity == 255) {
if(callBack) { if(callback) {
callback() callback()
} }
} else { } else {
this.g_cartoon.tweenChange(rightDragon.node, {opacity: 255}, 0.3, ()=>{ this.g_cartoon.tweenChange(rightDragon.node, {opacity: 255}, 0.3, ()=>{
if(callBack) { if(callback) {
callback() callback()
} }
}); });
...@@ -338,7 +361,7 @@ export default class GameLogic { ...@@ -338,7 +361,7 @@ export default class GameLogic {
} }
} }
rightDragon.setDragonBones = (dragon) => { rightDragon.setDragonBones = (dragon, callback) => {
if(dragon && dragon.texPngData.url && dragon.skeJsonData.url && dragon.texJsonData.url) { if(dragon && dragon.texPngData.url && dragon.skeJsonData.url && dragon.texJsonData.url) {
rightDragon.dragonBones.setDragonBones(dragon, null, (handle)=>{ rightDragon.dragonBones.setDragonBones(dragon, null, (handle)=>{
// let sx = 498 / handle._animationLoaded.node.width; // let sx = 498 / handle._animationLoaded.node.width;
...@@ -354,10 +377,16 @@ export default class GameLogic { ...@@ -354,10 +377,16 @@ export default class GameLogic {
// }, ()=>{ // }, ()=>{
// // handle.showDragonBones(); // // handle.showDragonBones();
// }) // })
if(callback) {
callback()
}
}) })
} else{ } else{
rightDragon.dragonBones.deleteDragonBones() rightDragon.dragonBones.deleteDragonBones()
rightDragon.dragonBonesLoaded = null; rightDragon.dragonBonesLoaded = null;
if(callback) {
callback()
}
} }
} }
} }
...@@ -380,22 +409,34 @@ export default class GameLogic { ...@@ -380,22 +409,34 @@ export default class GameLogic {
let textDragon = this.g_formData.dataArray[this.m_currentQuestion].textDragonBones let textDragon = this.g_formData.dataArray[this.m_currentQuestion].textDragonBones
let rightDragon = this.g_formData.dataArray[this.m_currentQuestion].rightDragonBones let rightDragon = this.g_formData.dataArray[this.m_currentQuestion].rightDragonBones
this.g_cartoon.getCartoonElement("textDragonContainer").setDragonBones(textDragon)
this.g_cartoon.getCartoonElement("rightDragonContainer").setDragonBones(rightDragon) let p1 = new Promise((resolve, reject) => {
this.g_cartoon.getCartoonElement("textDragonContainer").setDragonBones(textDragon, ()=>{
resolve()
})
})
let p2 = new Promise((resolve, reject) => {
this.g_cartoon.getCartoonElement("rightDragonContainer").setDragonBones(rightDragon, ()=>{
resolve()
})
})
let video = this.g_cartoon.getCartoonElement("video_container_video") let video = this.g_cartoon.getCartoonElement("video_container_video")
let p3 = new Promise((resolve, reject) => {
if(this.g_formData.dataArray[this.m_currentQuestion].video_url) { if(this.g_formData.dataArray[this.m_currentQuestion].video_url) {
video.node.active = true; video.node.active = true;
this.g_cartoon.getVideo(this.g_formData.dataArray[this.m_currentQuestion].video_url).then((clip=>{ this.g_cartoon.getVideo(this.g_formData.dataArray[this.m_currentQuestion].video_url).then((clip=>{
video.node.getComponent(cc.VideoPlayer).clip = clip video.node.getComponent(cc.VideoPlayer).clip = clip
this.playCurrentQuestion() resolve()
})) }))
} else { } else {
video.node.active = false; video.node.active = false;
this.playCurrentQuestion() resolve()
} }
})
return true; return Promise.all([p1, p2, p3])
} }
initBottomButtons() { initBottomButtons() {
...@@ -409,14 +450,17 @@ export default class GameLogic { ...@@ -409,14 +450,17 @@ export default class GameLogic {
} }
this.g_cartoon.playAudio("sm_btn"); this.g_cartoon.playAudio("sm_btn");
this.disableClick("btn_left") this.disableClick("btn_left")
this.stopCurrentPlaying();
jelly(btnLeft.node) jelly(btnLeft.node)
this.showMaskLayer(()=>{ this.showMaskLayer(()=>{
this.loadQuestion(false) this.loadQuestion(false).then(()=>{
this.hideMaskLayer(()=>{ this.hideMaskLayer(()=>{
this.playCurrentQuestion()
this.enableClick("btn_left") this.enableClick("btn_left")
}) })
}) })
}) })
})
this.g_cartoon.subscribeTouchEvent(btnRight.key, ()=>{ this.g_cartoon.subscribeTouchEvent(btnRight.key, ()=>{
if(btnRight.disable) { if(btnRight.disable) {
...@@ -424,14 +468,17 @@ export default class GameLogic { ...@@ -424,14 +468,17 @@ export default class GameLogic {
} }
this.g_cartoon.playAudio("sm_btn"); this.g_cartoon.playAudio("sm_btn");
this.disableClick("btn_right") this.disableClick("btn_right")
this.stopCurrentPlaying();
jelly(btnRight.node) jelly(btnRight.node)
this.showMaskLayer(()=>{ this.showMaskLayer(()=>{
this.loadQuestion(true) this.loadQuestion(true).then(()=>{
this.hideMaskLayer(()=>{ this.hideMaskLayer(()=>{
this.playCurrentQuestion()
this.enableClick("btn_right") this.enableClick("btn_right")
}) })
}) })
}) })
})
this.g_cartoon.subscribeTouchEvent(btnRestart.key, ()=>{ this.g_cartoon.subscribeTouchEvent(btnRestart.key, ()=>{
if(btnRestart.disable) { if(btnRestart.disable) {
......
...@@ -104,8 +104,8 @@ cc.Class({ ...@@ -104,8 +104,8 @@ cc.Class({
// const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","bgMusic":"","titleText":"TEstd","questionAudio_url":"","dataArray":[{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/06cc843598a912921f6ca3acfde6220b.png","audio_url":"http://staging-teach.cdn.ireadabc.com/3b5540cc95a006dff8c41dba7537075a.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/571974922f6678111348a5643dba7e20.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/78579114773af12a7aec6723e3b9d475.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/c99e82e1c3f087c6dc0469e30c624f70.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/5b45c89ac9e899d76522767219b1346b.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/2e28eae8f0e0f01193da6f3677379ed3.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/fad2dac4f8b59a185dc30d42617c2ca8.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/6c3fca11052464102407f173e4a83db9.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/ec82c796af801486548ae98623f614d2.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/ac4b9422df1556f80ac5c3058cd3d670.png"}]}}' // const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","bgMusic":"","titleText":"TEstd","questionAudio_url":"","dataArray":[{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/06cc843598a912921f6ca3acfde6220b.png","audio_url":"http://staging-teach.cdn.ireadabc.com/3b5540cc95a006dff8c41dba7537075a.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/571974922f6678111348a5643dba7e20.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/78579114773af12a7aec6723e3b9d475.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/c99e82e1c3f087c6dc0469e30c624f70.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/5b45c89ac9e899d76522767219b1346b.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/2e28eae8f0e0f01193da6f3677379ed3.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/fad2dac4f8b59a185dc30d42617c2ca8.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/6c3fca11052464102407f173e4a83db9.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/ec82c796af801486548ae98623f614d2.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/ac4b9422df1556f80ac5c3058cd3d670.png"}]}}'
// const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","bgMusic":"http://staging-teach.cdn.ireadabc.com/ad58bae62ea02cf215ce7dee22df306f.mp3","titleText":"TEstd","questionAudio_url":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3","dataArray":[{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/06cc843598a912921f6ca3acfde6220b.png","audio_url":"http://staging-teach.cdn.ireadabc.com/3b5540cc95a006dff8c41dba7537075a.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/571974922f6678111348a5643dba7e20.png","audio_url":"http://staging-teach.cdn.ireadabc.com/ae7c0930a45d0ffc9f13182298e2be71.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/78579114773af12a7aec6723e3b9d475.png","audio_url":"http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/c99e82e1c3f087c6dc0469e30c624f70.png","audio_url":"http://staging-teach.cdn.ireadabc.com/135c628899396df62c14567f46d61f3f.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/5b45c89ac9e899d76522767219b1346b.png","audio_url":"http://staging-teach.cdn.ireadabc.com/3b5540cc95a006dff8c41dba7537075a.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/2e28eae8f0e0f01193da6f3677379ed3.png","audio_url":"http://staging-teach.cdn.ireadabc.com/cb0ac1d1bcdfdaf768f0a06d3fff37a3.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/fad2dac4f8b59a185dc30d42617c2ca8.png","audio_url":"http://staging-teach.cdn.ireadabc.com/9df3f14bc88bcffc49b6717c40428ed8.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/6c3fca11052464102407f173e4a83db9.png","audio_url":"http://staging-teach.cdn.ireadabc.com/d5a5ac2f45431a8a15492cb9f78e0396.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/ec82c796af801486548ae98623f614d2.png","audio_url":"http://staging-teach.cdn.ireadabc.com/fb08783926362bf64232e2ec6966011d.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/ac4b9422df1556f80ac5c3058cd3d670.png","audio_url":"http://staging-teach.cdn.ireadabc.com/fb08783926362bf64232e2ec6966011d.mp3"}]}}' // const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","bgMusic":"http://staging-teach.cdn.ireadabc.com/ad58bae62ea02cf215ce7dee22df306f.mp3","titleText":"TEstd","questionAudio_url":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3","dataArray":[{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/06cc843598a912921f6ca3acfde6220b.png","audio_url":"http://staging-teach.cdn.ireadabc.com/3b5540cc95a006dff8c41dba7537075a.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/571974922f6678111348a5643dba7e20.png","audio_url":"http://staging-teach.cdn.ireadabc.com/ae7c0930a45d0ffc9f13182298e2be71.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/78579114773af12a7aec6723e3b9d475.png","audio_url":"http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/c99e82e1c3f087c6dc0469e30c624f70.png","audio_url":"http://staging-teach.cdn.ireadabc.com/135c628899396df62c14567f46d61f3f.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/5b45c89ac9e899d76522767219b1346b.png","audio_url":"http://staging-teach.cdn.ireadabc.com/3b5540cc95a006dff8c41dba7537075a.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/2e28eae8f0e0f01193da6f3677379ed3.png","audio_url":"http://staging-teach.cdn.ireadabc.com/cb0ac1d1bcdfdaf768f0a06d3fff37a3.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/fad2dac4f8b59a185dc30d42617c2ca8.png","audio_url":"http://staging-teach.cdn.ireadabc.com/9df3f14bc88bcffc49b6717c40428ed8.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/6c3fca11052464102407f173e4a83db9.png","audio_url":"http://staging-teach.cdn.ireadabc.com/d5a5ac2f45431a8a15492cb9f78e0396.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/ec82c796af801486548ae98623f614d2.png","audio_url":"http://staging-teach.cdn.ireadabc.com/fb08783926362bf64232e2ec6966011d.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/ac4b9422df1556f80ac5c3058cd3d670.png","audio_url":"http://staging-teach.cdn.ireadabc.com/fb08783926362bf64232e2ec6966011d.mp3"}]}}'
// const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","bgMusic":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3","titleText":"TEstd","questionAudio_url":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3","dataArray":[{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/06cc843598a912921f6ca3acfde6220b.png","audio_url":"http://staging-teach.cdn.ireadabc.com/3b5540cc95a006dff8c41dba7537075a.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/571974922f6678111348a5643dba7e20.png","audio_url":"http://staging-teach.cdn.ireadabc.com/ae7c0930a45d0ffc9f13182298e2be71.mp3"}]}}' // const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","bgMusic":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3","titleText":"TEstd","questionAudio_url":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3","dataArray":[{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/06cc843598a912921f6ca3acfde6220b.png","audio_url":"http://staging-teach.cdn.ireadabc.com/3b5540cc95a006dff8c41dba7537075a.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/571974922f6678111348a5643dba7e20.png","audio_url":"http://staging-teach.cdn.ireadabc.com/ae7c0930a45d0ffc9f13182298e2be71.mp3"}]}}'
// const dataJson = '{ "contentObj": { "version": "1.0", "key": "DataKey_Sbx_Pronunciation", "theme": "D", "border_image_url": "http://staging-teach.cdn.ireadabc.com/c3e8520418444ad2ee7689510f98de9b.png", "video_image_url": "http://staging-teach.cdn.ireadabc.com/06bb65fb7a3a03d095587b5cc2efc65f.png", "text_image_url": "http://staging-teach.cdn.ireadabc.com/08a2a49e8e1e8e1dc53fb57ad8a4cb44.png", "dataArray": [ { "video_url": "http://staging-teach.cdn.ireadabc.com/f25bb33cdb266345667a1bec58818175.mp4", "textDragonBones": { "skeJsonData": { "url": "", "name": "" }, "texJsonData": { "url": "", "name": "" }, "texPngData": { "url": "", "name": "" } }, "rightDragonBones": { "skeJsonData": { "url": "", "name": "" }, "texJsonData": { "url": "", "name": "" }, "texPngData": { "url": "", "name": "" } } }, { "video_url": "http://staging-teach.cdn.ireadabc.com/82438e44e9e106cfa43d1fd62a24d61b.mp4", "textDragonBones": { "skeJsonData": { "url": "", "name": "" }, "texJsonData": { "url": "", "name": "" }, "texPngData": { "url": "", "name": "" } }, "rightDragonBones": { "skeJsonData": { "url": "", "name": "" }, "texJsonData": { "url": "", "name": "" }, "texPngData": { "url": "", "name": "" } } } ] } }' const dataJson = '{ "contentObj": { "version": "1.0", "key": "DataKey_Sbox_FT_08", "bgMusic": "", "titleText": "", "questionAudio_url": "", "birdDragonBones_1": {}, "birdDragonBones_2": {}, "birdDragonBones_audio": {}, "dataArray": [ { "video_url": "http://staging-teach.cdn.ireadabc.com/f8476aa86cfb6ea4d1fbb69578f606d7.mp4", "textDragonBones": { "texPngData": { "url": "http://staging-teach.cdn.ireadabc.com/b095932007653f7aa4514570af991342.png", "name": "word_tex.png" }, "texJsonData": { "url": "http://staging-teach.cdn.ireadabc.com/4e2458f5632fbfdf6c5a1c66f8c77fe3.json", "name": "word_tex.json" }, "skeJsonData": { "url": "http://staging-teach.cdn.ireadabc.com/c83f14aeee5b533cb582887f5122bcef.json", "name": "word_ske.json" } }, "rightDragonBones": { "texPngData": { "url": "http://staging-teach.cdn.ireadabc.com/ccc42a2a6830dd5bddc67e727ebf717b.png", "name": "dragon_tex.png" }, "texJsonData": { "url": "http://staging-teach.cdn.ireadabc.com/830c92d3d3c73353cf43f03a0051123f.json", "name": "dragon_tex.json" }, "skeJsonData": { "url": "http://staging-teach.cdn.ireadabc.com/e1f26dedb60960b07f90bd42e5478ba6.json", "name": "dragon_ske.json" } }, "audio_url": "http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3", "text_audio_url": "http://staging-teach.cdn.ireadabc.com/99ddd7e2eaa495fa24c6d8ceec76a128.mp3", "right_audio_url": "http://staging-teach.cdn.ireadabc.com/315ca3d2ed808bb1cc0b6d26ac229d4c.mp3" }, { "video_url": "http://staging-teach.cdn.ireadabc.com/f8476aa86cfb6ea4d1fbb69578f606d7.mp4", "textDragonBones": { "texPngData": { "url": "http://staging-teach.cdn.ireadabc.com/b095932007653f7aa4514570af991342.png", "name": "word_tex.png" }, "texJsonData": { "url": "http://staging-teach.cdn.ireadabc.com/4e2458f5632fbfdf6c5a1c66f8c77fe3.json", "name": "word_tex.json" }, "skeJsonData": { "url": "http://staging-teach.cdn.ireadabc.com/c83f14aeee5b533cb582887f5122bcef.json", "name": "word_ske.json" } }, "rightDragonBones": { "texPngData": { "url": "http://staging-teach.cdn.ireadabc.com/ccc42a2a6830dd5bddc67e727ebf717b.png", "name": "dragon_tex.png" }, "texJsonData": { "url": "http://staging-teach.cdn.ireadabc.com/830c92d3d3c73353cf43f03a0051123f.json", "name": "dragon_tex.json" }, "skeJsonData": { "url": "http://staging-teach.cdn.ireadabc.com/e1f26dedb60960b07f90bd42e5478ba6.json", "name": "dragon_ske.json" } }, "audio_url": "http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3", "text_audio_url": "http://staging-teach.cdn.ireadabc.com/99ddd7e2eaa495fa24c6d8ceec76a128.mp3", "right_audio_url": "http://staging-teach.cdn.ireadabc.com/315ca3d2ed808bb1cc0b6d26ac229d4c.mp3" }, { "video_url": "http://staging-teach.cdn.ireadabc.com/f8476aa86cfb6ea4d1fbb69578f606d7.mp4", "textDragonBones": { "texPngData": { "url": "http://staging-teach.cdn.ireadabc.com/b095932007653f7aa4514570af991342.png", "name": "word_tex.png" }, "texJsonData": { "url": "http://staging-teach.cdn.ireadabc.com/4e2458f5632fbfdf6c5a1c66f8c77fe3.json", "name": "word_tex.json" }, "skeJsonData": { "url": "http://staging-teach.cdn.ireadabc.com/c83f14aeee5b533cb582887f5122bcef.json", "name": "word_ske.json" } }, "rightDragonBones": { "texPngData": { "url": "http://staging-teach.cdn.ireadabc.com/ccc42a2a6830dd5bddc67e727ebf717b.png", "name": "dragon_tex.png" }, "texJsonData": { "url": "http://staging-teach.cdn.ireadabc.com/830c92d3d3c73353cf43f03a0051123f.json", "name": "dragon_tex.json" }, "skeJsonData": { "url": "http://staging-teach.cdn.ireadabc.com/e1f26dedb60960b07f90bd42e5478ba6.json", "name": "dragon_ske.json" } }, "audio_url": "http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3", "text_audio_url": "http://staging-teach.cdn.ireadabc.com/99ddd7e2eaa495fa24c6d8ceec76a128.mp3", "right_audio_url": "http://staging-teach.cdn.ireadabc.com/315ca3d2ed808bb1cc0b6d26ac229d4c.mp3" } ], "theme": "A" }, "border_image_url": "http://staging-teach.cdn.ireadabc.com/e9ce15bcb9165a8416799df5597f01e6.jpg", "video_image_url": "http://staging-teach.cdn.ireadabc.com/308cc7a44debd884b12508a7fcad83ab.jpg", "text_image_url": "http://staging-teach.cdn.ireadabc.com/389033602b7468ceb2a34845b0063ea1.jpg" }'
const dataJson = '{ "contentObj": { "version": "1.0", "key": "DataKey_Sbx_Pronunciation", "bgMusic": "", "titleText": "", "questionAudio_url": "", "birdDragonBones_1": {}, "birdDragonBones_2": {}, "birdDragonBones_audio": {}, "dataArray": [], "theme": "A" }, "border_image_url": "", "video_image_url": "", "text_image_url": "" }' // const dataJson = '{ "contentObj": { "version": "1.0", "key": "DataKey_Sbx_Pronunciation", "bgMusic": "", "titleText": "", "questionAudio_url": "", "birdDragonBones_1": {}, "birdDragonBones_2": {}, "birdDragonBones_audio": {}, "dataArray": [], "theme": "A" }, "border_image_url": "", "video_image_url": "", "text_image_url": "" }'
const data = JSON.parse(dataJson); const data = JSON.parse(dataJson);
return data; return data;
}, },
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<title>Cocos Creator | hello_world</title> <title>Cocos Creator | hello_world</title>
<meta
name="viewport"
content="width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1"
/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="yes" />
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<meta name="renderer" content="webkit" />
<meta name="force-rendering" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1"/> <link rel="stylesheet" type="text/css" href="style-desktop.css" />
<meta name="apple-mobile-web-app-capable" content="yes"/> <link rel="icon" href="favicon.ico" />
<meta name="full-screen" content="yes"/> </head>
<meta name="screen-orientation" content="portrait"/> <body>
<meta name="x5-fullscreen" content="true"/> <!-- <h1 class="header">hello_world</h1> -->
<meta name="360-fullscreen" content="true"/> <!-- <div id="GameDiv" style="width:1280px; height: 720px;"> -->
<canvas id="GameCanvas" width="100%" height="100%"></canvas>
<meta name="renderer" content="webkit"/> <div id="splash">
<meta name="force-rendering" content="webkit"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<link rel="stylesheet" type="text/css" href="style-desktop.css"/>
<link rel="icon" href="favicon.ico"/>
</head>
<body>
<!-- <h1 class="header">hello_world</h1> -->
<!-- <div id="GameDiv" style="width:1280px; height: 720px;"> -->
<canvas id="GameCanvas" width="100%" height="100%"></canvas>
<div id="splash">
<div class="progress-bar stripes"> <div class="progress-bar stripes">
<span style="width: 0%"></span> <span style="width: 0%"></span>
</div> </div>
</div> </div>
<!-- </div> --> <!-- </div> -->
<!-- <p class="footer">Made with <a href="https://www.cocos.com/products#CocosCreator" title="cocos creator">Cocos Creator</a></p> -->
<script src="src/settings.js" charset="utf-8"></script> <!-- <p class="footer">Made with <a href="https://www.cocos.com/products#CocosCreator" title="cocos creator">Cocos Creator</a></p> -->
<!-- <script src="main.js" charset="utf-8"></script> -->
<script src="http://www.datalist.com.cn/vender/javascript/cocos/main.js" charset="utf-8"></script>
<script type="text/javascript" src="https://staging-teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air.js"></script>
<script src="src/settings.js" charset="utf-8"></script>
<!-- <script src="main.js" charset="utf-8"></script> -->
<script
type="text/javascript"
src="https://staging-teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air.js"
></script>
<script type="text/javascript"> <script type="text/javascript">
(function () { (function () {
// open web debugger console // open web debugger console
if (typeof VConsole !== 'undefined') { if (typeof VConsole !== "undefined") {
window.vConsole = new VConsole(); window.vConsole = new VConsole();
} }
var debug = window._CCSettings.debug; var debug = window._CCSettings.debug;
var splash = document.getElementById('splash'); var splash = document.getElementById("splash");
splash.style.display = 'block'; splash.style.display = "block";
function loadScript (moduleName, cb) { function loadScript(moduleName, cb) {
function scriptLoaded () { function scriptLoaded() {
document.body.removeChild(domScript); document.body.removeChild(domScript);
domScript.removeEventListener('load', scriptLoaded, false); domScript.removeEventListener("load", scriptLoaded, false);
cb && cb(); cb && cb();
}; }
var domScript = document.createElement('script'); var domScript = document.createElement("script");
domScript.async = true; domScript.async = true;
domScript.src = moduleName; domScript.src = moduleName;
domScript.addEventListener('load', scriptLoaded, false); domScript.addEventListener("load", scriptLoaded, false);
document.body.appendChild(domScript); document.body.appendChild(domScript);
} }
loadScript(debug ? 'cocos2d-js.js' : 'cocos2d-js-min.js', function () { loadScript(debug ? "cocos2d-js.js" : "cocos2d-js-min.js", function () {
if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) { if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
loadScript(debug ? 'physics.js' : 'physics-min.js', window.boot); loadScript(debug ? "physics.js" : "physics-min.js", window.boot);
} } else {
else {
// cc.macro.ENABLE_TRANSPARENT_CANVAS = true; // cc.macro.ENABLE_TRANSPARENT_CANVAS = true;
// cc.director.setClearColor(new cc.Color(255 ,255 ,255 , 0)); // cc.director.setClearColor(new cc.Color(255 ,255 ,255 , 0));
window.boot(); window.boot();
} }
}); });
})(); })();
</script>
window.boot = function () {
var settings = window._CCSettings;
window._CCSettings = undefined;
var onProgress = null;
let {
RESOURCES,
INTERNAL,
MAIN,
START_SCENE,
} = cc.AssetManager.BuiltinBundleName;
function setLoadingDisplay() {
// Loading splash scene
var splash = document.getElementById("splash");
var progressBar = splash.querySelector(".progress-bar span");
onProgress = function (finish, total) {
var percent = (100 * finish) / total;
if (progressBar) {
progressBar.style.width = percent.toFixed(2) + "%";
}
};
splash.style.display = "block";
progressBar.style.width = "0%";
cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () {
splash.style.display = "none";
});
}
var onStart = function () {
cc.view.enableRetina(true);
cc.view.resizeWithBrowserSize(true);
if (cc.sys.isBrowser) {
setLoadingDisplay();
}
if (cc.sys.isMobile) {
if (settings.orientation === "landscape") {
cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE);
} else if (settings.orientation === "portrait") {
cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT);
}
cc.view.enableAutoFullScreen(
[
cc.sys.BROWSER_TYPE_BAIDU,
cc.sys.BROWSER_TYPE_BAIDU_APP,
cc.sys.BROWSER_TYPE_WECHAT,
cc.sys.BROWSER_TYPE_MOBILE_QQ,
cc.sys.BROWSER_TYPE_MIUI,
].indexOf(cc.sys.browserType) < 0
);
}
// Limit downloading max concurrent task to 2,
// more tasks simultaneously may cause performance draw back on some android system / browsers.
// You can adjust the number based on your own test result, you have to set it before any loading process to take effect.
if (cc.sys.isBrowser && cc.sys.os === cc.sys.OS_ANDROID) {
cc.assetManager.downloader.maxConcurrency = 2;
cc.assetManager.downloader.maxRequestsPerFrame = 2;
}
var launchScene = settings.launchScene;
var bundle = cc.assetManager.bundles.find(function (b) {
return b.getSceneInfo(launchScene);
});
bundle.loadScene(
launchScene,
null,
onProgress,
function (err, scene) {
if (!err) {
cc.director.runSceneImmediate(scene);
if (cc.sys.isBrowser) {
// show canvas
var canvas = document.getElementById("GameCanvas");
canvas.style.visibility = "";
var div = document.getElementById("GameDiv");
if (div) {
div.style.backgroundImage = "";
}
console.log("Success to load scene: " + launchScene);
}
}
}
);
};
var option = {
id: "GameCanvas",
debugMode: settings.debug
? cc.debug.DebugMode.INFO
: cc.debug.DebugMode.ERROR,
showFPS: settings.debug,
frameRate: 60,
groupList: settings.groupList,
collisionMatrix: settings.collisionMatrix,
};
cc.assetManager.init({
bundleVers: settings.bundleVers,
remoteBundles: settings.remoteBundles,
server: settings.server,
});
let bundleRoot = [INTERNAL, MAIN];
settings.hasStartSceneBundle && bundleRoot.push(START_SCENE);
settings.hasResourcesBundle && bundleRoot.push(RESOURCES);
var count = 0;
function cb(err) {
if (err) return console.error(err.message, err.stack);
count++;
if (count === bundleRoot.length + 1) {
cc.macro.ENABLE_TRANSPARENT_CANVAS = true;
cc.director.setClearColor(cc.color(255, 255, 255, 0));
cc.game.run(option, onStart);
}
}
</body> cc.assetManager.loadScript(
settings.jsList.map(function (x) {
return "src/" + x;
}),
cb
);
for (let i = 0; i < bundleRoot.length; i++) {
cc.assetManager.loadBundle(bundleRoot[i], cb);
}
};
if (window.jsb) {
var isRuntime = typeof loadRuntime === "function";
if (isRuntime) {
require("src/settings.js");
require("src/cocos2d-runtime.js");
if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
require("src/physics.js");
}
require("jsb-adapter/engine/index.js");
} else {
require("src/settings.js");
require("src/cocos2d-jsb.js");
if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
require("src/physics.js");
}
require("jsb-adapter/jsb-engine.js");
}
cc.macro.CLEANUP_IMAGE_CACHE = true;
window.boot();
}
</script>
</body>
</html> </html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment