1
1
import Konva from 'konva' ;
2
2
import { TABLE } from '../../../constants/constants' ;
3
3
import { GameStatus , GradinBrut , GradinBrutId , Team , } from '../../../models/showMustGoOn/GameStatus' ;
4
- import { start } from "@popperjs/core" ;
5
4
6
5
export class GameStatusManager {
7
6
gradinsBruts : Konva . Group ;
@@ -32,8 +31,8 @@ export class GameStatusManager {
32
31
33
32
this . addAireConstruction ( status . airesConstruction ?. petitEquipe , team === Team . JAUNE ? 550 : 2000 )
34
33
this . addAireConstruction ( status . airesConstruction ?. grandEquipe , team === Team . JAUNE ? 1000 : 1550 )
35
- this . addAireConstruction ( status . airesConstruction ?. petitAdverse , team === Team . JAUNE ? 2000 : 550 )
36
- this . addAireConstruction ( status . airesConstruction ?. grandAdverse , team === Team . JAUNE ? 1550 : 1000 )
34
+ this . addAireConstruction ( status . airesConstruction ?. petitAdverse , team === Team . JAUNE ? 2550 : 0 )
35
+ this . addAireConstruction ( status . airesConstruction ?. grandAdverse , team === Team . JAUNE ? 3000 : 450 , true , team === Team . BLEU )
37
36
}
38
37
39
38
private addGradinBrut ( gradinBrut : GradinBrut ) {
@@ -64,14 +63,14 @@ export class GameStatusManager {
64
63
planche . moveToBottom ( )
65
64
66
65
const plancheText = new Konva . Text ( {
67
- text : gradinBrut . id . split ( '_' ) . slice ( 1 , 3 ) . join ( ' ' ) ,
66
+ text : gradinBrut . id . replaceAll ( '_' , ' ' ) ,
68
67
x : 0 ,
69
68
y : 0 ,
70
69
width : 400 ,
71
70
height : 100 ,
72
71
align : 'center' ,
73
72
verticalAlign : 'middle' ,
74
- fontSize : 40 ,
73
+ fontSize : 35 ,
75
74
fontStyle : 'bold' ,
76
75
fill : 'black' ,
77
76
stroke : 'white' ,
@@ -84,20 +83,27 @@ export class GameStatusManager {
84
83
this . gradinsBruts . add ( plancheGroup )
85
84
}
86
85
87
- private addAireConstruction ( aireConstruction : boolean [ ] [ ] , startX : number ) {
88
- aireConstruction . forEach ( ( gradinConstruit , index ) => this . addGradinConstruit ( gradinConstruit , startX , index ) )
86
+ private addAireConstruction ( aireConstruction : boolean [ ] [ ] , startX : number , vertical = false , reversed = false ) {
87
+ if ( reversed ) {
88
+ aireConstruction . slice ( ) . reverse ( ) . forEach ( ( gradinConstruit , index ) =>
89
+ this . addGradinConstruit ( gradinConstruit , startX , index , vertical ) )
90
+ } else {
91
+ aireConstruction . forEach ( ( gradinConstruit , index ) =>
92
+ this . addGradinConstruit ( gradinConstruit , startX , index , vertical ) )
93
+ }
89
94
}
90
95
91
- private addGradinConstruit ( gradinConstruit : boolean [ ] , startX : number , index : number ) {
96
+ private addGradinConstruit ( gradinConstruit : boolean [ ] , startX : number , index : number , vertical : boolean ) {
92
97
if ( ! gradinConstruit [ 0 ] ) return ;
93
98
94
99
const gradinGroup = new Konva . Group ( {
95
- x : ( startX + 25 ) * TABLE . imageRatio ,
96
- y : ( TABLE . height - 150 - index * 125 ) * TABLE . imageRatio ,
100
+ x : ( vertical ? startX - 150 - index * 125 : ( startX + 25 ) ) * TABLE . imageRatio ,
101
+ y : ( vertical ? ( TABLE . height - 675 ) : TABLE . height - 150 - index * 125 ) * TABLE . imageRatio ,
97
102
width : 400 ,
98
103
height : 100 ,
99
104
scaleX : TABLE . imageRatio ,
100
105
scaleY : TABLE . imageRatio ,
106
+ rotation : vertical ? - 90 : 0 ,
101
107
} )
102
108
103
109
const gradin = new Konva . Rect ( {
0 commit comments