diff --git a/play/assets/tmpGame/scene/Scene.fire b/play/assets/tmpGame/scene/Scene.fire index 8fdebf5605f58c50c1036f9e0cbd3af91d3361d5..82624f0bd5c27f28ef39ee53c77ae7c82faad3d2 100644 --- a/play/assets/tmpGame/scene/Scene.fire +++ b/play/assets/tmpGame/scene/Scene.fire @@ -82,18 +82,21 @@ }, { "__id__": 23 + }, + { + "__id__": 26 } ], "_active": true, "_components": [ { - "__id__": 26 + "__id__": 29 }, { - "__id__": 27 + "__id__": 30 }, { - "__id__": 28 + "__id__": 31 } ], "_prefab": null, @@ -183,7 +186,7 @@ "array": [ 0, 0, - 310.037094554829, + 310.0292431292173, 0, 0, 0, @@ -1136,7 +1139,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 1280, + "width": -46, "height": 245 }, "_anchorPoint": { @@ -1183,9 +1186,9 @@ "_enabled": true, "alignMode": 1, "_target": null, - "_alignFlags": 41, - "_left": 0, - "_right": 0, + "_alignFlags": 1, + "_left": 65, + "_right": 65, "_top": 144, "_bottom": 0, "_verticalCenter": 0, @@ -1210,10 +1213,10 @@ "_enabled": true, "_layoutSize": { "__type__": "cc.Size", - "width": 1280, + "width": -46, "height": 245 }, - "_resize": 2, + "_resize": 1, "_N$layoutType": 1, "_N$cellSize": { "__type__": "cc.Size", @@ -1221,8 +1224,8 @@ "height": 40 }, "_N$startAxis": 0, - "_N$paddingLeft": 65, - "_N$paddingRight": 65, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, "_N$paddingTop": 0, "_N$paddingBottom": 0, "_N$spacingX": 46, @@ -1232,6 +1235,130 @@ "_N$affectedByScale": true, "_id": "4amMAgai9Ly4PgbldInIx/" }, + { + "__type__": "cc.Node", + "_name": "op_pics", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 27 + }, + { + "__id__": 28 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": -46, + "height": 245 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + -161.05399999999997, + 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": "04I7N95JlL75Sfxx1rLz5D" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 26 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 1, + "_left": 65, + "_right": 65, + "_top": 398.554, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 1150, + "_originalHeight": 0, + "_id": "ceisYS0PJP+Zfpyl7i3btv" + }, + { + "__type__": "cc.Layout", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 26 + }, + "_enabled": true, + "_layoutSize": { + "__type__": "cc.Size", + "width": -46, + "height": 245 + }, + "_resize": 1, + "_N$layoutType": 1, + "_N$cellSize": { + "__type__": "cc.Size", + "width": 40, + "height": 40 + }, + "_N$startAxis": 0, + "_N$paddingLeft": 0, + "_N$paddingRight": 0, + "_N$paddingTop": 0, + "_N$paddingBottom": 0, + "_N$spacingX": 46, + "_N$spacingY": 0, + "_N$verticalDirection": 1, + "_N$horizontalDirection": 0, + "_N$affectedByScale": true, + "_id": "d4POtEjZxONruTqzfh85Gk" + }, { "__type__": "cc.Canvas", "_name": "", @@ -1287,6 +1414,12 @@ "title": { "__id__": 9 }, + "sounds_container": { + "__id__": 23 + }, + "pic_container": { + "__id__": 26 + }, "op_sound": { "__uuid__": "f816bebc-d7fa-41ca-aa93-efe1af15931d" }, diff --git a/play/assets/tmpGame/script/Scene.js b/play/assets/tmpGame/script/Scene.js index 8b7adc7791afa7b8187e5a6129d734b055462eba..5e40cea942bf69e36fd7042f9be03551589c408a 100644 --- a/play/assets/tmpGame/script/Scene.js +++ b/play/assets/tmpGame/script/Scene.js @@ -12,6 +12,18 @@ cc.Class({ type: cc.Label, }, + // 选项容器(带声音) + sounds_container: { + default: null, + type: cc.Node, + }, + + // 选项容器(图片) + pic_container: { + default: null, + type: cc.Node, + }, + // 选项(带声音) op_sound: { default: null, @@ -161,15 +173,17 @@ cc.Class({ this.playAudioByUrl(this.data.audio_title); }); - // for (var i = 0; i < this.data.total; i++) { - // const op_s = cc.instantiate(this.op_sound); - // op_s.getComponent("op_sound")._opId = i; - // op_s.getComponent("op_sound")._soundUrl = this.data["audio_url_" + i]; + for (var i = 0; i < this.data.options.length; i++) { + const op_s = cc.instantiate(this.op_sound); + op_s.getComponent("op_sound")._opId = i; + op_s.getComponent("op_sound")._soundUrl = this.data.options[i]["audio_url_" + i]; + this.sounds_container.addChild(op_s); - // const op_p = cc.instantiate(this.op_pic); - // op_p.getComponent("op_pic")._opId = i; - // op_p.getComponent("op_pic").setPic(this.data["pic_url_" + i]); - // } + const op_p = cc.instantiate(this.op_pic); + op_p.getComponent("op_pic")._opId = i; + op_p.getComponent("op_pic").setPic(this.data.options[i]["pic_url_" + i]); + this.pic_container.addChild(op_p); + } }, initBg() {