@ -6,8 +6,8 @@ class Description extends ManageLang {
create ( ) {
create ( ) {
super . create ( ) ;
super . create ( ) ;
let x = WIDTH _WINDOW / 2 ;
let x = WIDTH _WINDOW / 2 ;
let y = HEIGHT _WINDOW - 100 ;
let y = HEIGHT _WINDOW ;
let returnBtn = this . add . image ( x , y , 'cancel' ) . setOrigin ( 0.5 , 0.5 ) . setInteractive ( ) ;
let returnBtn = this . add . image ( x , y , 'cancel' ) . setOrigin ( 0.5 , 1 ) . setInteractive ( ) ;
returnBtn . on ( 'pointerover' , ( ) => returnBtn . setFrame ( 1 ) ) ;
returnBtn . on ( 'pointerover' , ( ) => returnBtn . setFrame ( 1 ) ) ;
returnBtn . on ( 'pointerout' , ( ) => returnBtn . setFrame ( 0 ) ) ;
returnBtn . on ( 'pointerout' , ( ) => returnBtn . setFrame ( 0 ) ) ;
returnBtn . on ( 'pointerdown' , ( ) => this . return ( ) ) ;
returnBtn . on ( 'pointerdown' , ( ) => this . return ( ) ) ;
@ -20,17 +20,34 @@ class Description extends ManageLang {
loadBonus ( ) {
loadBonus ( ) {
this . width = WIDTH _WINDOW / 3 - 20 ;
this . width = WIDTH _WINDOW / 3 - 20 ;
this . height = HEIGHT _WINDOW / 4 ;
this . height = HEIGHT _WINDOW / 4 ;
let x = 0 ;
let offX ;
this . createList ( lShieldBonus , x , true ) ;
let offY ;
x = WIDTH _WINDOW / 3 ;
let x ;
this . createList ( lSpeedBonus , x , false ) ;
if ( WIDTH _WINDOW > HEIGHT _WINDOW ) {
x = WIDTH _WINDOW / 1.5 ;
this . nbWidth = 1 ;
this . createList ( lAttackBonus , x , false ) ;
this . nbHeight = 3 ;
offX = WIDTH _WINDOW / 3 ;
offY = 0 ;
x = 0 ;
} else {
this . nbWidth = 3 ;
this . nbHeight = 1 ;
offX = 0 ;
offY = HEIGHT _WINDOW / 3.5 ;
x = WIDTH _BUTTON / 1.5 ;
}
let y = WIDTH _BUTTON / 1.5 ;
this . createList ( lShieldBonus , x , y , true ) ;
x += offX ;
y += offY ;
this . createList ( lSpeedBonus , x , y , false ) ;
x += offX ;
y += offY ;
this . createList ( lAttackBonus , x , y , false ) ;
}
}
createList ( listBonus , x , add = true ) {
createList ( listBonus , x , y , add = true ) {
let y = 50 ;
this . createCategoryBonus ( x , y , this . width * this . nbWidth , this . height * this . nbHeight ) ;
this . createCategoryBonus ( x , y , this . width , this . height * listBonus . length ) ;
listBonus . forEach ( bonus => {
listBonus . forEach ( bonus => {
let time = "" ;
let time = "" ;
if ( bonus . time !== undefined ) {
if ( bonus . time !== undefined ) {
@ -45,7 +62,10 @@ class Description extends ManageLang {
value = 'BONUS : ' + sign + bonus . value ;
value = 'BONUS : ' + sign + bonus . value ;
}
}
this . createBonusDescription ( x , y , this . width , this . height , bonus . texture , bonus . name , value + time ) ;
this . createBonusDescription ( x , y , this . width , this . height , bonus . texture , bonus . name , value + time ) ;
y += this . height ;
if ( this . nbHeight > 1 )
y += this . height ;
if ( this . nbWidth > 1 )
x += this . width ;
} ) ;
} ) ;
}
}
@ -62,12 +82,26 @@ class Description extends ManageLang {
height -= 20 ;
height -= 20 ;
this . add . rectangle ( x , y , width , height , 0xFFFFFF ) . setOrigin ( 0 , 0 ) ;
this . add . rectangle ( x , y , width , height , 0xFFFFFF ) . setOrigin ( 0 , 0 ) ;
let image = this . add . image ( x + 5 , y + 5 , texture ) . setOrigin ( 0 , 0 ) ;
let image = this . add . image ( x + 5 , y + 5 , texture ) . setOrigin ( 0 , 0 ) ;
image . displayHeight = 100 ;
let style = { fill : "#000000" } ;
image . scaleX = image . scaleY ;
if ( WIDTH _WINDOW > HEIGHT _WINDOW ) {
let style = { font : ( image . displayHeight / 2 - name . length ) + 'px stencil' , fill : "#000000" } ;
image . displayHeight = width / 5 ;
this . add . text ( x + image . displayWidth + 10 , y + 5 + image . displayHeight / 2 , name . toString ( ) , style ) . setOrigin ( 0 , 0.5 ) ;
image . scaleX = image . scaleY ;
style . font = ( height / 6 ) + 'px stencil' ;
style . font = ( image . displayHeight / 3 ) . toString ( ) + 'px stencil' ;
this . add . text ( x + 5 , y + image . displayHeight + ( height - image . displayHeight ) / 2 , text . toString ( ) , style ) . setOrigin ( 0 , 0.5 ) ;
this . add . text ( x + image . displayWidth + 10 , y + 5 + image . displayHeight / 2 , name . toString ( ) , style ) . setOrigin ( 0 , 0.5 ) ;
style . font = ( image . displayHeight / 4 ) . toString ( ) + 'px stencil' ;
this . add . text ( x + 5 , y + image . displayHeight + ( height - image . displayHeight ) / 2 , text . toString ( ) , style ) . setOrigin ( 0 , 0.5 ) ;
} else {
image . displayHeight = height / 2 ;
image . scaleX = image . scaleY ;
if ( image . displayWidth > width ) {
image . displayWidth = width ;
image . scaleY = image . scaleX ;
}
style . font = ( width / 10 ) . toString ( ) + 'px stencil' ;
this . add . text ( x + 5 , y + image . displayHeight + ( height - image . displayHeight ) / 3 , name . toString ( ) , style ) . setOrigin ( 0 , 0 ) ;
style . font = ( width / 15 ) . toString ( ) + 'px stencil' ;
this . add . text ( x + 5 , y + image . displayHeight + ( height - image . displayHeight ) / 1.5 , text . toString ( ) , style ) . setOrigin ( 0 , 1 ) ;
}
}
}
return ( ) {
return ( ) {