add xml parse to Json
Showing
17 changed files
with
1248 additions
and
17 deletions
... | @@ -41,8 +41,8 @@ | ... | @@ -41,8 +41,8 @@ |
41 | }, | 41 | }, |
42 | "_scale": { | 42 | "_scale": { |
43 | "__type__": "cc.Vec3", | 43 | "__type__": "cc.Vec3", |
44 | "x": 0.27132086548953405, | 44 | "x": 0.13871663973241932, |
45 | "y": 0.27132086548953405, | 45 | "y": 0.13871663973241932, |
46 | "z": 1 | 46 | "z": 1 |
47 | }, | 47 | }, |
48 | "_quat": { | 48 | "_quat": { |
... | @@ -288,8 +288,8 @@ | ... | @@ -288,8 +288,8 @@ |
288 | "__id__": 5 | 288 | "__id__": 5 |
289 | }, | 289 | }, |
290 | "_enabled": true, | 290 | "_enabled": true, |
291 | "_srcBlendFactor": 770, | 291 | "_srcBlendFactor": 1, |
292 | "_dstBlendFactor": 771, | 292 | "_dstBlendFactor": 769, |
293 | "_spriteFrame": { | 293 | "_spriteFrame": { |
294 | "__uuid__": "14f1599c-036c-486d-abf5-b3566ed39f15" | 294 | "__uuid__": "14f1599c-036c-486d-abf5-b3566ed39f15" |
295 | }, | 295 | }, |
... | @@ -406,7 +406,7 @@ | ... | @@ -406,7 +406,7 @@ |
406 | "__id__": 8 | 406 | "__id__": 8 |
407 | }, | 407 | }, |
408 | "_enabled": true, | 408 | "_enabled": true, |
409 | "_srcBlendFactor": 770, | 409 | "_srcBlendFactor": 1, |
410 | "_dstBlendFactor": 771, | 410 | "_dstBlendFactor": 771, |
411 | "_spriteFrame": { | 411 | "_spriteFrame": { |
412 | "__uuid__": "987745dd-03d6-4de5-b98e-1d5e75c9f2d3" | 412 | "__uuid__": "987745dd-03d6-4de5-b98e-1d5e75c9f2d3" | ... | ... |
assets/Scene/sceneExploreNew.fire
0 → 100644
1 | [ | ||
2 | { | ||
3 | "__type__": "cc.SceneAsset", | ||
4 | "_name": "", | ||
5 | "_objFlags": 0, | ||
6 | "_native": "", | ||
7 | "scene": { | ||
8 | "__id__": 1 | ||
9 | } | ||
10 | }, | ||
11 | { | ||
12 | "__type__": "cc.Scene", | ||
13 | "_objFlags": 0, | ||
14 | "_parent": null, | ||
15 | "_children": [ | ||
16 | { | ||
17 | "__id__": 2 | ||
18 | } | ||
19 | ], | ||
20 | "_active": true, | ||
21 | "_level": 0, | ||
22 | "_components": [], | ||
23 | "_prefab": null, | ||
24 | "_opacity": 255, | ||
25 | "_color": { | ||
26 | "__type__": "cc.Color", | ||
27 | "r": 255, | ||
28 | "g": 255, | ||
29 | "b": 255, | ||
30 | "a": 255 | ||
31 | }, | ||
32 | "_contentSize": { | ||
33 | "__type__": "cc.Size", | ||
34 | "width": 0, | ||
35 | "height": 0 | ||
36 | }, | ||
37 | "_anchorPoint": { | ||
38 | "__type__": "cc.Vec2", | ||
39 | "x": 0, | ||
40 | "y": 0 | ||
41 | }, | ||
42 | "_scale": { | ||
43 | "__type__": "cc.Vec3", | ||
44 | "x": 0.1, | ||
45 | "y": 0.1, | ||
46 | "z": 1 | ||
47 | }, | ||
48 | "_quat": { | ||
49 | "__type__": "cc.Quat", | ||
50 | "x": 0, | ||
51 | "y": 0, | ||
52 | "z": 0, | ||
53 | "w": 1 | ||
54 | }, | ||
55 | "groupIndex": 0, | ||
56 | "autoReleaseAssets": false, | ||
57 | "_id": "c5bb6714-76a5-4b23-9585-4546b56bcd8e" | ||
58 | }, | ||
59 | { | ||
60 | "__type__": "cc.Node", | ||
61 | "_name": "Canvas", | ||
62 | "_objFlags": 0, | ||
63 | "_parent": { | ||
64 | "__id__": 1 | ||
65 | }, | ||
66 | "_children": [ | ||
67 | { | ||
68 | "__id__": 3 | ||
69 | }, | ||
70 | { | ||
71 | "__id__": 5 | ||
72 | }, | ||
73 | { | ||
74 | "__id__": 8 | ||
75 | } | ||
76 | ], | ||
77 | "_active": true, | ||
78 | "_level": 0, | ||
79 | "_components": [ | ||
80 | { | ||
81 | "__id__": 10 | ||
82 | }, | ||
83 | { | ||
84 | "__id__": 11 | ||
85 | } | ||
86 | ], | ||
87 | "_prefab": null, | ||
88 | "_opacity": 255, | ||
89 | "_color": { | ||
90 | "__type__": "cc.Color", | ||
91 | "r": 255, | ||
92 | "g": 255, | ||
93 | "b": 255, | ||
94 | "a": 255 | ||
95 | }, | ||
96 | "_contentSize": { | ||
97 | "__type__": "cc.Size", | ||
98 | "width": 960, | ||
99 | "height": 640 | ||
100 | }, | ||
101 | "_anchorPoint": { | ||
102 | "__type__": "cc.Vec2", | ||
103 | "x": 0.5, | ||
104 | "y": 0.5 | ||
105 | }, | ||
106 | "_position": { | ||
107 | "__type__": "cc.Vec3", | ||
108 | "x": 480, | ||
109 | "y": 320, | ||
110 | "z": 0 | ||
111 | }, | ||
112 | "_scale": { | ||
113 | "__type__": "cc.Vec3", | ||
114 | "x": 1, | ||
115 | "y": 1, | ||
116 | "z": 1 | ||
117 | }, | ||
118 | "_rotationX": 0, | ||
119 | "_rotationY": 0, | ||
120 | "_quat": { | ||
121 | "__type__": "cc.Quat", | ||
122 | "x": 0, | ||
123 | "y": 0, | ||
124 | "z": 0, | ||
125 | "w": 1 | ||
126 | }, | ||
127 | "_skewX": 0, | ||
128 | "_skewY": 0, | ||
129 | "groupIndex": 0, | ||
130 | "_id": "2enr7NbbJA+ohEBDG12MuR" | ||
131 | }, | ||
132 | { | ||
133 | "__type__": "cc.Node", | ||
134 | "_name": "Main Camera", | ||
135 | "_objFlags": 0, | ||
136 | "_parent": { | ||
137 | "__id__": 2 | ||
138 | }, | ||
139 | "_children": [], | ||
140 | "_active": true, | ||
141 | "_level": 1, | ||
142 | "_components": [ | ||
143 | { | ||
144 | "__id__": 4 | ||
145 | } | ||
146 | ], | ||
147 | "_prefab": null, | ||
148 | "_opacity": 255, | ||
149 | "_color": { | ||
150 | "__type__": "cc.Color", | ||
151 | "r": 255, | ||
152 | "g": 255, | ||
153 | "b": 255, | ||
154 | "a": 255 | ||
155 | }, | ||
156 | "_contentSize": { | ||
157 | "__type__": "cc.Size", | ||
158 | "width": 0, | ||
159 | "height": 0 | ||
160 | }, | ||
161 | "_anchorPoint": { | ||
162 | "__type__": "cc.Vec2", | ||
163 | "x": 0.5, | ||
164 | "y": 0.5 | ||
165 | }, | ||
166 | "_position": { | ||
167 | "__type__": "cc.Vec3", | ||
168 | "x": 0, | ||
169 | "y": 0, | ||
170 | "z": 0 | ||
171 | }, | ||
172 | "_scale": { | ||
173 | "__type__": "cc.Vec3", | ||
174 | "x": 1, | ||
175 | "y": 1, | ||
176 | "z": 1 | ||
177 | }, | ||
178 | "_rotationX": 0, | ||
179 | "_rotationY": 0, | ||
180 | "_quat": { | ||
181 | "__type__": "cc.Quat", | ||
182 | "x": 0, | ||
183 | "y": 0, | ||
184 | "z": 0, | ||
185 | "w": 1 | ||
186 | }, | ||
187 | "_skewX": 0, | ||
188 | "_skewY": 0, | ||
189 | "groupIndex": 0, | ||
190 | "_id": "6axvtUu8JLGYQswZVb5i5t" | ||
191 | }, | ||
192 | { | ||
193 | "__type__": "cc.Camera", | ||
194 | "_name": "", | ||
195 | "_objFlags": 0, | ||
196 | "node": { | ||
197 | "__id__": 3 | ||
198 | }, | ||
199 | "_enabled": true, | ||
200 | "_cullingMask": 4294967295, | ||
201 | "_clearFlags": 7, | ||
202 | "_backgroundColor": { | ||
203 | "__type__": "cc.Color", | ||
204 | "r": 0, | ||
205 | "g": 0, | ||
206 | "b": 0, | ||
207 | "a": 255 | ||
208 | }, | ||
209 | "_depth": -1, | ||
210 | "_zoomRatio": 1, | ||
211 | "_targetTexture": null, | ||
212 | "_id": "dfrdGSAPdDCpridUZu5giH" | ||
213 | }, | ||
214 | { | ||
215 | "__type__": "cc.Node", | ||
216 | "_name": "Bg_long", | ||
217 | "_objFlags": 0, | ||
218 | "_parent": { | ||
219 | "__id__": 2 | ||
220 | }, | ||
221 | "_children": [], | ||
222 | "_active": true, | ||
223 | "_level": 1, | ||
224 | "_components": [ | ||
225 | { | ||
226 | "__id__": 6 | ||
227 | }, | ||
228 | { | ||
229 | "__id__": 7 | ||
230 | } | ||
231 | ], | ||
232 | "_prefab": null, | ||
233 | "_opacity": 255, | ||
234 | "_color": { | ||
235 | "__type__": "cc.Color", | ||
236 | "r": 255, | ||
237 | "g": 255, | ||
238 | "b": 255, | ||
239 | "a": 255 | ||
240 | }, | ||
241 | "_contentSize": { | ||
242 | "__type__": "cc.Size", | ||
243 | "width": 7280, | ||
244 | "height": 1110 | ||
245 | }, | ||
246 | "_anchorPoint": { | ||
247 | "__type__": "cc.Vec2", | ||
248 | "x": 0.5, | ||
249 | "y": 0.5 | ||
250 | }, | ||
251 | "_position": { | ||
252 | "__type__": "cc.Vec3", | ||
253 | "x": 0, | ||
254 | "y": 0, | ||
255 | "z": 0 | ||
256 | }, | ||
257 | "_scale": { | ||
258 | "__type__": "cc.Vec3", | ||
259 | "x": 1, | ||
260 | "y": 1, | ||
261 | "z": 1 | ||
262 | }, | ||
263 | "_rotationX": 0, | ||
264 | "_rotationY": 0, | ||
265 | "_quat": { | ||
266 | "__type__": "cc.Quat", | ||
267 | "x": 0, | ||
268 | "y": 0, | ||
269 | "z": 0, | ||
270 | "w": 1 | ||
271 | }, | ||
272 | "_skewX": 0, | ||
273 | "_skewY": 0, | ||
274 | "groupIndex": 0, | ||
275 | "_id": "9bJ6W6GQ9AuahEivQhXI7q" | ||
276 | }, | ||
277 | { | ||
278 | "__type__": "cc.Sprite", | ||
279 | "_name": "", | ||
280 | "_objFlags": 0, | ||
281 | "node": { | ||
282 | "__id__": 5 | ||
283 | }, | ||
284 | "_enabled": true, | ||
285 | "_srcBlendFactor": 770, | ||
286 | "_dstBlendFactor": 771, | ||
287 | "_spriteFrame": null, | ||
288 | "_type": 0, | ||
289 | "_sizeMode": 1, | ||
290 | "_fillType": 0, | ||
291 | "_fillCenter": { | ||
292 | "__type__": "cc.Vec2", | ||
293 | "x": 0, | ||
294 | "y": 0 | ||
295 | }, | ||
296 | "_fillStart": 0, | ||
297 | "_fillRange": 0, | ||
298 | "_isTrimmedMode": true, | ||
299 | "_state": 0, | ||
300 | "_atlas": null, | ||
301 | "_id": "71UYoTd3tBYZmtHLuAObd3" | ||
302 | }, | ||
303 | { | ||
304 | "__type__": "cc.Animation", | ||
305 | "_name": "", | ||
306 | "_objFlags": 0, | ||
307 | "node": { | ||
308 | "__id__": 5 | ||
309 | }, | ||
310 | "_enabled": true, | ||
311 | "_defaultClip": { | ||
312 | "__uuid__": "e0232f2e-c019-4cec-ac64-1cdf42ad3792" | ||
313 | }, | ||
314 | "_clips": [ | ||
315 | { | ||
316 | "__uuid__": "e0232f2e-c019-4cec-ac64-1cdf42ad3792" | ||
317 | } | ||
318 | ], | ||
319 | "playOnLoad": true, | ||
320 | "_id": "c6mMiohwNG6pU+M0q1YOzM" | ||
321 | }, | ||
322 | { | ||
323 | "__type__": "cc.Node", | ||
324 | "_name": "Hero", | ||
325 | "_objFlags": 0, | ||
326 | "_parent": { | ||
327 | "__id__": 2 | ||
328 | }, | ||
329 | "_children": [], | ||
330 | "_active": true, | ||
331 | "_level": 1, | ||
332 | "_components": [ | ||
333 | { | ||
334 | "__id__": 9 | ||
335 | } | ||
336 | ], | ||
337 | "_prefab": null, | ||
338 | "_opacity": 255, | ||
339 | "_color": { | ||
340 | "__type__": "cc.Color", | ||
341 | "r": 255, | ||
342 | "g": 255, | ||
343 | "b": 255, | ||
344 | "a": 255 | ||
345 | }, | ||
346 | "_contentSize": { | ||
347 | "__type__": "cc.Size", | ||
348 | "width": 0, | ||
349 | "height": 0 | ||
350 | }, | ||
351 | "_anchorPoint": { | ||
352 | "__type__": "cc.Vec2", | ||
353 | "x": 0.5, | ||
354 | "y": 0.5 | ||
355 | }, | ||
356 | "_position": { | ||
357 | "__type__": "cc.Vec3", | ||
358 | "x": -229, | ||
359 | "y": -220, | ||
360 | "z": 0 | ||
361 | }, | ||
362 | "_scale": { | ||
363 | "__type__": "cc.Vec3", | ||
364 | "x": 1, | ||
365 | "y": 1, | ||
366 | "z": 1 | ||
367 | }, | ||
368 | "_rotationX": 0, | ||
369 | "_rotationY": 0, | ||
370 | "_quat": { | ||
371 | "__type__": "cc.Quat", | ||
372 | "x": 0, | ||
373 | "y": 0, | ||
374 | "z": 0, | ||
375 | "w": 1 | ||
376 | }, | ||
377 | "_skewX": 0, | ||
378 | "_skewY": 0, | ||
379 | "groupIndex": 0, | ||
380 | "_id": "8cq0Mn63pN2YDLO5ii37LQ" | ||
381 | }, | ||
382 | { | ||
383 | "__type__": "dragonBones.ArmatureDisplay", | ||
384 | "_name": "", | ||
385 | "_objFlags": 0, | ||
386 | "node": { | ||
387 | "__id__": 8 | ||
388 | }, | ||
389 | "_enabled": true, | ||
390 | "_armatureName": "armatureName", | ||
391 | "_animationName": "Animation1", | ||
392 | "_preCacheMode": 0, | ||
393 | "_cacheMode": 0, | ||
394 | "playTimes": -1, | ||
395 | "premultipliedAlpha": false, | ||
396 | "_armatureKey": "e3ad9b78-ae63-4929-81c2-5781ca616f08#cdd960ea-e3ab-4991-a37d-3f8f88243de7", | ||
397 | "_accTime": 0, | ||
398 | "_playCount": 0, | ||
399 | "_frameCache": null, | ||
400 | "_curFrame": null, | ||
401 | "_playing": false, | ||
402 | "_armatureCache": null, | ||
403 | "_N$dragonAsset": { | ||
404 | "__uuid__": "e3ad9b78-ae63-4929-81c2-5781ca616f08" | ||
405 | }, | ||
406 | "_N$dragonAtlasAsset": { | ||
407 | "__uuid__": "cdd960ea-e3ab-4991-a37d-3f8f88243de7" | ||
408 | }, | ||
409 | "_N$_defaultArmatureIndex": 0, | ||
410 | "_N$_animationIndex": 1, | ||
411 | "_N$_defaultCacheMode": 0, | ||
412 | "_N$timeScale": 1, | ||
413 | "_N$debugBones": false, | ||
414 | "_N$enableBatch": false, | ||
415 | "_id": "69fvvqS0tJHpuXMcwVczRW" | ||
416 | }, | ||
417 | { | ||
418 | "__type__": "cc.Canvas", | ||
419 | "_name": "", | ||
420 | "_objFlags": 0, | ||
421 | "node": { | ||
422 | "__id__": 2 | ||
423 | }, | ||
424 | "_enabled": true, | ||
425 | "_designResolution": { | ||
426 | "__type__": "cc.Size", | ||
427 | "width": 960, | ||
428 | "height": 640 | ||
429 | }, | ||
430 | "_fitWidth": false, | ||
431 | "_fitHeight": true, | ||
432 | "_id": "72z44+175OfaMOhtsD1Huo" | ||
433 | }, | ||
434 | { | ||
435 | "__type__": "46717GP6RtOGobAYIAnkxCA", | ||
436 | "_name": "", | ||
437 | "_objFlags": 0, | ||
438 | "node": { | ||
439 | "__id__": 2 | ||
440 | }, | ||
441 | "_enabled": true, | ||
442 | "_cLog": null, | ||
443 | "_cApplication": null, | ||
444 | "_cFocus": null, | ||
445 | "_aFocusTargets": [], | ||
446 | "_fiCurrentFocus": null, | ||
447 | "_iSceneStatus": 0, | ||
448 | "_fFocusScaleFactor": 1.06, | ||
449 | "_bIsFocusInit": false, | ||
450 | "_oSceneContext": null, | ||
451 | "_oNextSceneParameter": null, | ||
452 | "_compPlayer": null, | ||
453 | "_aTouchContext": [], | ||
454 | "_defaultBackScene": null, | ||
455 | "_oFocusScaleFactorInfo": null, | ||
456 | "holdClick": false, | ||
457 | "_bShowExitBox": false, | ||
458 | "_id": "01a+mE585Ho7WhSVhlk2o5" | ||
459 | } | ||
460 | ] | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
assets/Scene/sceneExploreNew.fire.meta
0 → 100644
... | @@ -19,7 +19,7 @@ cc.Class({ | ... | @@ -19,7 +19,7 @@ cc.Class({ |
19 | 19 | ||
20 | onLoad: function () { | 20 | onLoad: function () { |
21 | this._super(); | 21 | this._super(); |
22 | this._hero_start_x = 500; | 22 | this._hero_start_x = 400; |
23 | this.bg_1 = this.node.getChildByName("bg_1"); | 23 | this.bg_1 = this.node.getChildByName("bg_1"); |
24 | this.bg_2 = this.node.getChildByName("bg_2"); | 24 | this.bg_2 = this.node.getChildByName("bg_2"); |
25 | this.cur_bg = this.bg_1; | 25 | this.cur_bg = this.bg_1; |
... | @@ -28,6 +28,8 @@ cc.Class({ | ... | @@ -28,6 +28,8 @@ cc.Class({ |
28 | this.animLayer = this.testmap.getComponent(cc.TiledMap).getLayer("Animal"); | 28 | this.animLayer = this.testmap.getComponent(cc.TiledMap).getLayer("Animal"); |
29 | this.hero = this.node.getChildByName("hero"); | 29 | this.hero = this.node.getChildByName("hero"); |
30 | this._hero_y = this.hero.y; | 30 | this._hero_y = this.hero.y; |
31 | |||
32 | this.startRun=true; | ||
31 | }, | 33 | }, |
32 | 34 | ||
33 | keyDownDirection: function (Direct) { | 35 | keyDownDirection: function (Direct) { |
... | @@ -70,8 +72,9 @@ cc.Class({ | ... | @@ -70,8 +72,9 @@ cc.Class({ |
70 | case cc.macro.KEY.enter: | 72 | case cc.macro.KEY.enter: |
71 | case cc.macro.KEY.space: | 73 | case cc.macro.KEY.space: |
72 | case Common.ANDROID_KEY.enter: | 74 | case Common.ANDROID_KEY.enter: |
73 | this._hero_start_x += 100; | 75 | // this._hero_start_x += 100; //造成误差 |
74 | this._speed = 1; | 76 | this._speed = 1; |
77 | this.startRun=true; | ||
75 | // this.hero.getComponent(dragonBones.ArmatureDisplay).playAnimation("Animation1"); | 78 | // this.hero.getComponent(dragonBones.ArmatureDisplay).playAnimation("Animation1"); |
76 | // this.doCurrentFocusTVLinkAction(Common.TV_LINK_ACTION_CLICK); | 79 | // this.doCurrentFocusTVLinkAction(Common.TV_LINK_ACTION_CLICK); |
77 | break; | 80 | break; |
... | @@ -92,23 +95,27 @@ cc.Class({ | ... | @@ -92,23 +95,27 @@ cc.Class({ |
92 | this.bg_2.x = this.bg_1.x + 1820; | 95 | this.bg_2.x = this.bg_1.x + 1820; |
93 | this.cur_bg = this.bg_1; | 96 | this.cur_bg = this.bg_1; |
94 | } else { | 97 | } else { |
95 | this.bg_1.x = this.bg_2.x + 1820; | 98 | this.bg_1.x = this.bg_2.x + 1815; |
96 | this.cur_bg = this.bg_2; | 99 | this.cur_bg = this.bg_2; |
97 | } | 100 | } |
98 | } | 101 | } |
99 | 102 | ||
103 | // cc.log("背景图位置:"+this.cur_bg.x); | ||
104 | |||
100 | // cc.log("hero位置--------》" + this._hero_start_x); | 105 | // cc.log("hero位置--------》" + this._hero_start_x); |
101 | var pos = this._getTilePos(cc.v2(this._hero_start_x, 4)); | 106 | var pos = this._getTilePos(cc.v2(this._hero_start_x, 4)); |
107 | // cc.log("pos位置------------------》"+pos); | ||
102 | // cc.log("位置----------》"+pos); | 108 | // cc.log("位置----------》"+pos); |
103 | if (this._hero_start_x < this._hero_end_x) { //不能超过瓦片地图最长长度 | 109 | // if (this._hero_start_x < this._hero_end_x) { //不能超过瓦片地图最长长度 |
104 | //判断gid是否为0,该地图位置就会出现障碍物 | 110 | // //判断gid是否为0,该地图位置就会出现障碍物 |
105 | var gid = this.animLayer.getTileGIDAt(pos); | 111 | // var gid = this.animLayer.getTileGIDAt(pos); |
106 | // cc.log("gid========" + gid); | 112 | // // cc.log("gid========" + gid); |
107 | if (gid != 0) { | 113 | // if (gid != 0 && this.startRun) { |
108 | this._speed = 0; | 114 | // this.startRun=false; |
109 | this.hero.getComponent(dragonBones.ArmatureDisplay).playAnimation(""); | 115 | // this._speed = 0; |
110 | } | 116 | // this.hero.getComponent(dragonBones.ArmatureDisplay).playAnimation(""); |
111 | } | 117 | // } |
118 | // } | ||
112 | }, | 119 | }, |
113 | 120 | ||
114 | doCurrentFocusTVLinkAction: function (strAction) { | 121 | doCurrentFocusTVLinkAction: function (strAction) { | ... | ... |
assets/Script/ExploreNew.js
0 → 100644
1 | var Common = require('Common'); | ||
2 | var Network = require('Network'); | ||
3 | var TVFocus = require('TVFocus'); | ||
4 | var FocusInfo = require('FocusInfo'); | ||
5 | var TVCanvas = require('TVCanvas'); | ||
6 | var TVScrollParameter = require('TVScrollParameter'); | ||
7 | var ListView = require('ListView'); | ||
8 | var ListCell = require('ListCell'); | ||
9 | var xmlToJSON=require('xmlToJSON'); | ||
10 | |||
11 | cc.Class({ | ||
12 | extends: TVCanvas, | ||
13 | |||
14 | properties: { | ||
15 | |||
16 | }, | ||
17 | |||
18 | onLoad: function () { | ||
19 | this._super(); | ||
20 | |||
21 | var self=this; | ||
22 | //动态加载背景图,需指定类型(需要拼接图片),指定尺寸(目前使用的是7280*720) | ||
23 | cc.loader.loadRes("game/explore_plus", cc.Texture2D, function (err, texture) { | ||
24 | self.node.getChildByName("Bg_long").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture); | ||
25 | }); | ||
26 | |||
27 | cc.loader.loadRes("config/explore_config",function(err,str){ | ||
28 | cc.log("源xml--------------->"+str); | ||
29 | // var result=xmlToJSON.parseString(str); | ||
30 | var x2js = new xmlToJSON(); | ||
31 | var result=x2js.xml_str2json(str); | ||
32 | cc.log("解析后xml------------>"+JSON.stringify(result)); | ||
33 | cc.log("解析后xml------------>"+result.root.explore[0]["_choice2"]); | ||
34 | // cc.log("解析后xml------------>"+result.root[0].explore[0]["_attr"].name["_value"]); | ||
35 | }) | ||
36 | }, | ||
37 | |||
38 | update:function(){ | ||
39 | // cc.log("背景图片-----------------》"+this.node.getChildByName("Bg_long").x); | ||
40 | }, | ||
41 | |||
42 | }); |
assets/Script/ExploreNew.js.meta
0 → 100644
assets/Script/custom/xmlToJSON.js
0 → 100644
1 | /* | ||
2 | Copyright 2011-2013 Abdulla Abdurakhmanov | ||
3 | Original sources are available at https://code.google.com/p/x2js/ | ||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | Unless required by applicable law or agreed to in writing, software | ||
9 | distributed under the License is distributed on an "AS IS" BASIS, | ||
10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
11 | See the License for the specific language governing permissions and | ||
12 | limitations under the License. | ||
13 | */ | ||
14 | |||
15 | (function (root, factory) { | ||
16 | if (typeof define === "function" && define.amd) { | ||
17 | define([], factory); | ||
18 | } else if (typeof exports === "object") { | ||
19 | module.exports = factory(); | ||
20 | } else { | ||
21 | root.X2JS = factory(); | ||
22 | } | ||
23 | }(this, function () { | ||
24 | return function (config) { | ||
25 | 'use strict'; | ||
26 | |||
27 | var VERSION = "1.2.0"; | ||
28 | |||
29 | config = config || {}; | ||
30 | initConfigDefaults(); | ||
31 | initRequiredPolyfills(); | ||
32 | |||
33 | function initConfigDefaults() { | ||
34 | if(config.escapeMode === undefined) { | ||
35 | config.escapeMode = true; | ||
36 | } | ||
37 | |||
38 | config.attributePrefix = config.attributePrefix || "_"; | ||
39 | config.arrayAccessForm = config.arrayAccessForm || "none"; | ||
40 | config.emptyNodeForm = config.emptyNodeForm || "text"; | ||
41 | |||
42 | if(config.enableToStringFunc === undefined) { | ||
43 | config.enableToStringFunc = true; | ||
44 | } | ||
45 | config.arrayAccessFormPaths = config.arrayAccessFormPaths || []; | ||
46 | if(config.skipEmptyTextNodesForObj === undefined) { | ||
47 | config.skipEmptyTextNodesForObj = true; | ||
48 | } | ||
49 | if(config.stripWhitespaces === undefined) { | ||
50 | config.stripWhitespaces = true; | ||
51 | } | ||
52 | config.datetimeAccessFormPaths = config.datetimeAccessFormPaths || []; | ||
53 | |||
54 | if(config.useDoubleQuotes === undefined) { | ||
55 | config.useDoubleQuotes = false; | ||
56 | } | ||
57 | |||
58 | config.xmlElementsFilter = config.xmlElementsFilter || []; | ||
59 | config.jsonPropertiesFilter = config.jsonPropertiesFilter || []; | ||
60 | |||
61 | if(config.keepCData === undefined) { | ||
62 | config.keepCData = false; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | var DOMNodeTypes = { | ||
67 | ELEMENT_NODE : 1, | ||
68 | TEXT_NODE : 3, | ||
69 | CDATA_SECTION_NODE : 4, | ||
70 | COMMENT_NODE : 8, | ||
71 | DOCUMENT_NODE : 9 | ||
72 | }; | ||
73 | |||
74 | function initRequiredPolyfills() { | ||
75 | } | ||
76 | |||
77 | function getNodeLocalName( node ) { | ||
78 | var nodeLocalName = node.localName; | ||
79 | if(nodeLocalName == null) // Yeah, this is IE!! | ||
80 | nodeLocalName = node.baseName; | ||
81 | if(nodeLocalName == null || nodeLocalName=="") // =="" is IE too | ||
82 | nodeLocalName = node.nodeName; | ||
83 | return nodeLocalName; | ||
84 | } | ||
85 | |||
86 | function getNodePrefix(node) { | ||
87 | return node.prefix; | ||
88 | } | ||
89 | |||
90 | function escapeXmlChars(str) { | ||
91 | if(typeof(str) == "string") | ||
92 | return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '''); | ||
93 | else | ||
94 | return str; | ||
95 | } | ||
96 | |||
97 | function unescapeXmlChars(str) { | ||
98 | return str.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, '&'); | ||
99 | } | ||
100 | |||
101 | function checkInStdFiltersArrayForm(stdFiltersArrayForm, obj, name, path) { | ||
102 | var idx = 0; | ||
103 | for(; idx < stdFiltersArrayForm.length; idx++) { | ||
104 | var filterPath = stdFiltersArrayForm[idx]; | ||
105 | if( typeof filterPath === "string" ) { | ||
106 | if(filterPath == path) | ||
107 | break; | ||
108 | } | ||
109 | else | ||
110 | if( filterPath instanceof RegExp) { | ||
111 | if(filterPath.test(path)) | ||
112 | break; | ||
113 | } | ||
114 | else | ||
115 | if( typeof filterPath === "function") { | ||
116 | if(filterPath(obj, name, path)) | ||
117 | break; | ||
118 | } | ||
119 | } | ||
120 | return idx!=stdFiltersArrayForm.length; | ||
121 | } | ||
122 | |||
123 | function toArrayAccessForm(obj, childName, path) { | ||
124 | switch(config.arrayAccessForm) { | ||
125 | case "property": | ||
126 | if(!(obj[childName] instanceof Array)) | ||
127 | obj[childName+"_asArray"] = [obj[childName]]; | ||
128 | else | ||
129 | obj[childName+"_asArray"] = obj[childName]; | ||
130 | break; | ||
131 | /*case "none": | ||
132 | break;*/ | ||
133 | } | ||
134 | |||
135 | if(!(obj[childName] instanceof Array) && config.arrayAccessFormPaths.length > 0) { | ||
136 | if(checkInStdFiltersArrayForm(config.arrayAccessFormPaths, obj, childName, path)) { | ||
137 | obj[childName] = [obj[childName]]; | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | |||
142 | function fromXmlDateTime(prop) { | ||
143 | // Implementation based up on http://stackoverflow.com/questions/8178598/xml-datetime-to-javascript-date-object | ||
144 | // Improved to support full spec and optional parts | ||
145 | var bits = prop.split(/[-T:+Z]/g); | ||
146 | |||
147 | var d = new Date(bits[0], bits[1]-1, bits[2]); | ||
148 | var secondBits = bits[5].split("\."); | ||
149 | d.setHours(bits[3], bits[4], secondBits[0]); | ||
150 | if(secondBits.length>1) | ||
151 | d.setMilliseconds(secondBits[1]); | ||
152 | |||
153 | // Get supplied time zone offset in minutes | ||
154 | if(bits[6] && bits[7]) { | ||
155 | var offsetMinutes = bits[6] * 60 + Number(bits[7]); | ||
156 | var sign = /\d\d-\d\d:\d\d$/.test(prop)? '-' : '+'; | ||
157 | |||
158 | // Apply the sign | ||
159 | offsetMinutes = 0 + (sign == '-'? -1 * offsetMinutes : offsetMinutes); | ||
160 | |||
161 | // Apply offset and local timezone | ||
162 | d.setMinutes(d.getMinutes() - offsetMinutes - d.getTimezoneOffset()) | ||
163 | } | ||
164 | else | ||
165 | if(prop.indexOf("Z", prop.length - 1) !== -1) { | ||
166 | d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds())); | ||
167 | } | ||
168 | |||
169 | // d is now a local time equivalent to the supplied time | ||
170 | return d; | ||
171 | } | ||
172 | |||
173 | function checkFromXmlDateTimePaths(value, childName, fullPath) { | ||
174 | if(config.datetimeAccessFormPaths.length > 0) { | ||
175 | var path = fullPath.split("\.#")[0]; | ||
176 | if(checkInStdFiltersArrayForm(config.datetimeAccessFormPaths, value, childName, path)) { | ||
177 | return fromXmlDateTime(value); | ||
178 | } | ||
179 | else | ||
180 | return value; | ||
181 | } | ||
182 | else | ||
183 | return value; | ||
184 | } | ||
185 | |||
186 | function checkXmlElementsFilter(obj, childType, childName, childPath) { | ||
187 | if( childType == DOMNodeTypes.ELEMENT_NODE && config.xmlElementsFilter.length > 0) { | ||
188 | return checkInStdFiltersArrayForm(config.xmlElementsFilter, obj, childName, childPath); | ||
189 | } | ||
190 | else | ||
191 | return true; | ||
192 | } | ||
193 | |||
194 | function parseDOMChildren( node, path ) { | ||
195 | if(node.nodeType == DOMNodeTypes.DOCUMENT_NODE) { | ||
196 | var result = new Object; | ||
197 | var nodeChildren = node.childNodes; | ||
198 | // Alternative for firstElementChild which is not supported in some environments | ||
199 | for(var cidx=0; cidx <nodeChildren.length; cidx++) { | ||
200 | var child = nodeChildren.item(cidx); | ||
201 | if(child.nodeType == DOMNodeTypes.ELEMENT_NODE) { | ||
202 | var childName = getNodeLocalName(child); | ||
203 | result[childName] = parseDOMChildren(child, childName); | ||
204 | } | ||
205 | } | ||
206 | return result; | ||
207 | } | ||
208 | else | ||
209 | if(node.nodeType == DOMNodeTypes.ELEMENT_NODE) { | ||
210 | var result = new Object; | ||
211 | result.__cnt=0; | ||
212 | |||
213 | var nodeChildren = node.childNodes; | ||
214 | |||
215 | // Children nodes | ||
216 | for(var cidx=0; cidx <nodeChildren.length; cidx++) { | ||
217 | var child = nodeChildren.item(cidx); // nodeChildren[cidx]; | ||
218 | var childName = getNodeLocalName(child); | ||
219 | |||
220 | if(child.nodeType!= DOMNodeTypes.COMMENT_NODE) { | ||
221 | var childPath = path+"."+childName; | ||
222 | if (checkXmlElementsFilter(result,child.nodeType,childName,childPath)) { | ||
223 | result.__cnt++; | ||
224 | if(result[childName] == null) { | ||
225 | result[childName] = parseDOMChildren(child, childPath); | ||
226 | toArrayAccessForm(result, childName, childPath); | ||
227 | } | ||
228 | else { | ||
229 | if(result[childName] != null) { | ||
230 | if( !(result[childName] instanceof Array)) { | ||
231 | result[childName] = [result[childName]]; | ||
232 | toArrayAccessForm(result, childName, childPath); | ||
233 | } | ||
234 | } | ||
235 | (result[childName])[result[childName].length] = parseDOMChildren(child, childPath); | ||
236 | } | ||
237 | } | ||
238 | } | ||
239 | } | ||
240 | |||
241 | // Attributes | ||
242 | for(var aidx=0; aidx <node.attributes.length; aidx++) { | ||
243 | var attr = node.attributes.item(aidx); // [aidx]; | ||
244 | result.__cnt++; | ||
245 | result[config.attributePrefix+attr.name]=attr.value; | ||
246 | } | ||
247 | |||
248 | // Node namespace prefix | ||
249 | var nodePrefix = getNodePrefix(node); | ||
250 | if(nodePrefix!=null && nodePrefix!="") { | ||
251 | result.__cnt++; | ||
252 | result.__prefix=nodePrefix; | ||
253 | } | ||
254 | |||
255 | if(result["#text"]!=null) { | ||
256 | result.__text = result["#text"]; | ||
257 | if(result.__text instanceof Array) { | ||
258 | result.__text = result.__text.join("\n"); | ||
259 | } | ||
260 | //if(config.escapeMode) | ||
261 | // result.__text = unescapeXmlChars(result.__text); | ||
262 | if(config.stripWhitespaces) | ||
263 | result.__text = result.__text.trim(); | ||
264 | delete result["#text"]; | ||
265 | if(config.arrayAccessForm=="property") | ||
266 | delete result["#text_asArray"]; | ||
267 | result.__text = checkFromXmlDateTimePaths(result.__text, childName, path+"."+childName); | ||
268 | } | ||
269 | if(result["#cdata-section"]!=null) { | ||
270 | result.__cdata = result["#cdata-section"]; | ||
271 | delete result["#cdata-section"]; | ||
272 | if(config.arrayAccessForm=="property") | ||
273 | delete result["#cdata-section_asArray"]; | ||
274 | } | ||
275 | |||
276 | if( result.__cnt == 0 && config.emptyNodeForm=="text" ) { | ||
277 | result = ''; | ||
278 | } | ||
279 | else | ||
280 | if( result.__cnt == 1 && result.__text!=null ) { | ||
281 | result = result.__text; | ||
282 | } | ||
283 | else | ||
284 | if( result.__cnt == 1 && result.__cdata!=null && !config.keepCData ) { | ||
285 | result = result.__cdata; | ||
286 | } | ||
287 | else | ||
288 | if ( result.__cnt > 1 && result.__text!=null && config.skipEmptyTextNodesForObj) { | ||
289 | if( (config.stripWhitespaces && result.__text=="") || (result.__text.trim()=="")) { | ||
290 | delete result.__text; | ||
291 | } | ||
292 | } | ||
293 | delete result.__cnt; | ||
294 | |||
295 | if( config.enableToStringFunc && (result.__text!=null || result.__cdata!=null )) { | ||
296 | result.toString = function() { | ||
297 | return (this.__text!=null? this.__text:'')+( this.__cdata!=null ? this.__cdata:''); | ||
298 | }; | ||
299 | } | ||
300 | |||
301 | return result; | ||
302 | } | ||
303 | else | ||
304 | if(node.nodeType == DOMNodeTypes.TEXT_NODE || node.nodeType == DOMNodeTypes.CDATA_SECTION_NODE) { | ||
305 | return node.nodeValue; | ||
306 | } | ||
307 | } | ||
308 | |||
309 | function startTag(jsonObj, element, attrList, closed) { | ||
310 | var resultStr = "<"+ ( (jsonObj!=null && jsonObj.__prefix!=null)? (jsonObj.__prefix+":"):"") + element; | ||
311 | if(attrList!=null) { | ||
312 | for(var aidx = 0; aidx < attrList.length; aidx++) { | ||
313 | var attrName = attrList[aidx]; | ||
314 | var attrVal = jsonObj[attrName]; | ||
315 | if(config.escapeMode) | ||
316 | attrVal=escapeXmlChars(attrVal); | ||
317 | resultStr+=" "+attrName.substr(config.attributePrefix.length)+"="; | ||
318 | if(config.useDoubleQuotes) | ||
319 | resultStr+='"'+attrVal+'"'; | ||
320 | else | ||
321 | resultStr+="'"+attrVal+"'"; | ||
322 | } | ||
323 | } | ||
324 | if(!closed) | ||
325 | resultStr+=">"; | ||
326 | else | ||
327 | resultStr+="/>"; | ||
328 | return resultStr; | ||
329 | } | ||
330 | |||
331 | function endTag(jsonObj,elementName) { | ||
332 | return "</"+ (jsonObj.__prefix!=null? (jsonObj.__prefix+":"):"")+elementName+">"; | ||
333 | } | ||
334 | |||
335 | function endsWith(str, suffix) { | ||
336 | return str.indexOf(suffix, str.length - suffix.length) !== -1; | ||
337 | } | ||
338 | |||
339 | function jsonXmlSpecialElem ( jsonObj, jsonObjField ) { | ||
340 | if((config.arrayAccessForm=="property" && endsWith(jsonObjField.toString(),("_asArray"))) | ||
341 | || jsonObjField.toString().indexOf(config.attributePrefix)==0 | ||
342 | || jsonObjField.toString().indexOf("__")==0 | ||
343 | || (jsonObj[jsonObjField] instanceof Function) ) | ||
344 | return true; | ||
345 | else | ||
346 | return false; | ||
347 | } | ||
348 | |||
349 | function jsonXmlElemCount ( jsonObj ) { | ||
350 | var elementsCnt = 0; | ||
351 | if(jsonObj instanceof Object ) { | ||
352 | for( var it in jsonObj ) { | ||
353 | if(jsonXmlSpecialElem ( jsonObj, it) ) | ||
354 | continue; | ||
355 | elementsCnt++; | ||
356 | } | ||
357 | } | ||
358 | return elementsCnt; | ||
359 | } | ||
360 | |||
361 | function checkJsonObjPropertiesFilter(jsonObj, propertyName, jsonObjPath) { | ||
362 | return config.jsonPropertiesFilter.length == 0 | ||
363 | || jsonObjPath=="" | ||
364 | || checkInStdFiltersArrayForm(config.jsonPropertiesFilter, jsonObj, propertyName, jsonObjPath); | ||
365 | } | ||
366 | |||
367 | function parseJSONAttributes ( jsonObj ) { | ||
368 | var attrList = []; | ||
369 | if(jsonObj instanceof Object ) { | ||
370 | for( var ait in jsonObj ) { | ||
371 | if(ait.toString().indexOf("__")== -1 && ait.toString().indexOf(config.attributePrefix)==0) { | ||
372 | attrList.push(ait); | ||
373 | } | ||
374 | } | ||
375 | } | ||
376 | return attrList; | ||
377 | } | ||
378 | |||
379 | function parseJSONTextAttrs ( jsonTxtObj ) { | ||
380 | var result =""; | ||
381 | |||
382 | if(jsonTxtObj.__cdata!=null) { | ||
383 | result+="<![CDATA["+jsonTxtObj.__cdata+"]]>"; | ||
384 | } | ||
385 | |||
386 | if(jsonTxtObj.__text!=null) { | ||
387 | if(config.escapeMode) | ||
388 | result+=escapeXmlChars(jsonTxtObj.__text); | ||
389 | else | ||
390 | result+=jsonTxtObj.__text; | ||
391 | } | ||
392 | return result; | ||
393 | } | ||
394 | |||
395 | function parseJSONTextObject ( jsonTxtObj ) { | ||
396 | var result =""; | ||
397 | |||
398 | if( jsonTxtObj instanceof Object ) { | ||
399 | result+=parseJSONTextAttrs ( jsonTxtObj ); | ||
400 | } | ||
401 | else | ||
402 | if(jsonTxtObj!=null) { | ||
403 | if(config.escapeMode) | ||
404 | result+=escapeXmlChars(jsonTxtObj); | ||
405 | else | ||
406 | result+=jsonTxtObj; | ||
407 | } | ||
408 | |||
409 | return result; | ||
410 | } | ||
411 | |||
412 | function getJsonPropertyPath(jsonObjPath, jsonPropName) { | ||
413 | if (jsonObjPath==="") { | ||
414 | return jsonPropName; | ||
415 | } | ||
416 | else | ||
417 | return jsonObjPath+"."+jsonPropName; | ||
418 | } | ||
419 | |||
420 | function parseJSONArray ( jsonArrRoot, jsonArrObj, attrList, jsonObjPath ) { | ||
421 | var result = ""; | ||
422 | if(jsonArrRoot.length == 0) { | ||
423 | result+=startTag(jsonArrRoot, jsonArrObj, attrList, true); | ||
424 | } | ||
425 | else { | ||
426 | for(var arIdx = 0; arIdx < jsonArrRoot.length; arIdx++) { | ||
427 | result+=startTag(jsonArrRoot[arIdx], jsonArrObj, parseJSONAttributes(jsonArrRoot[arIdx]), false); | ||
428 | result+=parseJSONObject(jsonArrRoot[arIdx], getJsonPropertyPath(jsonObjPath,jsonArrObj)); | ||
429 | result+=endTag(jsonArrRoot[arIdx],jsonArrObj); | ||
430 | } | ||
431 | } | ||
432 | return result; | ||
433 | } | ||
434 | |||
435 | function parseJSONObject ( jsonObj, jsonObjPath ) { | ||
436 | var result = ""; | ||
437 | |||
438 | var elementsCnt = jsonXmlElemCount ( jsonObj ); | ||
439 | |||
440 | if(elementsCnt > 0) { | ||
441 | for( var it in jsonObj ) { | ||
442 | |||
443 | if(jsonXmlSpecialElem ( jsonObj, it) || (jsonObjPath!="" && !checkJsonObjPropertiesFilter(jsonObj, it, getJsonPropertyPath(jsonObjPath,it))) ) | ||
444 | continue; | ||
445 | |||
446 | var subObj = jsonObj[it]; | ||
447 | |||
448 | var attrList = parseJSONAttributes( subObj ) | ||
449 | |||
450 | if(subObj == null || subObj == undefined) { | ||
451 | result+=startTag(subObj, it, attrList, true); | ||
452 | } | ||
453 | else | ||
454 | if(subObj instanceof Object) { | ||
455 | |||
456 | if(subObj instanceof Array) { | ||
457 | result+=parseJSONArray( subObj, it, attrList, jsonObjPath ); | ||
458 | } | ||
459 | else if(subObj instanceof Date) { | ||
460 | result+=startTag(subObj, it, attrList, false); | ||
461 | result+=subObj.toISOString(); | ||
462 | result+=endTag(subObj,it); | ||
463 | } | ||
464 | else { | ||
465 | var subObjElementsCnt = jsonXmlElemCount ( subObj ); | ||
466 | if(subObjElementsCnt > 0 || subObj.__text!=null || subObj.__cdata!=null) { | ||
467 | result+=startTag(subObj, it, attrList, false); | ||
468 | result+=parseJSONObject(subObj, getJsonPropertyPath(jsonObjPath,it)); | ||
469 | result+=endTag(subObj,it); | ||
470 | } | ||
471 | else { | ||
472 | result+=startTag(subObj, it, attrList, true); | ||
473 | } | ||
474 | } | ||
475 | } | ||
476 | else { | ||
477 | result+=startTag(subObj, it, attrList, false); | ||
478 | result+=parseJSONTextObject(subObj); | ||
479 | result+=endTag(subObj,it); | ||
480 | } | ||
481 | } | ||
482 | } | ||
483 | result+=parseJSONTextObject(jsonObj); | ||
484 | |||
485 | return result; | ||
486 | } | ||
487 | |||
488 | this.parseXmlString = function(xmlDocStr) { | ||
489 | var isIEParser = window.ActiveXObject || "ActiveXObject" in window; | ||
490 | if (xmlDocStr === undefined) { | ||
491 | return null; | ||
492 | } | ||
493 | var xmlDoc; | ||
494 | if (window.DOMParser) { | ||
495 | var parser=new window.DOMParser(); | ||
496 | var parsererrorNS = null; | ||
497 | // IE9+ now is here | ||
498 | if(!isIEParser) { | ||
499 | try { | ||
500 | parsererrorNS = parser.parseFromString("INVALID", "text/xml").getElementsByTagName("parsererror")[0].namespaceURI; | ||
501 | } | ||
502 | catch(err) { | ||
503 | parsererrorNS = null; | ||
504 | } | ||
505 | } | ||
506 | try { | ||
507 | xmlDoc = parser.parseFromString( xmlDocStr, "text/xml" ); | ||
508 | if( parsererrorNS!= null && xmlDoc.getElementsByTagNameNS(parsererrorNS, "parsererror").length > 0) { | ||
509 | //throw new Error('Error parsing XML: '+xmlDocStr); | ||
510 | xmlDoc = null; | ||
511 | } | ||
512 | } | ||
513 | catch(err) { | ||
514 | xmlDoc = null; | ||
515 | } | ||
516 | } | ||
517 | else { | ||
518 | // IE :( | ||
519 | if(xmlDocStr.indexOf("<?")==0) { | ||
520 | xmlDocStr = xmlDocStr.substr( xmlDocStr.indexOf("?>") + 2 ); | ||
521 | } | ||
522 | xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); | ||
523 | xmlDoc.async="false"; | ||
524 | xmlDoc.loadXML(xmlDocStr); | ||
525 | } | ||
526 | return xmlDoc; | ||
527 | }; | ||
528 | |||
529 | this.asArray = function(prop) { | ||
530 | if (prop === undefined || prop == null) | ||
531 | return []; | ||
532 | else | ||
533 | if(prop instanceof Array) | ||
534 | return prop; | ||
535 | else | ||
536 | return [prop]; | ||
537 | }; | ||
538 | |||
539 | this.toXmlDateTime = function(dt) { | ||
540 | if(dt instanceof Date) | ||
541 | return dt.toISOString(); | ||
542 | else | ||
543 | if(typeof(dt) === 'number' ) | ||
544 | return new Date(dt).toISOString(); | ||
545 | else | ||
546 | return null; | ||
547 | }; | ||
548 | |||
549 | this.asDateTime = function(prop) { | ||
550 | if(typeof(prop) == "string") { | ||
551 | return fromXmlDateTime(prop); | ||
552 | } | ||
553 | else | ||
554 | return prop; | ||
555 | }; | ||
556 | |||
557 | this.xml2json = function (xmlDoc) { | ||
558 | return parseDOMChildren ( xmlDoc ); | ||
559 | }; | ||
560 | |||
561 | this.xml_str2json = function (xmlDocStr) { | ||
562 | var xmlDoc = this.parseXmlString(xmlDocStr); | ||
563 | if(xmlDoc!=null) | ||
564 | return this.xml2json(xmlDoc); | ||
565 | else | ||
566 | return null; | ||
567 | }; | ||
568 | |||
569 | this.json2xml_str = function (jsonObj) { | ||
570 | return parseJSONObject ( jsonObj, "" ); | ||
571 | }; | ||
572 | |||
573 | this.json2xml = function (jsonObj) { | ||
574 | var xmlDocStr = this.json2xml_str (jsonObj); | ||
575 | return this.parseXmlString(xmlDocStr); | ||
576 | }; | ||
577 | |||
578 | this.getVersion = function () { | ||
579 | return VERSION; | ||
580 | }; | ||
581 | } | ||
582 | })) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
assets/Script/custom/xmlToJSON.js.meta
0 → 100644
assets/Texture/anim/bg_roll.anim
0 → 100644
1 | { | ||
2 | "__type__": "cc.AnimationClip", | ||
3 | "_name": "bg_roll", | ||
4 | "_objFlags": 0, | ||
5 | "_native": "", | ||
6 | "_duration": 7.5, | ||
7 | "sample": 8, | ||
8 | "speed": 0.3, | ||
9 | "wrapMode": 2, | ||
10 | "curveData": { | ||
11 | "props": { | ||
12 | "x": [ | ||
13 | { | ||
14 | "frame": 0, | ||
15 | "value": 2899 | ||
16 | }, | ||
17 | { | ||
18 | "frame": 7.5, | ||
19 | "value": -744 | ||
20 | } | ||
21 | ] | ||
22 | } | ||
23 | }, | ||
24 | "events": [] | ||
25 | } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
assets/Texture/anim/bg_roll.anim.meta
0 → 100644
assets/Texture/game/explore_plus.png
0 → 100644

210 KB
assets/Texture/game/explore_plus.png.meta
0 → 100644
1 | { | ||
2 | "ver": "2.2.0", | ||
3 | "uuid": "41a684e8-62cf-464e-81a6-04833d9d9628", | ||
4 | "type": "sprite", | ||
5 | "wrapMode": "clamp", | ||
6 | "filterMode": "bilinear", | ||
7 | "premultiplyAlpha": false, | ||
8 | "subMetas": { | ||
9 | "explore_plus": { | ||
10 | "ver": "1.0.4", | ||
11 | "uuid": "9c2b11fd-1118-470b-985d-60b8b4617e25", | ||
12 | "rawTextureUuid": "41a684e8-62cf-464e-81a6-04833d9d9628", | ||
13 | "trimType": "auto", | ||
14 | "trimThreshold": 1, | ||
15 | "rotated": false, | ||
16 | "offsetX": 0, | ||
17 | "offsetY": 0, | ||
18 | "trimX": 0, | ||
19 | "trimY": 0, | ||
20 | "width": 7280, | ||
21 | "height": 1110, | ||
22 | "rawWidth": 7280, | ||
23 | "rawHeight": 1110, | ||
24 | "borderTop": 0, | ||
25 | "borderBottom": 0, | ||
26 | "borderLeft": 0, | ||
27 | "borderRight": 0, | ||
28 | "subMetas": {} | ||
29 | } | ||
30 | } | ||
31 | } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
assets/resources/config.meta
0 → 100644
assets/resources/config/explore_config.xml
0 → 100644
1 | <root> | ||
2 | |||
3 | <explore id="1" id2="1" name="555,没人陪我玩,好寂寞。" type="1" map="1" choice1="陪陪蜥蜴,和它交朋友" choice2="陪它去看《小猪佩奇》,开朗的孩子朋友多。" function="1:500054" image="xiyi.png" reward="10001:100"/> | ||
4 | <explore id="2" id2="1" name="555,没人陪我玩,好寂寞。" type="1" map="1" choice1="陪陪蜥蜴,和它交朋友" choice2="去玩叠蛋糕给它看,这个小游戏可好玩了!" function="2:300056" image="xiyi.png" reward="10001:100"/> | ||
5 | <explore id="3" id2="1" name="555,没人陪我玩,好寂寞。" type="1" map="1" choice1="陪陪蜥蜴,和它交朋友" choice2="和小狗一起听儿歌:工程车之歌" function="3:18897" image="xiyi.png" reward="10001:100"/> | ||
6 | <explore id="4" id2="1" name="555,没人陪我玩,好寂寞。" type="1" map="1" choice1="我想和别的小动物一起玩。" choice2="" function="1:500054" image="xiyi.png" reward="10001:100"/> | ||
7 | <explore id="5" id2="1" name="捡到一个宝箱。" type="2" map="1" choice1="" choice2="" function="1:500054" image="baoxiang.png" reward="10001:100"/> | ||
8 | <explore id="6" id2="1" name="迷路了,进度减少10%" type="3" map="1" choice1="" choice2="" function="1:500054" image="xiyi.png" reward="10001:100"/> | ||
9 | <explore id="7" id2="1" name="找到了捷径,进度增加10%" type="4" map="1" choice1="" choice2="" function="1:500054" image="xiyi.png" reward="10001:100"/> | ||
10 | |||
11 | </root> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
assets/resources/game/explore_plus.png
0 → 100644

210 KB
assets/resources/game/explore_plus.png.meta
0 → 100644
1 | { | ||
2 | "ver": "2.2.0", | ||
3 | "uuid": "4ade9de4-3d39-4b87-a82b-92f8ded29646", | ||
4 | "type": "sprite", | ||
5 | "wrapMode": "clamp", | ||
6 | "filterMode": "bilinear", | ||
7 | "premultiplyAlpha": false, | ||
8 | "subMetas": { | ||
9 | "explore_plus": { | ||
10 | "ver": "1.0.4", | ||
11 | "uuid": "0dde25a8-400a-4010-ba37-017445b4e960", | ||
12 | "rawTextureUuid": "4ade9de4-3d39-4b87-a82b-92f8ded29646", | ||
13 | "trimType": "auto", | ||
14 | "trimThreshold": 1, | ||
15 | "rotated": false, | ||
16 | "offsetX": 0, | ||
17 | "offsetY": 0, | ||
18 | "trimX": 0, | ||
19 | "trimY": 0, | ||
20 | "width": 7280, | ||
21 | "height": 1110, | ||
22 | "rawWidth": 7280, | ||
23 | "rawHeight": 1110, | ||
24 | "borderTop": 0, | ||
25 | "borderBottom": 0, | ||
26 | "borderLeft": 0, | ||
27 | "borderRight": 0, | ||
28 | "subMetas": {} | ||
29 | } | ||
30 | } | ||
31 | } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment