debut back hotseat
This commit is contained in:
parent
3ab00b65ec
commit
686cb2d0cc
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.example.mastermind" >
|
||||
package="com.example.mastermind">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
@ -12,7 +12,10 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MasterMind"
|
||||
tools:targetApi="31" >
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".HotSeatActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:exported="false"
|
||||
@ -24,7 +27,7 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true" >
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
@ -6,7 +5,6 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="#333"
|
||||
android:padding="10dp"
|
||||
android:orientation="vertical"
|
||||
tools:context=".MainActivity"
|
||||
>
|
||||
|
||||
|
@ -7,4 +7,11 @@
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="blue">#FF16D6FA</color>
|
||||
<color name="purple">#FFAF87CE</color>
|
||||
<color name="pink">#FFEA1A7F</color>
|
||||
<color name="green">#FFA8F387</color>
|
||||
<color name="yellow">#FFFEC603</color>
|
||||
<color name="grey">#FF333333</color>
|
||||
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user