ok
This commit is contained in:
parent
8297290c31
commit
ab5eab9bb0
@ -11,6 +11,9 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.MasterMind"
|
android:theme="@style/Theme.MasterMind"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
|
<activity
|
||||||
|
android:name=".ChoixDuMotDePasse"
|
||||||
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".SettingActivity"
|
android:name=".SettingActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package com.example.mastermind.vue.mastermind.setting;
|
package com.example.mastermind;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
public class SettingActivity extends AppCompatActivity {
|
public class ChoixDuMotDePasse extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_setting);
|
setContentView(R.layout.activity_choix_du_mot_de_passe);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ public class MasterMindActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_master_mind);
|
setContentView(R.layout.activity_master_mind);
|
||||||
Intent data=this.getIntent();
|
Intent data=this.getIntent();
|
||||||
System.out.println(data.getBooleanExtra("vide", false));
|
|
||||||
System.out.println(data.getIntExtra("nbJoeur", 1));
|
System.out.println(data.getIntExtra("nbJoeur", 1));
|
||||||
|
System.out.println(data.getIntArrayExtra("code"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@ public class MenuActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_menu);
|
setContentView(R.layout.activity_menu);
|
||||||
this.findViewById(R.id.unJoeur)
|
this.findViewById(R.id.unJoueur)
|
||||||
.setOnClickListener(new ObservateurMenuDebutPartie(this, UtilTypePartie.UN_JOEUR, (CheckBox) this.findViewById(R.id.vide)));
|
.setOnClickListener(new ObservateurMenuDebutPartie(this, UtilTypePartie.UN_JOEUR, (CheckBox) this.findViewById(R.id.vide)));
|
||||||
this.findViewById(R.id.deuxJoeur)
|
this.findViewById(R.id.deuxJoueur)
|
||||||
.setOnClickListener(new ObservateurMenuDebutPartie(this, UtilTypePartie.DEUX_JOEUR, (CheckBox) this.findViewById(R.id.vide)));
|
.setOnClickListener(new ObservateurMenuDebutPartie(this, UtilTypePartie.DEUX_JOEUR, (CheckBox) this.findViewById(R.id.vide)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.example.mastermind.controller.mastermind;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.view.GestureDetector;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
public class MonGestureDetector extends GestureDetector {
|
||||||
|
|
||||||
|
public MonGestureDetector(@NonNull OnGestureListener listener, @Nullable Handler handler) {
|
||||||
|
super(listener, handler);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.example.mastermind.controller.mastermind;
|
||||||
|
|
||||||
|
import android.view.GestureDetector;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
public class MonGestureListener implements GestureDetector.OnGestureListener {
|
||||||
|
@Override
|
||||||
|
public boolean onDown(@NonNull MotionEvent motionEvent) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShowPress(@NonNull MotionEvent motionEvent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onSingleTapUp(@NonNull MotionEvent motionEvent) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onScroll(@NonNull MotionEvent motionEvent, @NonNull MotionEvent motionEvent1, float v, float v1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLongPress(@NonNull MotionEvent motionEvent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onFling(@NonNull MotionEvent motionEvent, @NonNull MotionEvent motionEvent1, float v, float v1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.example.mastermind.controller.mastermind;
|
||||||
|
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
public class ObservateurTouchListener implements View.OnTouchListener {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -6,8 +6,12 @@ import android.view.View;
|
|||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.example.mastermind.ChoixDuMotDePasse;
|
||||||
import com.example.mastermind.MasterMindActivity;
|
import com.example.mastermind.MasterMindActivity;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class ObservateurMenuDebutPartie implements View.OnClickListener {
|
public class ObservateurMenuDebutPartie implements View.OnClickListener {
|
||||||
|
|
||||||
private AppCompatActivity menu;
|
private AppCompatActivity menu;
|
||||||
@ -25,9 +29,24 @@ public class ObservateurMenuDebutPartie implements View.OnClickListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
if(typePartie == 1){
|
||||||
Intent mastermind = new Intent(menu, MasterMindActivity.class);
|
Intent mastermind = new Intent(menu, MasterMindActivity.class);
|
||||||
mastermind.putExtra("nbJoeur", typePartie);
|
mastermind.putExtra("vide", vide.isChecked());
|
||||||
mastermind.putExtra("vide", vide.isActivated());
|
|
||||||
|
Random r=new Random();
|
||||||
|
int tab[]=new int[4];
|
||||||
|
tab[0]=r.nextInt(6);
|
||||||
|
tab[1]=r.nextInt(6);
|
||||||
|
tab[2]=r.nextInt(6);
|
||||||
|
tab[3]=r.nextInt(6);
|
||||||
|
mastermind.putIntegerArrayListExtra("code", )
|
||||||
|
|
||||||
menu.startActivity(mastermind);
|
menu.startActivity(mastermind);
|
||||||
}
|
}
|
||||||
|
if(typePartie ==2){
|
||||||
|
Intent choixCode = new Intent(menu, ChoixDuMotDePasse.class);
|
||||||
|
choixCode.putExtra("vide", vide.isChecked());
|
||||||
|
menu.startActivity(choixCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
67
app/src/main/java/com/example/mastermind/util/MonPaint.java
Normal file
67
app/src/main/java/com/example/mastermind/util/MonPaint.java
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package com.example.mastermind.util;
|
||||||
|
|
||||||
|
import android.graphics.Paint;
|
||||||
|
|
||||||
|
public abstract class MonPaint {
|
||||||
|
private static Paint rouge;
|
||||||
|
private static Paint verte;
|
||||||
|
private static Paint bleue;
|
||||||
|
private static Paint jaune;
|
||||||
|
private static Paint blanche;
|
||||||
|
private static Paint noir;
|
||||||
|
|
||||||
|
private static void istanciate(){
|
||||||
|
MonPaint.rouge=new Paint();
|
||||||
|
MonPaint.rouge.setColor(0xffff0000);
|
||||||
|
|
||||||
|
MonPaint.verte=new Paint();
|
||||||
|
MonPaint.verte.setColor(0xff00ff00);
|
||||||
|
|
||||||
|
MonPaint.bleue=new Paint();
|
||||||
|
MonPaint.bleue.setColor(0xff0000ff);
|
||||||
|
|
||||||
|
MonPaint.jaune=new Paint();
|
||||||
|
MonPaint.jaune.setColor(0xffffff00);
|
||||||
|
|
||||||
|
MonPaint.blanche=new Paint();
|
||||||
|
MonPaint.blanche.setColor(0xffffffff);
|
||||||
|
|
||||||
|
MonPaint.noir=new Paint();
|
||||||
|
MonPaint.noir.setColor(0xff000000);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Paint getVerte(){
|
||||||
|
if(MonPaint.verte== null){
|
||||||
|
MonPaint.istanciate();
|
||||||
|
}
|
||||||
|
return MonPaint.verte;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Paint getJaune(){
|
||||||
|
if(MonPaint.jaune== null){
|
||||||
|
MonPaint.istanciate();
|
||||||
|
}
|
||||||
|
return MonPaint.jaune;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Paint getBleue(){
|
||||||
|
if(MonPaint.bleue== null){
|
||||||
|
MonPaint.istanciate();
|
||||||
|
}
|
||||||
|
return MonPaint.bleue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Paint getBlanche(){
|
||||||
|
if(MonPaint.blanche== null){
|
||||||
|
MonPaint.istanciate();
|
||||||
|
}
|
||||||
|
return MonPaint.blanche;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Paint getNoir(){
|
||||||
|
if(MonPaint.noir== null){
|
||||||
|
MonPaint.istanciate();
|
||||||
|
}
|
||||||
|
return MonPaint.noir;
|
||||||
|
}
|
||||||
|
}
|
25
app/src/main/java/com/example/mastermind/vue/UnePiece.java
Normal file
25
app/src/main/java/com/example/mastermind/vue/UnePiece.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package com.example.mastermind.vue;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.example.mastermind.util.MonPaint;
|
||||||
|
|
||||||
|
public class UnePiece extends View {
|
||||||
|
|
||||||
|
|
||||||
|
public UnePiece(Context context, @Nullable AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDraw(Canvas canvas) {
|
||||||
|
super.onDraw(canvas);
|
||||||
|
canvas.drawArc(0, 0, 50, 50, 0, (float) (Math.PI*2), false, MonPaint.getNoir());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -10,22 +10,21 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="1.0.1 all right reserved"
|
android:text="1.0.1 all right reserved"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="10dp"/>
|
android:textSize="15dp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/white"
|
|
||||||
android:text="MasterMind"
|
|
||||||
android:textSize="60dp"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:layout_above="@+id/unJoueur"
|
android:layout_above="@+id/unJoueur"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:gravity="center"
|
android:layout_alignParentRight="true"
|
||||||
android:editable="false"
|
android:editable="false"
|
||||||
/>
|
android:gravity="center"
|
||||||
|
android:text="MasterMind"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="60dp" />
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@ -69,9 +68,8 @@
|
|||||||
android:id="@+id/vide"
|
android:id="@+id/vide"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
/>
|
android:layout_alignParentBottom="true" />
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user