Commit ab47c8a5 authored by 李维's avatar 李维

dev commit

parent 7a23a03a
......@@ -133,6 +133,7 @@ export class PlayComponent implements OnInit, OnDestroy {
m_allDrums = [];
m_dataArrayNew = [];
m_restartGameFlag: boolean = false;
m_drumFontSize: any = 84;
// ------------------------------------
......@@ -202,6 +203,7 @@ export class PlayComponent implements OnInit, OnDestroy {
initGame(){
console.log(this.g_formData);
this.m_drumFontSize = this.getMaxFontSize()
this.initBackground();
this.initBoy();
this.initCurtain();
......@@ -209,6 +211,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initRestartButton();
this.initDrum();
this.initLight();
console.log(this.m_drumFontSize)
}
cleanGameVar(){
......@@ -232,6 +235,29 @@ export class PlayComponent implements OnInit, OnDestroy {
this.g_cartoon.getCartoonElement("restart-button").in()
}
getMaxFontSize(){
let lengthAll = []
this.g_formData.dataArray.forEach(element => {
if(element.type == "Text"){
lengthAll.push(element.text.length)
}
});
let maxLength = Math.max(...lengthAll)
if(maxLength<=5){
return 84
}else if(maxLength>5 && maxLength<=10){
return 42
}else if(maxLength>10 && maxLength<=15){
return 28
}else if(maxLength>15 && maxLength<=20){
return 21
}else if(maxLength>20 && maxLength<=25){
return 16
}else{
return 7
}
}
initBackground(){
let mainBG = this.g_cartoon.createCartoonElementImageFunc("main-background", "background", (w ,h)=>{
return {
......@@ -515,6 +541,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}else{
element.rightHand.ref.visible = false
}
element.beatAnimate.setScaleXY(this.g_mapScale)
this.render(element.beatAnimate, zIndexMap.animation)
element.beatAnimate.play()
}
......@@ -867,7 +894,7 @@ export class PlayComponent implements OnInit, OnDestroy {
element.textContainer.visible = false;
element.textContainer.setScaleXY(0)
element.content = element.textContainer
element.text = this.g_cartoon.createLabel(contentData.text, "BerlinSansFBDemi-Bold", "#b94918", 84)
element.text = this.g_cartoon.createLabel(contentData.text, "BerlinSansFBDemi-Bold", "#b94918", this.m_drumFontSize)
element.text.outline = 15;
element.ref.addChild(element.textContainer)
......
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