... | ... |
@@ -208,6 +208,29 @@ table.plateau tr td img { |
208 | 208 |
|
209 | 209 |
|
210 | 210 |
/* |
211 |
+ * ZONE DES TUILES RESTANTES |
|
212 |
+ */ |
|
213 |
+.zone-moi-tuilesrestantes { |
|
214 |
+ display: inline-block; |
|
215 |
+ border: 3px solid black; |
|
216 |
+ margin: 0px auto 0px 10px; |
|
217 |
+ width: 360px; /* 60 x 3 x 2 */ |
|
218 |
+} |
|
219 |
+ |
|
220 |
+.zone-moi-tuilesrestantes table tr td { |
|
221 |
+ position: relative; |
|
222 |
+} |
|
223 |
+ |
|
224 |
+.zone-moi-tuilesrestantes table tr td img { |
|
225 |
+ position: absolute; |
|
226 |
+ left: 0; |
|
227 |
+ top: 0; |
|
228 |
+} |
|
229 |
+ |
|
230 |
+ |
|
231 |
+ |
|
232 |
+ |
|
233 |
+/* |
|
211 | 234 |
* BAS DE L'ECRAN |
212 | 235 |
*/ |
213 | 236 |
.bas-btn { |
... | ... |
@@ -92,6 +92,29 @@ class PartieInfos { |
92 | 92 |
return $piocheTxt; |
93 | 93 |
} |
94 | 94 |
|
95 |
+ public function tuilesRestantesJson() { |
|
96 |
+ if(!$this->_exist) return false; |
|
97 |
+ |
|
98 |
+ $tuilesTab = []; |
|
99 |
+ |
|
100 |
+ for($i = 0 ; $i < count($this->pioche) ; $i++) { |
|
101 |
+ if( !$tuilesTab[ $this->pioche[$i] ] ) |
|
102 |
+ $tuilesTab[ $this->pioche[$i] ] = 1; |
|
103 |
+ else |
|
104 |
+ $tuilesTab[ $this->pioche[$i] ]++; |
|
105 |
+ } |
|
106 |
+ |
|
107 |
+ $tuilesJson = ''; |
|
108 |
+ $first = true; |
|
109 |
+ foreach($tuilesTab as $t => $nb) { |
|
110 |
+ if($first) $first = false; |
|
111 |
+ else $tuilesJson .= ', '; |
|
112 |
+ $tuilesJson .= '"'.$t.'":'.$nb; |
|
113 |
+ } |
|
114 |
+ |
|
115 |
+ return $tuilesJson; |
|
116 |
+ } |
|
117 |
+ |
|
95 | 118 |
public function nouvelle() { |
96 | 119 |
global $db, $__CONF; |
97 | 120 |
|
... | ... |
@@ -141,10 +141,76 @@ var scInput_JeuNom = '<?php echo $__CONF['nom']; ?>'; |
141 | 141 |
<div class="zone-moi-plateau"> |
142 | 142 |
<?php affichePlateauJoueur($scMoi); ?> |
143 | 143 |
</div> |
144 |
+ |
|
145 |
+<?php |
|
146 |
+ |
|
147 |
+function afficheTuilesRestantes($t, $p) { |
|
148 |
+ echo '<td class="zone-moi-tuilesrestantes-nbr" id="TuileRestante_'.$t.$p.'">'; |
|
149 |
+ echo '</td>'; |
|
150 |
+ |
|
151 |
+ echo '<td class="zone-moi-tuilesrestantes-tuile">'; |
|
152 |
+ echo '<img src="src/tuile_'.$t.'" />'; |
|
153 |
+ if($p) echo '<img src="src/tuile_'.$p.'" />'; |
|
154 |
+ echo '</td>'; |
|
155 |
+} |
|
156 |
+ |
|
157 |
+?> |
|
158 |
+ |
|
159 |
+ |
|
160 |
+ <div class="zone-moi-tuilesrestantes"> |
|
161 |
+ <table> |
|
162 |
+ <tr> |
|
163 |
+<?php afficheTuilesRestantes('1', ''); ?> |
|
164 |
+<?php afficheTuilesRestantes('1', 'd'); ?> |
|
165 |
+<?php afficheTuilesRestantes('1', 'o'); ?> |
|
166 |
+ </tr> |
|
167 |
+ <tr> |
|
168 |
+<?php afficheTuilesRestantes('2', ''); ?> |
|
169 |
+<?php afficheTuilesRestantes('2', 'd'); ?> |
|
170 |
+<?php afficheTuilesRestantes('2', 'o'); ?> |
|
171 |
+ </tr> |
|
172 |
+ <tr> |
|
173 |
+<?php afficheTuilesRestantes('3', ''); ?> |
|
174 |
+<?php afficheTuilesRestantes('4', ''); ?> |
|
175 |
+<?php afficheTuilesRestantes('4', 'd'); ?> |
|
176 |
+ </tr> |
|
177 |
+ <tr> |
|
178 |
+<?php afficheTuilesRestantes('5', ''); ?> |
|
179 |
+<?php afficheTuilesRestantes('6', ''); ?> |
|
180 |
+<?php afficheTuilesRestantes('7', ''); ?> |
|
181 |
+ </tr> |
|
182 |
+ <tr> |
|
183 |
+<?php afficheTuilesRestantes('8', 'd'); ?> |
|
184 |
+<?php afficheTuilesRestantes('9', ''); ?> |
|
185 |
+<?php afficheTuilesRestantes('9', 'd'); ?> |
|
186 |
+ </tr> |
|
187 |
+ <tr> |
|
188 |
+<?php afficheTuilesRestantes('10', ''); ?> |
|
189 |
+<?php afficheTuilesRestantes('10', 'd'); ?> |
|
190 |
+ <td colspan=2 rowspan=2>Tuiles restantes dans la pioche (dont la tuile en cours)</td> |
|
191 |
+ </tr> |
|
192 |
+ <tr> |
|
193 |
+<?php afficheTuilesRestantes('11', ''); ?> |
|
194 |
+<?php afficheTuilesRestantes('11', 'd'); ?> |
|
195 |
+ </tr> |
|
196 |
+ </table> |
|
197 |
+ </div> |
|
198 |
+ |
|
199 |
+ |
|
200 |
+ |
|
201 |
+ |
|
202 |
+ |
|
144 | 203 |
</div> |
145 | 204 |
|
146 | 205 |
|
147 | 206 |
|
207 |
+ |
|
208 |
+ |
|
209 |
+ |
|
210 |
+ |
|
211 |
+ |
|
212 |
+ |
|
213 |
+ |
|
148 | 214 |
<div class="bas-btn" id="basBoutons"> |
149 | 215 |
<div class="bas-btn-terminer jeu-btn" id="basBoutonTerminer">Terminer la partie</div> |
150 | 216 |
</div> |
... | ... |
@@ -182,6 +182,8 @@ echo '"pioche":"'.$scPartie->pioche[0].'", '; |
182 | 182 |
echo '"nbpioche":'.(count($scPartie->pioche) - 1).', '; |
183 | 183 |
echo '"tresor":'.JsonTab( $scPartie->nextTresor() ).', '; |
184 | 184 |
|
185 |
+echo '"tuilesrestantes":{'.$scPartie->tuilesRestantesJson().'}, '; |
|
186 |
+ |
|
185 | 187 |
// * Joueurs |
186 | 188 |
echo '"joueur":{'; |
187 | 189 |
echo JsonJoueur( $scMoi ); |
... | ... |
@@ -144,6 +144,13 @@ $(document).ready(function() { |
144 | 144 |
$('#zoneInfosTemple' + (t + 1)).html( data['tresor'][t] ); |
145 | 145 |
|
146 | 146 |
|
147 |
+ // AFFICHAGE DU NBR DE TUILES RESTANTES |
|
148 |
+ if( !lastData || lastData['nbpioche'] != data['nbpioche'] ) { |
|
149 |
+ var listeTuilesRestantes = ['1', '1d', '1o', '2', '2d', '2o', '3', '4', '4d', '5', '6', '7', '8d', '9', '9d', '10', '10d', '11', '11d']; |
|
150 |
+ for(var t = 0 ; t < listeTuilesRestantes.length ; t++) |
|
151 |
+ $( '#TuileRestante_' + listeTuilesRestantes[t] ).html( ( data['tuilesrestantes'][ listeTuilesRestantes[t] ] ? data['tuilesrestantes'][ listeTuilesRestantes[t] ] : '0' ) + 'x' ); |
|
152 |
+ } |
|
153 |
+ |
|
147 | 154 |
} |
148 | 155 |
// FIN DE PARTIE : statut > 10 |
149 | 156 |
else if(data['statut'] >= 10) { |