debut back hotseat
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.example.mastermind;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.example.mastermind.game.GameView;
|
||||
import com.example.mastermind.game.Grille;
|
||||
import com.example.mastermind.game.Saisie;
|
||||
|
||||
public class HotSeatActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(new GameView(this, new Saisie(0), new Grille()));
|
||||
}
|
||||
}
|
@@ -20,14 +20,14 @@ public class MainActivity extends Activity {
|
||||
mORDI = findViewById(R.id.ORDI);
|
||||
mSettings = findViewById(R.id.Settings);
|
||||
//mRules = findViewById(R.id.Rules);
|
||||
/*mHotSeat.setOnClickListener(new View.OnClickListener() {
|
||||
mHotSeat.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent tp1Intent = new Intent(MainActivity.this, HotSeat.class);
|
||||
Intent tp1Intent = new Intent(MainActivity.this, HotSeatActivity.class);
|
||||
startActivity(tp1Intent);
|
||||
}
|
||||
});
|
||||
mORDI.setOnClickListener(new View.OnClickListener() {
|
||||
/*mORDI.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent tp2Intent = new Intent(MainActivity.this, ORDI.class);
|
||||
|
17
app/src/main/java/com/example/mastermind/game/GameView.java
Normal file
17
app/src/main/java/com/example/mastermind/game/GameView.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.example.mastermind.game;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.view.View;
|
||||
|
||||
public class GameView extends View {
|
||||
public GameView(Context context,Saisie saisie,Grille grille) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas){
|
||||
super.onDraw(canvas);
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
package com.example.mastermind.game;
|
||||
|
||||
public class Grille {
|
||||
}
|
50
app/src/main/java/com/example/mastermind/game/Saisie.java
Normal file
50
app/src/main/java/com/example/mastermind/game/Saisie.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package com.example.mastermind.game;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
/*
|
||||
* Classe qui correspond à uen zone de saisie (soumission d'une combinaison ou notation)
|
||||
* choix correspond aux couleurs pouvant être saisies en fonction de la situation et selection à la combinaison choisie
|
||||
*/
|
||||
public class Saisie {
|
||||
|
||||
private Color[] choix;
|
||||
private Color[] selection;
|
||||
public Saisie(int state){
|
||||
// state correspond à si on soumet une combinaison ou si on la note (0 combi, 1 notation)
|
||||
if (state==0){
|
||||
choixCombinaison();
|
||||
} else if (state==1){
|
||||
notation();
|
||||
} // eventuellement signaler une erreur si on a une autre valeur
|
||||
}
|
||||
|
||||
// rempli le tableau de couleur avec les pions de l'attaquant
|
||||
public void choixCombinaison(){
|
||||
this.choix = new Color[6];
|
||||
}
|
||||
|
||||
// Rempli le tableau de couleur avec les pions du défenseur
|
||||
public void notation(){
|
||||
this.choix = new Color[2];
|
||||
}
|
||||
|
||||
// getters et setters
|
||||
|
||||
public void setChoix(Color[] colorsToChose){
|
||||
this.choix=colorsToChose;
|
||||
}
|
||||
|
||||
public Color[] getChoix(){
|
||||
return this.choix;
|
||||
}
|
||||
|
||||
public void setSelection(Color[] colorsSelected){
|
||||
this.selection=colorsSelected;
|
||||
}
|
||||
|
||||
public Color[] getSelection(){
|
||||
return this.selection;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user