Commit a25a607d authored by yu's avatar yu

背景音乐

parent 9dfa4cab
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