diff --git a/.gradle/7.5/executionHistory/executionHistory.bin b/.gradle/7.5/executionHistory/executionHistory.bin index 3ab2420..1309a75 100644 Binary files a/.gradle/7.5/executionHistory/executionHistory.bin and b/.gradle/7.5/executionHistory/executionHistory.bin differ diff --git a/.gradle/7.5/executionHistory/executionHistory.lock b/.gradle/7.5/executionHistory/executionHistory.lock index 5036b87..eb6c504 100644 Binary files a/.gradle/7.5/executionHistory/executionHistory.lock and b/.gradle/7.5/executionHistory/executionHistory.lock differ diff --git a/.gradle/7.5/fileHashes/fileHashes.bin b/.gradle/7.5/fileHashes/fileHashes.bin index 8517f23..2435f8d 100644 Binary files a/.gradle/7.5/fileHashes/fileHashes.bin and b/.gradle/7.5/fileHashes/fileHashes.bin differ diff --git a/.gradle/7.5/fileHashes/fileHashes.lock b/.gradle/7.5/fileHashes/fileHashes.lock index 0ce4410..c14ad52 100644 Binary files a/.gradle/7.5/fileHashes/fileHashes.lock and b/.gradle/7.5/fileHashes/fileHashes.lock differ diff --git a/.gradle/7.5/fileHashes/resourceHashesCache.bin b/.gradle/7.5/fileHashes/resourceHashesCache.bin index ae4f631..ec464ae 100644 Binary files a/.gradle/7.5/fileHashes/resourceHashesCache.bin and b/.gradle/7.5/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index cf258b4..31aa84a 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7ea4ffe..5fd120f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,6 +14,9 @@ + diff --git a/app/src/main/java/com/example/mastermind/FinDePartieActivity.java b/app/src/main/java/com/example/mastermind/FinDePartieActivity.java new file mode 100644 index 0000000..0610754 --- /dev/null +++ b/app/src/main/java/com/example/mastermind/FinDePartieActivity.java @@ -0,0 +1,48 @@ +package com.example.mastermind; + +import android.content.Intent; +import android.os.Bundle; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.mastermind.vue.mastermind.UnePiece; + +public class FinDePartieActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_fin_de_partie); + + boolean trouve = getIntent().getBooleanExtra("trouve", false); + int[] code = getIntent().getIntArrayExtra("code"); + int tours = getIntent().getIntExtra("tour", 0); + + if (trouve){ + ((TextView)findViewById(R.id.texte_gagnant)).setText("Victoire de l'attaquant"); + } else { + ((TextView)findViewById(R.id.texte_gagnant)).setText("Victoire du défenseur"); + } + + ((UnePiece)findViewById(R.id.reponse_code1)).setColor(code[0]); + ((UnePiece)findViewById(R.id.reponse_code2)).setColor(code[1]); + ((UnePiece)findViewById(R.id.reponse_code3)).setColor(code[2]); + ((UnePiece)findViewById(R.id.reponse_code4)).setColor(code[3]); + + if (trouve) { + if (tours == 0) { + ((TextView)findViewById(R.id.texte_nombre_coups)).setText("Le défenseur a trouvé le code en 1 tentative"); + } else { + ((TextView)findViewById(R.id.texte_nombre_coups)).setText("Le défenseur a trouvé le code en " + (tours+1) + " tentatives"); + } + } + } + + @Override + public void onBackPressed() { + Intent menu=new Intent(this, MenuActivity.class); + this.startActivity(menu); + this.finish(); + } +} diff --git a/app/src/main/java/com/example/mastermind/MasterMindActivity.java b/app/src/main/java/com/example/mastermind/MasterMindActivity.java index 491773e..f02e619 100644 --- a/app/src/main/java/com/example/mastermind/MasterMindActivity.java +++ b/app/src/main/java/com/example/mastermind/MasterMindActivity.java @@ -2,6 +2,7 @@ package com.example.mastermind; import android.content.Intent; import android.os.Bundle; +import android.util.Log; import android.view.View; import android.widget.LinearLayout; @@ -54,37 +55,42 @@ public class MasterMindActivity extends AppCompatActivity { public void nextTurn(){ if(this.tour<9){ //on affiche la correction - this.afficherCorrection((LinearLayout) this.jeu.getChildAt(this.tour)); + boolean gagne = this.afficherCorrection((LinearLayout) this.jeu.getChildAt(this.tour)); //on supprime les listener if(this.tour>0){ LinearLayout anciennesPieces =(LinearLayout) this.jeu.getChildAt(this.tour-1); for(int i=0; i0){ LinearLayout anciennesPieces =(LinearLayout) this.jeu.getChildAt(this.tour-1); for(int i=0; i + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 44d41b7..e753ada 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -5,4 +5,6 @@ 15dp 5dp 30dp + 20dp + 15dp \ No newline at end of file