Commit d5b32c74 authored by 李维's avatar 李维

dev commit

parent af54c1ea
......@@ -14,7 +14,7 @@
音频
</div>
<div style="flex:7">
<app-audio-recorder [audioUrl]="item.audio_url" (audioUploaded)="onUploadSuccessByItem($event, item, 'audio_url')" (beforePlaying)="stopAllAudio(i)"></app-audio-recorder>
<app-audio-recorder [audioUrl]="item.audio_url" (audioUploaded)="onUploadSuccessByItem($event, item, 'audio_url')" ></app-audio-recorder>
</div>
</div>
</div>
......
......@@ -11,7 +11,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
_item: any;
dataArray: Array<Object> = [];
contentObj = {}
contentObj = {
dataArray: []
}
KEY = 'DataKey_East_L226';
......@@ -64,8 +66,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.dataArray = this.item.contentObj.dataArray;
} else {
this.contentObj = defauleFormData;
this.dataArray = defauleFormData.dataArray
// console.log("使用默认数据", this.contentObj)
this.item.contentObj = this.contentObj;
this.item.contentObj.dataArray = this.dataArray;
}
}
......
......@@ -54,7 +54,7 @@ const zIndexMap = {
Curtain_D: 99,
Curtain_E: 110,
startButton: 120,
liewen: 41,
drum: 30,
answerCard: 45,
questionCard: 50,
mainQuestionImage: 35,
......@@ -207,7 +207,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initBoy();
this.initCurtain();
this.initStartButton();
this.initRestartButton()
this.initRestartButton();
this.initDrum();
}
cleanGameVar(){
......@@ -281,15 +282,15 @@ export class PlayComponent implements OnInit, OnDestroy {
}, (w, h)=>{
return {
x: this.g_canvasWidth / 2,
y: this.g_canvasHeight / 2 + 70 * this.g_mapScale
y: this.g_canvasHeight / 2 + 45 * this.g_mapScale
}
})
this.render(element.ref, zIndexMap.boy)
element.ref.visible = true
element.play = this.g_cartoon.createAnimation("boy", 30, 500)
element.play.x = this.g_canvasWidth / 2;
element.play.y = this.g_canvasHeight / 2 + 70 * this.g_mapScale
element.play.x = element.ref.x;
element.play.y = element.ref.y;
element.play.scaleX = element.ref.scaleX
element.play.scaleY = element.ref.scaleY
element.play.loop = true;
......@@ -496,9 +497,41 @@ export class PlayComponent implements OnInit, OnDestroy {
})
}
initDrum(){
if(this.g_formData.dataArray.length == 0){
return
}
let totalDrumNum = this.g_formData.dataArray.length - 1// s20 * this.g_mapScale
let baseX = [
this.g_canvasWidth / 2,
this.g_canvasWidth / 2 - (317 / 2) * this.g_mapScale,
this.g_canvasWidth / 2 - (317) * this.g_mapScale,
this.g_canvasWidth / 2 - (317 / 2) * 3 * this.g_mapScale
]
this.g_formData.dataArray.forEach((item, index) => {
let element = this.createDrum(index, item, baseX[totalDrumNum])
this.render(element.ref, zIndexMap.drum)
});
}
createDrum(index, data, baseX){
let color = ["red", "blue", "yellow", "green"]
let element = this.g_cartoon.createCartoonElementImageFunc(`drum=${index}`, color[index], (w ,h)=>{
return {
sx: 317 * this.g_mapScale / w,
sy: 312 * this.g_mapScale / h
}
}, (w, h)=>{
return {
x: baseX + index * 317 * this.g_mapScale,
y: this.g_canvasHeight / 2 + 200 * this.g_mapScale
}
})
return element
}
......
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