From 2ec61de83d915f2ce5975d1fe88adcedb38d2592 Mon Sep 17 00:00:00 2001 From: martins Date: Fri, 7 Apr 2023 16:08:31 +0200 Subject: [PATCH] ajout des tours --- .../mastermind/MasterMindActivity.java | 95 +++++++++++++++++-- .../mastermind/MonNextTurnTouch.java | 22 +++++ .../menu/ObservateurMenuDebutPartie.java | 12 ++- .../com/example/mastermind/util/MonPaint.java | 3 - .../vue/mastermind/PieceCorrection.java | 2 +- .../mastermind/vue/mastermind/UnePiece.java | 4 +- .../main/res/layout/activity_master_mind.xml | 20 +++- app/src/main/res/values/dimens.xml | 4 +- 8 files changed, 140 insertions(+), 22 deletions(-) create mode 100644 app/src/main/java/com/example/mastermind/controller/mastermind/MonNextTurnTouch.java diff --git a/app/src/main/java/com/example/mastermind/MasterMindActivity.java b/app/src/main/java/com/example/mastermind/MasterMindActivity.java index 8e3d591..491773e 100644 --- a/app/src/main/java/com/example/mastermind/MasterMindActivity.java +++ b/app/src/main/java/com/example/mastermind/MasterMindActivity.java @@ -8,25 +8,39 @@ import android.widget.LinearLayout; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; +import com.example.mastermind.controller.mastermind.MonNextTurnTouch; import com.example.mastermind.controller.mastermind.MonOnTouchListener; import com.example.mastermind.vue.mastermind.UnePiece; public class MasterMindActivity extends AppCompatActivity { private int[] code; + + private int tour; + + private LinearLayout jeu; + + private LinearLayout correction; + + private boolean vide; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_master_mind); Intent data=this.getIntent(); this.code=data.getIntArrayExtra("code"); - LinearLayout l=this.findViewById(R.id.jeu); + this.vide=data.getBooleanExtra("vide", false); + this.jeu=this.findViewById(R.id.jeu); + this.correction=this.findViewById(R.id.correction); + this.tour=0; + this.findViewById(R.id.tour).setOnTouchListener(new MonNextTurnTouch(this)); - for(int i=0; i0){ + 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 + +