partie avec pion vide fonctionnelle
This commit is contained in:
parent
bfb83c514e
commit
2538749068
@ -71,4 +71,8 @@ public class ChoiceCombi extends Activity implements SaisieActivity {
|
||||
this.saisie.initSelection(this.getResources().getColor(R.color.pionVide));
|
||||
this.view.invalidate();
|
||||
}
|
||||
|
||||
public int getNbrPion() {
|
||||
return this.saisie.getSizeChoix();
|
||||
}
|
||||
}
|
@ -87,6 +87,10 @@ public class GameActivity extends Activity implements SaisieActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public int getNbrPion() {
|
||||
return this.saisie.getSizeChoix();
|
||||
}
|
||||
|
||||
//Change l'état de soumission à notation après qu'une combinaision ai été soumise puis inversement
|
||||
public void changeState() {
|
||||
if(!this.bot) {
|
||||
@ -200,7 +204,7 @@ public class GameActivity extends Activity implements SaisieActivity {
|
||||
this.pionsAttaquant[4]=this.getResources().getColor(R.color.yellow);
|
||||
this.pionsAttaquant[5]=this.getResources().getColor(R.color.white);
|
||||
if(emptyPion) {
|
||||
this.pionsAttaquant[6]=this.getResources().getColor(R.color.pionVide);
|
||||
this.pionsAttaquant[6]=this.getResources().getColor(R.color.vide);
|
||||
}
|
||||
|
||||
// on inisialise la saisie
|
||||
|
@ -8,5 +8,7 @@ public interface SaisieActivity {
|
||||
void removePion();
|
||||
|
||||
void clearChoix();
|
||||
|
||||
int getNbrPion();
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,10 @@ public class Saisie {
|
||||
}
|
||||
}
|
||||
|
||||
public int getSizeChoix() {
|
||||
return this.choix.size();
|
||||
}
|
||||
|
||||
public Integer[] getSelection(){
|
||||
Integer[] selectiontab=new Integer[4];
|
||||
for (int i=0;i<this.selection.size();i++){
|
||||
|
@ -21,19 +21,38 @@ public class TouchListener implements View.OnTouchListener{
|
||||
{
|
||||
//Surveille quel bouton de couleur est choisi
|
||||
if (v.getHeight()-v.getHeight()/7-v.getWidth()/16<y && y<v.getHeight()-v.getHeight()/7+v.getWidth()/16){
|
||||
if(v.getWidth()/8-v.getWidth()/15<x && x<v.getWidth()/8+v.getWidth()/15){
|
||||
this.context.addChoix(0);
|
||||
} else if(v.getWidth()*2/13+v.getWidth()/8-v.getWidth()/15<x && x<v.getWidth()*2/13+v.getWidth()/8+v.getWidth()/15){
|
||||
this.context.addChoix(1);
|
||||
} else if(2*v.getWidth()*2/13+v.getWidth()/8-v.getWidth()/15<x && x<2*v.getWidth()*2/13+v.getWidth()/8+v.getWidth()/15) {
|
||||
this.context.addChoix(2);
|
||||
} else if(3*v.getWidth()*2/13+v.getWidth()/8-v.getWidth()/15<x && x<3*v.getWidth()*2/13+v.getWidth()/8+v.getWidth()/15){
|
||||
this.context.addChoix(3);
|
||||
} else if(4*v.getWidth()*2/13+v.getWidth()/8-v.getWidth()/15<x && x<4*v.getWidth()*2/13+v.getWidth()/8+v.getWidth()/15) {
|
||||
this.context.addChoix(4);
|
||||
} else if(5*v.getWidth()*2/13+v.getWidth()/8-v.getWidth()/15<x && x<5*v.getWidth()*2/13+v.getWidth()/8+v.getWidth()/15){
|
||||
this.context.addChoix(5);
|
||||
if(this.context.getNbrPion() == 6 || this.context.getNbrPion() == 2) {
|
||||
if (v.getWidth() / 8 - v.getWidth() / 15 < x && x < v.getWidth() / 8 + v.getWidth() / 15) {
|
||||
this.context.addChoix(0);
|
||||
} else if (v.getWidth() * 2 / 13 + v.getWidth() / 8 - v.getWidth() / 15 < x && x < v.getWidth() * 2 / 13 + v.getWidth() / 8 + v.getWidth() / 15) {
|
||||
this.context.addChoix(1);
|
||||
} else if (2 * v.getWidth() * 2 / 13 + v.getWidth() / 8 - v.getWidth() / 15 < x && x < 2 * v.getWidth() * 2 / 13 + v.getWidth() / 8 + v.getWidth() / 15) {
|
||||
this.context.addChoix(2);
|
||||
} else if (3 * v.getWidth() * 2 / 13 + v.getWidth() / 8 - v.getWidth() / 15 < x && x < 3 * v.getWidth() * 2 / 13 + v.getWidth() / 8 + v.getWidth() / 15) {
|
||||
this.context.addChoix(3);
|
||||
} else if (4 * v.getWidth() * 2 / 13 + v.getWidth() / 8 - v.getWidth() / 15 < x && x < 4 * v.getWidth() * 2 / 13 + v.getWidth() / 8 + v.getWidth() / 15) {
|
||||
this.context.addChoix(4);
|
||||
} else if (5 * v.getWidth() * 2 / 13 + v.getWidth() / 8 - v.getWidth() / 15 < x && x < 5 * v.getWidth() * 2 / 13 + v.getWidth() / 8 + v.getWidth() / 15) {
|
||||
this.context.addChoix(5);
|
||||
}
|
||||
} else if(this.context.getNbrPion() == 7) {
|
||||
if (v.getWidth() / 8 - v.getWidth() / 15 < x && x < v.getWidth() / 8 + v.getWidth() / 15) {
|
||||
this.context.addChoix(0);
|
||||
} else if (v.getWidth() * 2 / 14 + v.getWidth() / 14 - v.getWidth() / 18 < x && x < v.getWidth() * 2 / 14 + v.getWidth() / 14 + v.getWidth() / 18) {
|
||||
this.context.addChoix(1);
|
||||
} else if (2 * v.getWidth() * 2 / 14 + v.getWidth() / 14 - v.getWidth() / 18 < x && x < 2 * v.getWidth() * 2 / 14 + v.getWidth() / 14 + v.getWidth() / 18) {
|
||||
this.context.addChoix(2);
|
||||
} else if (3 * v.getWidth() * 2 / 14 + v.getWidth() / 14 - v.getWidth() / 18 < x && x < 3 * v.getWidth() * 2 / 14 + v.getWidth() / 14 + v.getWidth() / 18) {
|
||||
this.context.addChoix(3);
|
||||
} else if (4 * v.getWidth() * 2 / 14 + v.getWidth() / 14 - v.getWidth() / 18 < x && x < 4 * v.getWidth() * 2 / 14 + v.getWidth() / 14 + v.getWidth() / 18) {
|
||||
this.context.addChoix(4);
|
||||
} else if (5 * v.getWidth() * 2 / 14 + v.getWidth() / 14 - v.getWidth() / 18 < x && x < 5 * v.getWidth() * 2 / 14 + v.getWidth() / 14 + v.getWidth() / 18) {
|
||||
this.context.addChoix(5);
|
||||
} else if(6 * v.getWidth() * 2 / 14 + v.getWidth() / 14 - v.getWidth() / 18 < x && x < 6 * v.getWidth() * 2 / 14 + v.getWidth() / 14 + v.getWidth() / 18) {
|
||||
this.context.addChoix(6);
|
||||
}
|
||||
}
|
||||
|
||||
// surveille si un bouton de controle est cliqué
|
||||
} else if (v.getHeight()-v.getWidth()/16-v.getWidth()/13<y && y<v.getHeight()-v.getHeight()/16+v.getWidth()/13){
|
||||
if(v.getWidth()/2+(v.getWidth()/11)*2-v.getWidth()/13<x && x<v.getWidth()/2+(v.getWidth()/11)*2+v.getWidth()/13) { // soumettre
|
||||
|
@ -14,5 +14,6 @@
|
||||
<color name="yellow">#FFFEC603</color>
|
||||
<color name="grey">#FF333333</color>
|
||||
<color name="pionVide">#FF999999</color>
|
||||
<color name="vide">#FF889998</color>
|
||||
<color name="red">#d32f2f</color>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user