Commit a25a607d authored by yu's avatar yu

背景音乐

parent 9dfa4cab
...@@ -92,6 +92,12 @@ ...@@ -92,6 +92,12 @@
{ {
"__id__": 77 "__id__": 77
}, },
{
"__id__": 80
},
{
"__id__": 83
},
{ {
"__id__": 51 "__id__": 51
}, },
...@@ -99,19 +105,19 @@ ...@@ -99,19 +105,19 @@
"__id__": 56 "__id__": 56
}, },
{ {
"__id__": 89 "__id__": 95
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 110 "__id__": 116
}, },
{ {
"__id__": 111 "__id__": 117
}, },
{ {
"__id__": 112 "__id__": 118
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3684,26 +3690,274 @@ ...@@ -3684,26 +3690,274 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "layout_start", "_name": "jshx_bg_audio_off",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
}, },
"_children": [ "_children": [],
"_active": false,
"_components": [
{ {
"__id__": 78 "__id__": 78
}, },
{ {
"__id__": 80 "__id__": 79
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 96,
"height": 98
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-559,
-296,
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": "baK7RWDYNIdLmKfutULTlO"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 77
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "6f4ea38d-9ee3-457e-9ede-696ccaaae2fd"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "1e+nlIGSJEw6UKQLaD1B7c"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 77
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 12,
"_left": 60,
"_right": 0,
"_top": 0,
"_bottom": 30,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "953QBZpR5Aw4VNceJ3/KXZ"
},
{
"__type__": "cc.Node",
"_name": "jshx_bg_audio_on",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 81
}, },
{ {
"__id__": 82 "__id__": 82
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 96,
"height": 98
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-559,
-296,
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": "3aXAWhU61Merqwg636/40Z"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 80
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "d7fa09d2-66ee-4265-b5e0-39f747db6059"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "aa9+wocAZDB7ZEa5vFU/i2"
}, },
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 80
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 12,
"_left": 60,
"_right": 0,
"_top": 0,
"_bottom": 30,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "f6zNNYzrtDg68EyTH4Gj9y"
},
{
"__type__": "cc.Node",
"_name": "layout_start",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{ {
"__id__": 84 "__id__": 84
}, },
{ {
"__id__": 87 "__id__": 86
},
{
"__id__": 88
},
{
"__id__": 90
},
{
"__id__": 93
} }
], ],
"_active": false, "_active": false,
...@@ -3761,13 +4015,13 @@ ...@@ -3761,13 +4015,13 @@
"_name": "New Sprite(Splash)", "_name": "New Sprite(Splash)",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 77 "__id__": 83
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 79 "__id__": 85
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3823,7 +4077,7 @@ ...@@ -3823,7 +4077,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 78 "__id__": 84
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3855,13 +4109,13 @@ ...@@ -3855,13 +4109,13 @@
"_name": "bg_instructions", "_name": "bg_instructions",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 77 "__id__": 83
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 81 "__id__": 87
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3917,7 +4171,7 @@ ...@@ -3917,7 +4171,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 80 "__id__": 86
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3949,13 +4203,13 @@ ...@@ -3949,13 +4203,13 @@
"_name": "desc", "_name": "desc",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 77 "__id__": 83
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 83 "__id__": 89
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4011,7 +4265,7 @@ ...@@ -4011,7 +4265,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 82 "__id__": 88
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4046,16 +4300,16 @@ ...@@ -4046,16 +4300,16 @@
"_name": "btn_start", "_name": "btn_start",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 77 "__id__": 83
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 85 "__id__": 91
}, },
{ {
"__id__": 86 "__id__": 92
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4111,7 +4365,7 @@ ...@@ -4111,7 +4365,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 84 "__id__": 90
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4143,7 +4397,7 @@ ...@@ -4143,7 +4397,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 84 "__id__": 90
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -4204,7 +4458,7 @@ ...@@ -4204,7 +4458,7 @@
"hoverSprite": null, "hoverSprite": null,
"_N$disabledSprite": null, "_N$disabledSprite": null,
"_N$target": { "_N$target": {
"__id__": 84 "__id__": 90
}, },
"_id": "7095HuemhJQ40wHbz5jlAy" "_id": "7095HuemhJQ40wHbz5jlAy"
}, },
...@@ -4213,13 +4467,13 @@ ...@@ -4213,13 +4467,13 @@
"_name": "touch", "_name": "touch",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 77 "__id__": 83
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 88 "__id__": 94
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4275,7 +4529,7 @@ ...@@ -4275,7 +4529,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 87 "__id__": 93
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -4347,19 +4601,19 @@ ...@@ -4347,19 +4601,19 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 90 "__id__": 96
}, },
{ {
"__id__": 94 "__id__": 100
}, },
{ {
"__id__": 98 "__id__": 104
}, },
{ {
"__id__": 102 "__id__": 108
}, },
{ {
"__id__": 106 "__id__": 112
} }
], ],
"_active": true, "_active": true,
...@@ -4417,11 +4671,11 @@ ...@@ -4417,11 +4671,11 @@
"_name": "quadBase", "_name": "quadBase",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 89 "__id__": 95
}, },
"_children": [ "_children": [
{ {
"__id__": 91 "__id__": 97
} }
], ],
"_active": true, "_active": true,
...@@ -4479,11 +4733,11 @@ ...@@ -4479,11 +4733,11 @@
"_name": "quad", "_name": "quad",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 90 "__id__": 96
}, },
"_children": [ "_children": [
{ {
"__id__": 92 "__id__": 98
} }
], ],
"_active": true, "_active": true,
...@@ -4541,13 +4795,13 @@ ...@@ -4541,13 +4795,13 @@
"_name": "paper", "_name": "paper",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 91 "__id__": 97
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 93 "__id__": 99
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4603,7 +4857,7 @@ ...@@ -4603,7 +4857,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 92 "__id__": 98
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4635,11 +4889,11 @@ ...@@ -4635,11 +4889,11 @@
"_name": "quadBase", "_name": "quadBase",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 89 "__id__": 95
}, },
"_children": [ "_children": [
{ {
"__id__": 95 "__id__": 101
} }
], ],
"_active": true, "_active": true,
...@@ -4697,11 +4951,11 @@ ...@@ -4697,11 +4951,11 @@
"_name": "quad", "_name": "quad",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 94 "__id__": 100
}, },
"_children": [ "_children": [
{ {
"__id__": 96 "__id__": 102
} }
], ],
"_active": true, "_active": true,
...@@ -4759,13 +5013,13 @@ ...@@ -4759,13 +5013,13 @@
"_name": "paper", "_name": "paper",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 95 "__id__": 101
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 97 "__id__": 103
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4821,7 +5075,7 @@ ...@@ -4821,7 +5075,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 96 "__id__": 102
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4853,11 +5107,11 @@ ...@@ -4853,11 +5107,11 @@
"_name": "quadBase", "_name": "quadBase",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 89 "__id__": 95
}, },
"_children": [ "_children": [
{ {
"__id__": 99 "__id__": 105
} }
], ],
"_active": true, "_active": true,
...@@ -4915,11 +5169,11 @@ ...@@ -4915,11 +5169,11 @@
"_name": "quad", "_name": "quad",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 98 "__id__": 104
}, },
"_children": [ "_children": [
{ {
"__id__": 100 "__id__": 106
} }
], ],
"_active": true, "_active": true,
...@@ -4977,13 +5231,13 @@ ...@@ -4977,13 +5231,13 @@
"_name": "paper", "_name": "paper",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 99 "__id__": 105
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 101 "__id__": 107
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5039,7 +5293,7 @@ ...@@ -5039,7 +5293,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 100 "__id__": 106
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -5071,11 +5325,11 @@ ...@@ -5071,11 +5325,11 @@
"_name": "quadBase", "_name": "quadBase",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 89 "__id__": 95
}, },
"_children": [ "_children": [
{ {
"__id__": 103 "__id__": 109
} }
], ],
"_active": true, "_active": true,
...@@ -5133,11 +5387,11 @@ ...@@ -5133,11 +5387,11 @@
"_name": "quad", "_name": "quad",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 102 "__id__": 108
}, },
"_children": [ "_children": [
{ {
"__id__": 104 "__id__": 110
} }
], ],
"_active": true, "_active": true,
...@@ -5195,13 +5449,13 @@ ...@@ -5195,13 +5449,13 @@
"_name": "paper", "_name": "paper",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 103 "__id__": 109
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 105 "__id__": 111
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5257,7 +5511,7 @@ ...@@ -5257,7 +5511,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 104 "__id__": 110
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -5289,11 +5543,11 @@ ...@@ -5289,11 +5543,11 @@
"_name": "quadBase", "_name": "quadBase",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 89 "__id__": 95
}, },
"_children": [ "_children": [
{ {
"__id__": 107 "__id__": 113
} }
], ],
"_active": true, "_active": true,
...@@ -5351,11 +5605,11 @@ ...@@ -5351,11 +5605,11 @@
"_name": "quad", "_name": "quad",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 106 "__id__": 112
}, },
"_children": [ "_children": [
{ {
"__id__": 108 "__id__": 114
} }
], ],
"_active": true, "_active": true,
...@@ -5413,13 +5667,13 @@ ...@@ -5413,13 +5667,13 @@
"_name": "paper", "_name": "paper",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 107 "__id__": 113
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 109 "__id__": 115
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5475,7 +5729,7 @@ ...@@ -5475,7 +5729,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 108 "__id__": 114
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -5561,6 +5815,12 @@ ...@@ -5561,6 +5815,12 @@
"btn_laba": { "btn_laba": {
"__id__": 68 "__id__": 68
}, },
"btn_audio_off": {
"__id__": 77
},
"btn_audio_on": {
"__id__": 80
},
"_id": "5aci41ohNDvaH6JXqrDEGR" "_id": "5aci41ohNDvaH6JXqrDEGR"
} }
] ]
\ No newline at end of file
import { asyncDelay, onHomeworkFinish, RandomInt } from "../script/util"; import { asyncDelay, onHomeworkFinish, RandomInt } from "../script/util_extreme_skiing";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent"; import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent_extreme_skiing";
import Game, { FISH_OUT, GAME_STATE, Option } from "./tool/Game"; import Game, { FISH_OUT, GAME_STATE, Option } from "./tool/Game_extreme_skiing";
import pg from "./tool/pg"; import pg from "./tool/pg_extreme_skiing";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
...@@ -77,6 +77,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -77,6 +77,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
layout_cannon: cc.Node = null; layout_cannon: cc.Node = null;
@property(cc.Node) @property(cc.Node)
btn_laba: cc.Node = null; btn_laba: cc.Node = null;
@property(cc.Node)
btn_audio_off: cc.Node = null;
@property(cc.Node)
btn_audio_on: cc.Node = null;
_cantouch = null; _cantouch = null;
initData() { initData() {
...@@ -88,6 +92,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -88,6 +92,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
private layout_start: cc.Node; private layout_start: cc.Node;
private audioId: any; private audioId: any;
private isPlayBgAudio: boolean;
async initView() { async initView() {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
this.layout_start = pg.view.find(this, "layout_start"); this.layout_start = pg.view.find(this, "layout_start");
...@@ -106,15 +111,23 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -106,15 +111,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
touch.on(cc.Node.EventType.TOUCH_END, () => { touch.on(cc.Node.EventType.TOUCH_END, () => {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
pg.audio.stopAudio(this.audioId); pg.audio.stopAudio(this.audioId);
pg.audio.playAudioByUrl(Game.getIns().question.audio); pg.audio.playAudioByUrl(Game.getIns().question.audio).then((audioId) => {
this.audioId = audioId;
if (audioId > -1 && Game.getIns().state == GAME_STATE.RUNNING) pg.audio.stopAudio(audioId);
});
}) })
if (Game.getIns().title) { if (Game.getIns().title) {
cc.find("layout_info/bg_title/title", this.node).getComponent(cc.Label).string = Game.getIns().title; cc.find("layout_info/bg_title/title", this.node).getComponent(cc.Label).string = Game.getIns().title;
} }
if (Game.getIns().bgAudio || Game.getIns().bgAudio != "") {
this.btn_audio_on.active = true;
}
} }
initEvent() { initEvent() {
pg.view.touchOn(pg.view.find(this.layout_start, 'btn_start'), this.onTouchStart, this); pg.view.touchOn(pg.view.find(this.layout_start, 'btn_start'), this.onTouchStart, this);
this.btn_laba.on(cc.Node.EventType.TOUCH_END, this.playLaba, this); this.btn_laba.on(cc.Node.EventType.TOUCH_END, this.playLaba, this);
this.btn_audio_off.on(cc.Node.EventType.TOUCH_END, this.onAudioOff, this);
this.btn_audio_on.on(cc.Node.EventType.TOUCH_END, this.onAudioOn, this);
pg.event.on("game_start", () => { pg.event.on("game_start", () => {
this.gameStart(); this.gameStart();
...@@ -151,8 +164,28 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -151,8 +164,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
onTouchStart() { onTouchStart() {
pg.audio.playLocalAudio(cc.find(`Canvas/res/audio/btn`)); pg.audio.playLocalAudio(cc.find(`Canvas/res/audio/btn`));
pg.audio.playBgAudioByUrl(Game.getIns().bgAudio);
pg.event.emit("game_start"); pg.event.emit("game_start");
} }
private onAudioOn() {
this.btn_audio_off.active = true;
this.btn_audio_on.active = false;
this.isPlayBgAudio = false;
this.stopBgAudio();
}
private onAudioOff() {
this.btn_audio_on.active = true;
this.btn_audio_off.active = false;
this.isPlayBgAudio = true;
this.playBgAudio();
}
private playBgAudio() {
if (!this.isPlayBgAudio) return;
cc.audioEngine.resumeMusic();
}
private stopBgAudio() {
cc.audioEngine.pauseMusic();
}
private count: number; private count: number;
...@@ -178,11 +211,13 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -178,11 +211,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
}) })
} }
private intervalId; private intervalId;
private questionAudioId = -1;
private playLaba() { private playLaba() {
let btn_kaba2 = this.btn_laba.getChildByName("btn_laba2"); let btn_kaba2 = this.btn_laba.getChildByName("btn_laba2");
let btn_kaba3 = this.btn_laba.getChildByName("btn_laba3"); let btn_kaba3 = this.btn_laba.getChildByName("btn_laba3");
btn_kaba2.active = true; btn_kaba2.active = true;
btn_kaba3.active = true; btn_kaba3.active = true;
if (this.questionAudioId > -1) pg.audio.stopAudio(this.questionAudioId);
let count = 0; let count = 0;
if (this.intervalId) clearInterval(this.intervalId); if (this.intervalId) clearInterval(this.intervalId);
...@@ -196,7 +231,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -196,7 +231,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.audio.playAudioByUrl(Game.getIns().getCurrentPage().audio, (() => { pg.audio.playAudioByUrl(Game.getIns().getCurrentPage().audio, (() => {
stop = true; stop = true;
})) })).then((audioId: number) => {
this.questionAudioId = audioId;
})
} }
...@@ -274,3 +311,4 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -274,3 +311,4 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
// Learn life-cycle callbacks: // Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import Game, { GAME_STATE, Option } from "../tool/Game"; import Game, { GAME_STATE, Option } from "../tool/Game_extreme_skiing";
import pg from "../tool/pg"; import pg from "../tool/pg_extreme_skiing";
pg.event.clear(); pg.event.clear();
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
......
...@@ -145,11 +145,13 @@ export default class Game { ...@@ -145,11 +145,13 @@ export default class Game {
public question: { text, audio }; public question: { text, audio };
public title: string; public title: string;
public questionText: string; public questionText: string;
public bgAudio: string;
public init(data) { public init(data) {
this.singleGame = !data.onlineFlg; this.singleGame = !data.onlineFlg;
this.question = { text: data.questionText, audio: data.questionTextAudio }; this.question = { text: data.questionText, audio: data.questionTextAudio };
this.title = data.title; this.title = data.title;
this.questionText = data.questionText; this.questionText = data.questionText;
this.bgAudio = data.bgAduio || "";
this.start = false; this.start = false;
this.lists = []; this.lists = [];
this.data = data.questions; this.data = data.questions;
......
...@@ -532,7 +532,7 @@ let pg = { ...@@ -532,7 +532,7 @@ let pg = {
}); });
}, },
stopAudio(audioId) { stopAudio(audioId) {
if (!audioId) return; if (audioId < 0) return;
cc.audioEngine.stopEffect(audioId); cc.audioEngine.stopEffect(audioId);
}, },
playAudio(audioClip, cb = null) { playAudio(audioClip, cb = null) {
...@@ -555,6 +555,19 @@ let pg = { ...@@ -555,6 +555,19 @@ let pg = {
}); });
}) })
}, },
playBgAudioByUrl(audio_url, cb = null, loadCb = null) {
return new Promise((resolve, reject) => {
if (!audio_url) return resolve(null);
cc.assetManager.loadRemote(audio_url, (err, audioClip: any) => {
const audioId = cc.audioEngine.playMusic(audioClip, true);
cc.audioEngine.setFinishCallback(audioId, () => {
cb && cb();
});
loadCb && loadCb(audioId);
resolve(audioId);
});
});
},
getAudioClip(audio_url) { getAudioClip(audio_url) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!audio_url) return resolve(null); if (!audio_url) return resolve(null);
......
import { defaultData } from "../script/defaultData"; import { defaultData } from "../script/defaultData_extreme_skiing";
export class MyCocosSceneComponent extends cc.Component { export class MyCocosSceneComponent extends cc.Component {
......
...@@ -2,6 +2,7 @@ export const defaultData = { ...@@ -2,6 +2,7 @@ export const defaultData = {
"title": "急速滑雪", "title": "急速滑雪",
"questionText": "雪地里有许多不同的指示牌,运动员要选择哪一个呢?亲爱的小玩家,请你认真听游戏指令,帮助运动员选择正确的指示牌吧!游戏结束后,根据收集到的指示牌数量,你将获得相应的能量石奖励哟!开始挑战吧!", "questionText": "雪地里有许多不同的指示牌,运动员要选择哪一个呢?亲爱的小玩家,请你认真听游戏指令,帮助运动员选择正确的指示牌吧!游戏结束后,根据收集到的指示牌数量,你将获得相应的能量石奖励哟!开始挑战吧!",
"questionTextAudio": "https://staging-teach.cdn.ireadabc.com/c3b69ad3d51385eac7d4195773ef59f7_l.mp3", "questionTextAudio": "https://staging-teach.cdn.ireadabc.com/c3b69ad3d51385eac7d4195773ef59f7_l.mp3",
"bgAduio": "https://staging-teach.cdn.ireadabc.com/ed84c18cc5f696ceaaf488ff98c228fe_l.mp3",
"questions": [ "questions": [
{ {
"options": [ "options": [
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 336, "height": 336,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"1orange": { "1orange_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "17487daf-3875-48b5-9884-fb0a0bccd3d5", "uuid": "17487daf-3875-48b5-9884-fb0a0bccd3d5",
"rawTextureUuid": "9eb89c84-1cc7-42c9-ac57-df702f77dcef", "rawTextureUuid": "9eb89c84-1cc7-42c9-ac57-df702f77dcef",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 720, "height": 720,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg": { "bg_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "057d9312-06e8-44d1-9379-6aafe1869ff0", "uuid": "057d9312-06e8-44d1-9379-6aafe1869ff0",
"rawTextureUuid": "f37041cd-c3f7-4b78-8f8e-3bce4538eda7", "rawTextureUuid": "f37041cd-c3f7-4b78-8f8e-3bce4538eda7",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 67, "height": 67,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_left": { "btn_left_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "712039b7-4413-4fad-bc38-18899d62f771", "uuid": "712039b7-4413-4fad-bc38-18899d62f771",
"rawTextureUuid": "af5ba431-34f8-4dd7-9275-364bf1e11142", "rawTextureUuid": "af5ba431-34f8-4dd7-9275-364bf1e11142",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 67, "height": 67,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_right": { "btn_right_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "0b0af429-d3cb-414c-ad5c-f984d5f82b72", "uuid": "0b0af429-d3cb-414c-ad5c-f984d5f82b72",
"rawTextureUuid": "39c9e77b-9a0e-4db2-81e4-7edd3affe3a1", "rawTextureUuid": "39c9e77b-9a0e-4db2-81e4-7edd3affe3a1",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 144, "height": 144,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"icon": { "icon_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "7ee60292-c82a-4606-a93f-6fdbe72fbb88", "uuid": "7ee60292-c82a-4606-a93f-6fdbe72fbb88",
"rawTextureUuid": "2f902c4b-aa5d-41e5-9da3-2b89cf1fd828", "rawTextureUuid": "2f902c4b-aa5d-41e5-9da3-2b89cf1fd828",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 17, "height": 17,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"1": { "1_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "87d63e6a-17a8-4ee2-b9f5-2fa9f0d744bc", "uuid": "87d63e6a-17a8-4ee2-b9f5-2fa9f0d744bc",
"rawTextureUuid": "dcec4956-8821-4e74-92be-bfb777427046", "rawTextureUuid": "dcec4956-8821-4e74-92be-bfb777427046",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 17, "height": 17,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"2": { "2_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "aab1076f-cb07-452e-a50e-858fb0e940b0", "uuid": "aab1076f-cb07-452e-a50e-858fb0e940b0",
"rawTextureUuid": "c4121e31-6c35-4b3f-af6b-86425459cb32", "rawTextureUuid": "c4121e31-6c35-4b3f-af6b-86425459cb32",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 17, "height": 17,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"3": { "3_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "4b8ee07a-3d5f-48b4-aa9a-9432c370dde3", "uuid": "4b8ee07a-3d5f-48b4-aa9a-9432c370dde3",
"rawTextureUuid": "50f9482b-ed7d-4343-966a-b70f92fc8370", "rawTextureUuid": "50f9482b-ed7d-4343-966a-b70f92fc8370",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 17, "height": 17,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"4": { "4_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "eb09a891-e055-462a-ade6-c5e08dc6f24c", "uuid": "eb09a891-e055-462a-ade6-c5e08dc6f24c",
"rawTextureUuid": "09170795-0987-40a9-9fee-be35a3f14c6c", "rawTextureUuid": "09170795-0987-40a9-9fee-be35a3f14c6c",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 17, "height": 17,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"5": { "5_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "2c001aba-acde-4b94-8ada-3678f5b27d61", "uuid": "2c001aba-acde-4b94-8ada-3678f5b27d61",
"rawTextureUuid": "9101dbdf-2ed0-4a95-be32-0a6ad1fc967d", "rawTextureUuid": "9101dbdf-2ed0-4a95-be32-0a6ad1fc967d",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 650, "height": 650,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_bg": { "bg_bg_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "5306260e-cb0d-45fc-bc01-5a120b7c9f41", "uuid": "5306260e-cb0d-45fc-bc01-5a120b7c9f41",
"rawTextureUuid": "98ee8ae6-6604-442b-9f6a-ee946d9d54ff", "rawTextureUuid": "98ee8ae6-6604-442b-9f6a-ee946d9d54ff",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 343, "height": 343,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_di": { "bg_di_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "f1bb65df-5d0a-4417-8c70-e201c9339cad", "uuid": "f1bb65df-5d0a-4417-8c70-e201c9339cad",
"rawTextureUuid": "602bd81d-300e-4881-9798-46384e2dc0c1", "rawTextureUuid": "602bd81d-300e-4881-9798-46384e2dc0c1",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 152, "height": 152,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_ornament2": { "bg_ornament2_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "343620f8-c718-4ea9-80c0-ab05695a45c4", "uuid": "343620f8-c718-4ea9-80c0-ab05695a45c4",
"rawTextureUuid": "5bc68731-8e0f-4bba-87d8-ecff0f934172", "rawTextureUuid": "5bc68731-8e0f-4bba-87d8-ecff0f934172",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 91, "height": 91,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_ornament": { "bg_ornament_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "6955191e-7015-47c2-970f-885835e01f6c", "uuid": "6955191e-7015-47c2-970f-885835e01f6c",
"rawTextureUuid": "bc9e1f73-c77e-4489-a150-29e051166661", "rawTextureUuid": "bc9e1f73-c77e-4489-a150-29e051166661",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 391, "height": 391,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_people": { "bg_people_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "c12ebc34-57fd-4f84-af02-916d60c8efda", "uuid": "c12ebc34-57fd-4f84-af02-916d60c8efda",
"rawTextureUuid": "c026bd36-aaeb-4cac-8f0a-71466567e613", "rawTextureUuid": "c026bd36-aaeb-4cac-8f0a-71466567e613",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 212, "height": 212,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_pic-di": { "bg_picdi_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "2c15ee9a-5e11-432e-9ace-08a2b736c287", "uuid": "2c15ee9a-5e11-432e-9ace-08a2b736c287",
"rawTextureUuid": "419d6c78-f55c-43b4-8019-c83d4b6a30e2", "rawTextureUuid": "419d6c78-f55c-43b4-8019-c83d4b6a30e2",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 433, "height": 433,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_sky": { "bg_sky_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "4b66fb37-77c6-4376-ad2f-5da9505da166", "uuid": "4b66fb37-77c6-4376-ad2f-5da9505da166",
"rawTextureUuid": "9dad23f9-3101-4ec3-acde-735b1ea67bbc", "rawTextureUuid": "9dad23f9-3101-4ec3-acde-735b1ea67bbc",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 111, "height": 111,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_title": { "bg_title_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "571a6beb-6750-45f3-a6c5-5202db7caa9f", "uuid": "571a6beb-6750-45f3-a6c5-5202db7caa9f",
"rawTextureUuid": "9eecc6ae-709b-4084-be19-db2aa9a5f504", "rawTextureUuid": "9eecc6ae-709b-4084-be19-db2aa9a5f504",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 127, "height": 127,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_word-di": { "bg_worddi_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "a36258f8-eb2b-4b1e-bfc4-1f8490d7f2d6", "uuid": "a36258f8-eb2b-4b1e-bfc4-1f8490d7f2d6",
"rawTextureUuid": "a1ae450a-b7e3-4458-adac-cefe7419e8ac", "rawTextureUuid": "a1ae450a-b7e3-4458-adac-cefe7419e8ac",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 98, "height": 98,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_laba1": { "btn_laba1_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "eabdadc9-5470-4705-8756-90657ccb6903", "uuid": "eabdadc9-5470-4705-8756-90657ccb6903",
"rawTextureUuid": "4366b8a2-b455-4f90-8371-2e488e9c4649", "rawTextureUuid": "4366b8a2-b455-4f90-8371-2e488e9c4649",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 98, "height": 98,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_laba2": { "btn_laba2_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "d9abb489-aecf-4e5b-933c-d471dac36f69", "uuid": "d9abb489-aecf-4e5b-933c-d471dac36f69",
"rawTextureUuid": "fa42bae7-0c81-45e5-9dc1-d66035135bb4", "rawTextureUuid": "fa42bae7-0c81-45e5-9dc1-d66035135bb4",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 98, "height": 98,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_laba3": { "btn_laba3_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "63941319-d6d4-47bd-95f2-04fbcf8e3a46", "uuid": "63941319-d6d4-47bd-95f2-04fbcf8e3a46",
"rawTextureUuid": "ce663e94-435a-41e5-84ac-f4cd665dafac", "rawTextureUuid": "ce663e94-435a-41e5-84ac-f4cd665dafac",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 108, "height": 108,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_restart": { "btn_restart_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "0fdf75ec-9072-4931-8fef-a38a033af350", "uuid": "0fdf75ec-9072-4931-8fef-a38a033af350",
"rawTextureUuid": "05db4773-827c-4876-a550-fb6da4b03a78", "rawTextureUuid": "05db4773-827c-4876-a550-fb6da4b03a78",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 108, "height": 108,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_start": { "btn_start_extreme_skiing": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "1564f056-486a-45ae-b2a3-469780c40030", "uuid": "1564f056-486a-45ae-b2a3-469780c40030",
"rawTextureUuid": "605d5fc5-57f3-4976-824a-8950c5abf936", "rawTextureUuid": "605d5fc5-57f3-4976-824a-8950c5abf936",
......
{
"ver": "2.3.5",
"uuid": "bb3258e5-a29f-44cd-9793-db49f291cbaf",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 96,
"height": 98,
"platformSettings": {},
"subMetas": {
"jshx_bg_audio_off_extreme_skiing": {
"ver": "1.0.4",
"uuid": "6f4ea38d-9ee3-457e-9ede-696ccaaae2fd",
"rawTextureUuid": "bb3258e5-a29f-44cd-9793-db49f291cbaf",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 96,
"height": 98,
"rawWidth": 96,
"rawHeight": 98,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c77b1e43-3428-4f4e-8264-42973a7f70b0",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 96,
"height": 98,
"platformSettings": {},
"subMetas": {
"jshx_bg_audio_on_extreme_skiing": {
"ver": "1.0.4",
"uuid": "d7fa09d2-66ee-4265-b5e0-39f747db6059",
"rawTextureUuid": "c77b1e43-3428-4f4e-8264-42973a7f70b0",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 96,
"height": 98,
"rawWidth": 96,
"rawHeight": 98,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
...@@ -66,12 +66,12 @@ export class ComponentBase { ...@@ -66,12 +66,12 @@ export class ComponentBase {
* 储存音频数据 * 储存音频数据
* @param e * @param e
*/ */
onAudioUploadSuccess(e, key, it = this.item) { onAudioUploadSuccess(e, key, it = this.item,audioName) {
let url = e.url; let url = e.url;
let sp = url.split(".mp3"); let sp = url.split(".mp3");
let u = sp[0] + "_l.mp3"; let u = sp[0] + "_l.mp3";
it[key] = u; it[key] = u;
it["audioName"] = e.name || ""; it[audioName] = e.name || "";
this.save(); this.save();
} }
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
<div style="display:flex ;"> <div style="display:flex ;">
<div> <div>
<app-audio-recorder [audioUrl]="item.questionTextAudio" <app-audio-recorder [audioUrl]="item.questionTextAudio"
(audioUploaded)="onAudioUploadSuccess($event, 'questionTextAudio')"></app-audio-recorder> (audioUploaded)="onAudioUploadSuccess($event, 'questionTextAudio',item,'audioName')"></app-audio-recorder>
</div> </div>
<div style="margin: 5px"> <div style="margin: 5px">
<span>{{ item.audioName}}</span> <span>{{ item.audioName}}</span>
...@@ -92,6 +92,32 @@ ...@@ -92,6 +92,32 @@
</div> </div>
</div> </div>
<div class="border-dashed" style="margin: 20px;width: 1000px;">
<div class="word-input-title">
<div>
<span>游戏背景音乐: </span>
</div>
<div>
<span style="color:rgb(201, 200, 200);margin-left:5px;font-size: 10px;"> *可不传,不传既无背景音乐</span>
</div>
</div>
<div style="display:flex ;margin-top: 10px;">
<div>
<app-audio-recorder [audioUrl]="item.bgAduio"
(audioUploaded)="onAudioUploadSuccess($event, 'bgAduio',item,'bgAduioName')">
</app-audio-recorder>
</div>
<div style="margin: 5px">
<span>{{ item.bgAduioName}}</span>
</div>
<div style="margin: 5px">
<span style="color: #169BD5;text-decoration: underline;" type="button" nzDanger
(click)="deleteBgAudio()">删除背景音</span>
</div>
</div>
</div>
<div style="margin: 20px;width: 1000px;"> <div style="margin: 20px;width: 1000px;">
<div *ngFor="let question of item.questions; let i = index"> <div *ngFor="let question of item.questions; let i = index">
<div style="display: flex;margin-top: 20px;"> <div style="display: flex;margin-top: 20px;">
...@@ -106,7 +132,7 @@ ...@@ -106,7 +132,7 @@
<div style="display: flex"> <div style="display: flex">
<div> <div>
<app-audio-recorder [audioUrl]="question.questionAudio" <app-audio-recorder [audioUrl]="question.questionAudio"
(audioUploaded)="onAudioUploadSuccess($event, 'questionAudio', question)"> (audioUploaded)="onAudioUploadSuccess($event, 'questionAudio', question,'audioName')">
</app-audio-recorder> </app-audio-recorder>
</div> </div>
<div style="margin: 5px"> <div style="margin: 5px">
...@@ -170,7 +196,7 @@ ...@@ -170,7 +196,7 @@
<div style="display: flex"> <div style="display: flex">
<div> <div>
<app-audio-recorder [audioUrl]="option.audio" <app-audio-recorder [audioUrl]="option.audio"
(audioUploaded)="onAudioUploadSuccess($event, 'audio', option)"> (audioUploaded)="onAudioUploadSuccess($event, 'audio', option,'audioName')">
</app-audio-recorder> </app-audio-recorder>
</div> </div>
<div style="margin: 5px"> <div style="margin: 5px">
......
...@@ -16,6 +16,8 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -16,6 +16,8 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
questionText: "雪地里有许多不同的指示牌,运动员要选择哪一个呢?亲爱的小玩家,请你认真听游戏指令,帮助运动员选择正确的指示牌吧!游戏结束后,根据收集到的指示牌数量,你将获得相应的能量石奖励哟!开始挑战吧!", questionText: "雪地里有许多不同的指示牌,运动员要选择哪一个呢?亲爱的小玩家,请你认真听游戏指令,帮助运动员选择正确的指示牌吧!游戏结束后,根据收集到的指示牌数量,你将获得相应的能量石奖励哟!开始挑战吧!",
questionTextAudio: "http://staging-teach.cdn.ireadabc.com/c3b69ad3d51385eac7d4195773ef59f7_l.mp3", questionTextAudio: "http://staging-teach.cdn.ireadabc.com/c3b69ad3d51385eac7d4195773ef59f7_l.mp3",
questions: [], questions: [],
bgAduio: "",
bgAduioName: "",
audioName: "" audioName: ""
}; };
...@@ -73,12 +75,18 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -73,12 +75,18 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this.item.questions.push({ this.item.questions.push({
options: [], options: [],
type: "", type: "",
questionAudio:"", questionAudio: "",
audioName:"", audioName: "",
}); });
this.save(); this.save();
} }
ngChange(i, j) { ngChange(i, j) {
this.save(); this.save();
} }
deleteBgAudio() {
this.item.bgAduio = "";
this.item.bgAduioName = "";
this.save();
}
} }
\ No newline at end of file
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