Commit 606ebabf authored by asdf's avatar asdf

音频调整

parent 0385b399
...@@ -23,19 +23,23 @@ ...@@ -23,19 +23,23 @@
<div class="card-item-content border"> <div class="card-item-content border">
<span style="height: 30px; font-size: 18px;">第{{i + 1}}页题干:</span> <span style="height: 30px; font-size: 18px;">第{{i + 1}}页题干:</span>
<br> <br>
<span style="height: 30px; font-size: 18px;">题干音频:</span>
<app-audio-recorder [audioUrl]="question.pageAudio" (audioUploaded)="onPageUploadSuccess($event, i)">
</app-audio-recorder>
<br>
<div *ngFor="let option of question.optionList; let j = index" class="section-content;text-align:center" <div *ngFor="let option of question.optionList; let j = index" class="section-content;text-align:center"
style="padding: 0.5vw; display: inline-block"> style="padding: 0.5vw; display: inline-block">
<div style="margin-top: 20px; float: left; border-width: 1px; border-style: dotted; <div style="margin-top: 20px; float: left; border-width: 1px; border-style: dotted;
padding: 20px; margin-right: 20px; width: 230px;"> padding: 20px; margin-right: 20px; width: 230px;">
<span style="height: 30px; font-size: 18px;">题干音频:</span> <span style="height: 30px; font-size: 18px;">选项音频:</span>
<app-audio-recorder [audioUrl]="option.optionAudio" (audioUploaded)="onOptionUploadSuccess($event, i, j)"> <app-audio-recorder [audioUrl]="option.optionAudio" (audioUploaded)="onOptionUploadSuccess($event, i, j)">
</app-audio-recorder> </app-audio-recorder>
<br> <br>
<span style="height: 30px; font-size: 18px;">题干文本:</span> <span style="height: 30px; font-size: 18px;">选项文本:</span>
<input style="width: 150px; " type="text" maxlength="" nz-input [(ngModel)]="option.text" (blur)="save()"> <input style="width: 150px; " type="text" maxlength="" nz-input [(ngModel)]="option.text" (blur)="save()">
<br> <br>
<span style="height: 30px; font-size: 18px;">题干骨骼动画:</span> <span style="height: 30px; font-size: 18px;">选项骨骼动画:</span>
<app-upload-dragon-bone [btnName]="[['配置骨骼动画']]" [animaNames]="[[['normal']]]" <app-upload-dragon-bone [btnName]="[['配置骨骼动画']]" [animaNames]="[[['normal']]]"
[skeJsonData]=option.optionDragonBone.skeJsonData [texJsonData]=option.optionDragonBone.texJsonData [skeJsonData]=option.optionDragonBone.skeJsonData [texJsonData]=option.optionDragonBone.texJsonData
[texPngData]=option.optionDragonBone.texPngData (save)="saveAnima($event, option.optionDragonBone)" [texPngData]=option.optionDragonBone.texPngData (save)="saveAnima($event, option.optionDragonBone)"
......
...@@ -22,6 +22,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -22,6 +22,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
addQuestion() { addQuestion() {
this.item.questionList.push( this.item.questionList.push(
{ {
"pageAudio":"",
"rightOptionIdx": 0, "rightOptionIdx": 0,
"optionList": [{ "optionList": [{
"text": "", "text": "",
...@@ -115,7 +116,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -115,7 +116,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
init() { init() {
} }
onPageUploadSuccess(e, questionIdx) {
this.item.questionList[questionIdx].pageAudio = e.url;
this.save();
}
onOptionUploadSuccess(e, questionIdx, optionIdx) { onOptionUploadSuccess(e, questionIdx, optionIdx) {
this.item.questionList[questionIdx].optionList[optionIdx].optionAudio = e.url; this.item.questionList[questionIdx].optionList[optionIdx].optionAudio = e.url;
this.save(); this.save();
......
...@@ -136,11 +136,27 @@ cc.Class({ ...@@ -136,11 +136,27 @@ cc.Class({
// this.dragonBone.premultipliedAlpha = true; // this.dragonBone.premultipliedAlpha = true;
// atlas.texture.setPremultiplyAlpha(true); // atlas.texture.setPremultiplyAlpha(true);
this.setSpineScale(data.canvas);
} }
}); });
} }
}); });
}, },
setSpineScale(size) {
let bgWidth = 200;
let bgHeight = 200;
if (size.width != bgWidth || size.height != bgHeight) {
let designScale = bgWidth / bgHeight;
let scale = size.width / size.height;
if (scale > designScale) {
this.dragonBone.node.parent.scale = bgWidth / size.width;
} else {
this.dragonBone.node.parent.scale = bgHeight / size.height;
}
}
},
chooseRight() { chooseRight() {
this.showLight(); this.showLight();
this.playAudioRight(); this.playAudioRight();
......
...@@ -214,10 +214,9 @@ cc.Class({ ...@@ -214,10 +214,9 @@ cc.Class({
this.playAudioQuestion(); this.playAudioQuestion();
}) })
}, },
playAudioPage(isBtn) {
playAudioQuestion(isBtn) {
GameData.audioCount++; GameData.audioCount++;
let url = this.data.questionAudio; let url = this.data.pageAudio;
// url = 'http://127.0.0.1/iamflying.mp3'; // url = 'http://127.0.0.1/iamflying.mp3';
cc.assetManager.loadRemote(url, null, (err, clip) => { cc.assetManager.loadRemote(url, null, (err, clip) => {
if (err) { if (err) {
...@@ -234,6 +233,22 @@ cc.Class({ ...@@ -234,6 +233,22 @@ cc.Class({
}) })
}); });
}, },
playAudioQuestion() {
GameData.audioCount++;
let url = this.data.questionAudio;
// url = 'http://127.0.0.1/iamflying.mp3';
cc.assetManager.loadRemote(url, null, (err, clip) => {
if (err) {
console.log(err)
return;
}
let id = cc.audioEngine.play(clip, false, 1);
cc.audioEngine.setFinishCallback(id, () => {
GameData.audioCount--;
this.playAudioPage();
})
});
},
playAudioMove() { playAudioMove() {
GameData.audioCount++; GameData.audioCount++;
let id = cc.audioEngine.play(this.audMove, false, 1); let id = cc.audioEngine.play(this.audMove, false, 1);
...@@ -398,7 +413,7 @@ cc.Class({ ...@@ -398,7 +413,7 @@ cc.Class({
this.nodeDict.nodMask.parent = this.node; this.nodeDict.nodMask.parent = this.node;
cc.audioEngine.stopAll(); cc.audioEngine.stopAll();
this.initData(); this.initData();
this.playAudioQuestion(); this.playAudioPage();
GameData.startStepDone = false; GameData.startStepDone = false;
}, },
onTurnLast() { onTurnLast() {
...@@ -421,7 +436,7 @@ cc.Class({ ...@@ -421,7 +436,7 @@ cc.Class({
if (GameData.audioCount != 0) { if (GameData.audioCount != 0) {
return; return;
} }
this.playAudioQuestion(true); this.playAudioPage(true);
} else if (button.node.name == 'btnLast') { } else if (button.node.name == 'btnLast') {
this.onTurnLast(); this.onTurnLast();
} else if (button.node.name == 'btnReplay') { } else if (button.node.name == 'btnReplay') {
......
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