Commit d5b32c74 authored by 李维's avatar 李维

dev commit

parent af54c1ea
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
音频 音频
</div> </div>
<div style="flex:7"> <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> </div>
</div> </div>
......
...@@ -11,7 +11,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -11,7 +11,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
_item: any; _item: any;
dataArray: Array<Object> = []; dataArray: Array<Object> = [];
contentObj = {} contentObj = {
dataArray: []
}
KEY = 'DataKey_East_L226'; KEY = 'DataKey_East_L226';
...@@ -64,8 +66,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -64,8 +66,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.dataArray = this.item.contentObj.dataArray; this.dataArray = this.item.contentObj.dataArray;
} else { } else {
this.contentObj = defauleFormData; this.contentObj = defauleFormData;
this.dataArray = defauleFormData.dataArray
// console.log("使用默认数据", this.contentObj) // console.log("使用默认数据", this.contentObj)
this.item.contentObj = this.contentObj; this.item.contentObj = this.contentObj;
this.item.contentObj.dataArray = this.dataArray;
} }
} }
......
...@@ -54,7 +54,7 @@ const zIndexMap = { ...@@ -54,7 +54,7 @@ const zIndexMap = {
Curtain_D: 99, Curtain_D: 99,
Curtain_E: 110, Curtain_E: 110,
startButton: 120, startButton: 120,
liewen: 41, drum: 30,
answerCard: 45, answerCard: 45,
questionCard: 50, questionCard: 50,
mainQuestionImage: 35, mainQuestionImage: 35,
...@@ -207,7 +207,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -207,7 +207,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initBoy(); this.initBoy();
this.initCurtain(); this.initCurtain();
this.initStartButton(); this.initStartButton();
this.initRestartButton() this.initRestartButton();
this.initDrum();
} }
cleanGameVar(){ cleanGameVar(){
...@@ -281,15 +282,15 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -281,15 +282,15 @@ export class PlayComponent implements OnInit, OnDestroy {
}, (w, h)=>{ }, (w, h)=>{
return { return {
x: this.g_canvasWidth / 2, 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) this.render(element.ref, zIndexMap.boy)
element.ref.visible = true element.ref.visible = true
element.play = this.g_cartoon.createAnimation("boy", 30, 500) element.play = this.g_cartoon.createAnimation("boy", 30, 500)
element.play.x = this.g_canvasWidth / 2; element.play.x = element.ref.x;
element.play.y = this.g_canvasHeight / 2 + 70 * this.g_mapScale element.play.y = element.ref.y;
element.play.scaleX = element.ref.scaleX element.play.scaleX = element.ref.scaleX
element.play.scaleY = element.ref.scaleY element.play.scaleY = element.ref.scaleY
element.play.loop = true; element.play.loop = true;
...@@ -496,9 +497,41 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -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