This commit is contained in:
pro.boooooo 2023-04-05 02:08:29 +02:00
parent 4083b7b357
commit 85a1e3d665
63 changed files with 3093 additions and 0 deletions

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

38
app/build.gradle Normal file
View File

@ -0,0 +1,38 @@
plugins {
id 'com.android.application'
}
android {
namespace 'com.example.jmastermind'
compileSdk 33
defaultConfig {
applicationId "com.example.jmastermind"
minSdk 19
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

21
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,26 @@
package com.example.jmastermind;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.jmastermind", appContext.getPackageName());
}
}

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.JMastermind"
tools:targetApi="31">
<activity
android:name=".Prologue"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Game.Game"
android:exported="true">
</activity>
<activity
android:name=".Game.ColorDefSelect"
android:exported="true">
</activity>
<activity
android:name=".Menu.Menu"
android:exported="true">
</activity>
</application>
</manifest>

View File

@ -0,0 +1,19 @@
package com.example.jmastermind.Deck;
import android.graphics.Color;
import java.util.List;
public interface Deck {
/**
* Recuperer la combinaison stockés dans la class
* @return La combinaison du deck
* */
public abstract List<Integer> getDeck();
/**
* Retourne la combinaison sous forme de chaine de caractere
* @return Une facon personnaliser d'afficher la combinaison (debug)
* */
public abstract String displayComb();
}

View File

@ -0,0 +1,109 @@
package com.example.jmastermind.Deck;
import android.graphics.Color;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
public class DeckCheck implements Deck {
private List<Integer> deck;
private Deck lambda;
private Deck winner;
/**
* Permet de comparer une combinaison attaquante avec une combinaison gagnante
* @param lambda La combinaison attaquante
* @param winner La combinaison gagnante
* */
public DeckCheck(Deck lambda, Deck winner) {
this.deck = new LinkedList<>();
this.lambda = lambda;
this.winner = winner;
}
/**
* Lancement de la verification
* @return Le deck comprenant les pions de verification Noir et Blanc
* */
public Deck doCheck() {
this.deck = new LinkedList<>();
List<Integer> winner = this.winner.getDeck();
List<Integer> lambda = this.lambda.getDeck();
for(int i = 0; i <= winner.size()-1; i++) {
Integer win = winner.get(i);
Integer lam = lambda.get(i);
if(Objects.equals(win, lam)) {
this.deck.add(Color.BLACK);
} else {
if(winner.contains(lam)) {
this.deck.add(Color.WHITE);
} else {
this.deck.add(Color.GRAY);
}
}
}
Deck check = new DeckLambda(
this.deck.get(0),
this.deck.get(1),
this.deck.get(2),
this.deck.get(3)
);
return check;
}
@Override
public List<Integer> getDeck() {
return this.deck;
}
@Override
public String displayComb() {
StringBuilder sb = new StringBuilder();
for(int i = 0; i <= this.deck.size()-1; i++) {
switch(this.deck.get(i)) {
case Color.BLACK: {
sb.append("Noir").append(", ");
break;
}
case Color.WHITE: {
sb.append("Blanc").append(", ");
break;
}
case Color.GRAY: {
sb.append("Gris").append(", ");
break;
}
case Color.GREEN: {
sb.append("Vert").append(", ");
break;
}
case Color.RED: {
sb.append("Rouge").append(", ");
break;
}
case Color.YELLOW: {
sb.append("Jaune").append(", ");
break;
}
case Color.BLUE: {
sb.append("Bleu").append(", ");
break;
}
}
}
return sb.toString();
}
}

View File

@ -0,0 +1,75 @@
package com.example.jmastermind.Deck;
import android.graphics.Color;
import java.util.LinkedList;
import java.util.List;
public class DeckLambda implements Deck{
List<Integer> deck;
/**
* Composition de la combinaison attaquante
* @param c1 Couleur en int du Pion n1
* @param c2 Couleur en int du Pion n2
* @param c3 Couleur en int du Pion n3
* @param c4 Couleur en int du Pion n4
* */
public DeckLambda(Integer c1, Integer c2, Integer c3, Integer c4) {
this.deck = new LinkedList<>();
this.deck.add(c1);
this.deck.add(c2);
this.deck.add(c3);
this.deck.add(c4);
}
@Override
public List<Integer> getDeck() {
return this.deck;
}
@Override
public String displayComb() {
StringBuilder sb = new StringBuilder();
for(int i = 0; i <= this.deck.size()-1; i++) {
switch(this.deck.get(i)) {
case Color.BLACK: {
sb.append("Noir").append(", ");
break;
}
case Color.WHITE: {
sb.append("Blanc").append(", ");
break;
}
case Color.GREEN: {
sb.append("Vert").append(", ");
break;
}
case Color.RED: {
sb.append("Rouge").append(", ");
break;
}
case Color.YELLOW: {
sb.append("Jaune").append(", ");
break;
}
case Color.BLUE: {
sb.append("Bleu").append(", ");
break;
}
case Color.GRAY: {
sb.append("Gris").append(", ");
break;
}
}
}
return sb.toString();
}
}

View File

@ -0,0 +1,103 @@
package com.example.jmastermind.Deck;
import android.graphics.Color;
import java.util.LinkedList;
import java.util.List;
public class DeckWinner implements Deck{
List<Integer> deck;
Boolean isMulti;
/**
* Composition de la combinaison gagante
* @param c1 Couleur en int du Pion n1
* @param c2 Couleur en int du Pion n2
* @param c3 Couleur en int du Pion n3
* @param c4 Couleur en int du Pion n4
* */
public DeckWinner(Integer c1, Integer c2, Integer c3, Integer c4) {
this.deck = new LinkedList<>();
this.deck.add(c1);
this.deck.add(c2);
this.deck.add(c3);
this.deck.add(c4);
isMulti = false;
}
/**
* (Je suis conscient que ce n'est pos opti mais il sert a savoir si le jeux doit relancer la partie sur le mode multi ou solo)
* Composition de la combinaison gagante
* @param c1 Couleur en int du Pion n1
* @param c2 Couleur en int du Pion n2
* @param c3 Couleur en int du Pion n3
* @param c4 Couleur en int du Pion n4
* @param isMulti Toujours = a true
* */
public DeckWinner(Integer c1, Integer c2, Integer c3, Integer c4, Boolean isMulti) {
this.deck = new LinkedList<>();
this.deck.add(c1);
this.deck.add(c2);
this.deck.add(c3);
this.deck.add(c4);
this.isMulti = isMulti;
}
/**
* Renvoie vrai ou faux celon le boolean de isMulti
* */
public Boolean getIsMulti() {
return this.isMulti;
}
@Override
public List<Integer> getDeck() {
return this.deck;
}
@Override
public String displayComb() {
StringBuilder sb = new StringBuilder();
for(int i = 0; i <= this.deck.size()-1; i++) {
switch(this.deck.get(i)) {
case Color.BLACK: {
sb.append("Noir").append(", ");
break;
}
case Color.WHITE: {
sb.append("Blanc").append(", ");
break;
}
case Color.GREEN: {
sb.append("Vert").append(", ");
break;
}
case Color.RED: {
sb.append("Rouge").append(", ");
break;
}
case Color.YELLOW: {
sb.append("Jaune").append(", ");
break;
}
case Color.BLUE: {
sb.append("Bleu").append(", ");
break;
}
case Color.GRAY: {
sb.append("Gris").append(", ");
break;
}
}
}
return sb.toString();
}
}

View File

@ -0,0 +1,174 @@
package com.example.jmastermind.Events;
import android.graphics.Color;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Deck.Deck;
import com.example.jmastermind.Deck.DeckCheck;
import com.example.jmastermind.Deck.DeckLambda;
import com.example.jmastermind.Deck.DeckWinner;
import com.example.jmastermind.Game.Popup;
import com.example.jmastermind.Geometrics.Circle;
import com.example.jmastermind.R;
import java.util.LinkedList;
import java.util.List;
public class ColorSelectorEvent extends View implements View.OnClickListener {
private AppCompatActivity context;
/**
* [0] = x
* [1] = y
* */
private int[] coords;
private DeckWinner winner;
private int tentative;
/**
* Evenement declanché lorsque le joueur selectionne une couleur
* @param context Le contexte de l'app
* @param winner La combinaison gagnante
* */
public ColorSelectorEvent(AppCompatActivity context, DeckWinner winner) {
super(context);
this.context = context;
this.winner = winner;
this.coords = new int[]{1, 1};
this.tentative = 10;
}
/**
* Relier indirectement au bouton "Valider"
* Changer de ligne et lancer la verification des combinaisons
* */
public void goNext() {
List<Integer> listOfColors = new LinkedList<>();
for(int i = 1; i <= 4; i++) {
int id = this.context.getResources()
.getIdentifier("normalCircle" + this.coords[0] + i, "id", this.context.getPackageName());
Circle c = this.context.findViewById(id);
listOfColors.add(c.getColor());
}
Deck lambda = new DeckLambda(
listOfColors.get(0),
listOfColors.get(1),
listOfColors.get(2),
listOfColors.get(3)
);
DeckCheck checker = new DeckCheck(lambda, this.winner);
Deck checkerPions = checker.doCheck();
List<Integer> checkColors = checkerPions.getDeck();
int countOfBlack = 0;
for(int i = 1; i <= 4; i++) {
int id = this.context.getResources()
.getIdentifier("checkCircle" + this.coords[0] + i, "id", this.context.getPackageName());
Circle c = this.context.findViewById(id);
c.setColor(checkColors.get(i-1));
if(checkColors.get(i-1) == Color.BLACK) {
countOfBlack++;
}
}
String[] opts = new String[] {
"Rejouer",
"Voir votre jeu",
"Retourner au menu"
};
this.tentative--;
if(countOfBlack == 4) {
Popup popup = new Popup(this.context, opts, this.winner.getIsMulti(), (10 - this.tentative));
popup.show();
} else if(this.tentative == 0) {
Popup popup = new Popup(this.context, opts, this.winner.getIsMulti(), -1);
popup.show();
}
TextView tx = (TextView) this.context.findViewById(R.id.counter);
tx.setText("Tentative rest. \n" + this.tentative);
tx.invalidate();
this.coords[1] = 1;
this.coords[0]++;
}
/**
* Relier indirectement au bouton "Effacer"
* Permet d'effacer la combinaison non validé par le joueur
* */
public void resetCombi() {
for(int i = 1; i <= this.coords[1]; i++) {
int id = this.context.getResources()
.getIdentifier("normalCircle" + this.coords[0] + i, "id", this.context.getPackageName());
Circle c = this.context.findViewById(id);
c.setColor(Color.GRAY);
}
this.coords[1] = 1;
}
@Override
public void onClick(View view) {
int idOfClickedColor = view.getId();
Circle circleClicked = (Circle) this.context.findViewById(idOfClickedColor);
int colorChoosed = circleClicked.getColor();
int id = this.context.getResources()
.getIdentifier("normalCircle" + this.coords[0] + this.coords[1], "id", this.context.getPackageName());
Circle c = this.context.findViewById(id);
switch(colorChoosed) {
case Color.RED: {
c.setColor(Color.RED);
break;
}
case Color.GREEN: {
c.setColor(Color.GREEN);
break;
}
case Color.BLUE: {
c.setColor(Color.BLUE);
break;
}
case Color.YELLOW: {
c.setColor(Color.YELLOW);
break;
}
case Color.BLACK: {
c.setColor(Color.BLACK);
break;
}
case Color.WHITE: {
c.setColor(Color.WHITE);
break;
}
case Color.GRAY: {
c.setColor(Color.GRAY);
break;
}
default: {
break;
}
}
if(this.coords[1] < 4) {
this.coords[1]++;
}
}
}

View File

@ -0,0 +1,40 @@
package com.example.jmastermind.Events;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Game.Controller;
import com.example.jmastermind.Menu.Menu;
public class ControlEvent extends View implements View.OnClickListener {
private final AppCompatActivity context;
private Controller controller;
/**
* Event relier aux boutons "Valider" et "Effacer"
* @param context Le context
* @param controller Le controller du jeu
* */
public ControlEvent(AppCompatActivity context, Controller controller) {
super(context);
this.context = context;
this.controller = controller;
}
@Override
public void onClick(View view) {
int idOfButton = view.getId();
Button btnClicked = (Button) this.context.findViewById(idOfButton);
CharSequence text = btnClicked.getText();
if ("Valider".equals(text)) {
this.controller.viewValidate();
} else if ("Effacer".equals(text)) {
this.controller.viewReset();
} else if("Quitter".equals(text)) {
Intent i = new Intent(this.context, Menu.class);
this.context.startActivity(i);
}
}
}

View File

@ -0,0 +1,100 @@
package com.example.jmastermind.Events;
import android.graphics.Color;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Geometrics.Circle;
import com.example.jmastermind.R;
import java.util.LinkedList;
import java.util.List;
public class DefendCombiSelectorEvent implements View.OnClickListener{
private AppCompatActivity context;
private int pos;
private List<Integer> refs;
public DefendCombiSelectorEvent(AppCompatActivity context) {
this.context = context;
this.refs = new LinkedList<>();
this.pos = 0;
this.refs.add(R.id.receiveOne);
this.refs.add(R.id.receiveTwo);
this.refs.add(R.id.receiveThree);
this.refs.add(R.id.receiveFour);
}
/**
* Remettre le compteur a zero si le joueur reset sa combinaison.
* */
public void reset() {
this.pos = 0;
}
/**
* Recuperer la combinaison
* @return La liste des couleurs choisit par le defenseur
* */
public List<Integer> getCombinaison() {
if(this.pos == 4) {
List<Integer> tmp = new LinkedList<>();
for(int i = 0; i <= this.pos-1; i++) {
Circle c = this.context.findViewById(this.refs.get(i));
tmp.add(c.getColor());
}
return tmp;
} else {
return null;
}
}
@Override
public void onClick(View view) {
if(this.pos <= 3) {
int id = view.getId();
Circle c = this.context.findViewById(id);
Integer chose = c.getColor();
Circle toModify = (Circle) this.context.findViewById(this.refs.get(this.pos));
switch(chose) {
case Color.BLACK: {
toModify.setColor(Color.BLACK);
break;
}
case Color.WHITE: {
toModify.setColor(Color.WHITE);
break;
}
case Color.GREEN: {
toModify.setColor(Color.GREEN);
break;
}
case Color.BLUE: {
toModify.setColor(Color.BLUE);
break;
}
case Color.RED: {
toModify.setColor(Color.RED);
break;
}
case Color.YELLOW: {
toModify.setColor(Color.YELLOW);
break;
}
default: {
break;
}
}
this.pos++;
}
}
}

View File

@ -0,0 +1,64 @@
package com.example.jmastermind.Events;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Game.Game;
import com.example.jmastermind.Geometrics.Circle;
import com.example.jmastermind.Menu.Menu;
import com.example.jmastermind.R;
import java.util.ArrayList;
import java.util.List;
public class DefendValidateEvent implements View.OnClickListener {
private DefendCombiSelectorEvent dce;
private AppCompatActivity context;
public DefendValidateEvent(AppCompatActivity context, DefendCombiSelectorEvent dce) {
this.context = context;
this.dce = dce;
}
@Override
public void onClick(View view) {
int idOfButton = view.getId();
Button btnClicked = (Button) this.context.findViewById(idOfButton);
CharSequence text = btnClicked.getText();
if ("Valider".equals(text)) {
if(this.dce.getCombinaison() != null) {
List<Integer> defendColor = this.dce.getCombinaison();
// Merci StackOverflow: https://stackoverflow.com/questions/2091465/how-do-i-pass-data-between-activities-in-android-application
Bundle bundle = new Bundle();
ArrayList<Integer> arr = new ArrayList<>(defendColor);
bundle.putIntegerArrayList("DefendCombi", arr);
Intent i = new Intent(this.context, Game.class);
i.putExtras(bundle);
this.context.startActivity(i);
}
} else if ("Effacer".equals(text)) {
Circle one = this.context.findViewById(R.id.receiveOne);
one.setColor(Color.GRAY);
Circle two = this.context.findViewById(R.id.receiveTwo);
two.setColor(Color.GRAY);
Circle three = this.context.findViewById(R.id.receiveThree);
three.setColor(Color.GRAY);
Circle four = this.context.findViewById(R.id.receiveFour);
four.setColor(Color.GRAY);
this.dce.reset();
} else if("Retour".equals(text)) {
Intent i = new Intent(this.context, Menu.class);
this.context.startActivity(i);
}
}
}

View File

@ -0,0 +1,32 @@
package com.example.jmastermind.Events;
import android.content.Intent;
import android.media.MediaPlayer;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
public class MenuEvent implements View.OnClickListener {
private Class option;
private AppCompatActivity context;
private MediaPlayer mp;
/**
* Event lié au menu de depart
* @param context Le contexte
* @param option La class de l'activité a demarrer
* @param mp Couper le son d'une activite
* */
public MenuEvent(AppCompatActivity context, Class option, MediaPlayer mp) {
this.context = context;
this.option = option;
this.mp = mp;
}
@Override
public void onClick(View view) {
this.mp.stop();
Intent i = new Intent(this.context, this.option);
this.context.startActivity(i);
}
}

View File

@ -0,0 +1,83 @@
package com.example.jmastermind.Events;
import android.content.DialogInterface;
import android.content.Intent;
import android.media.MediaPlayer;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Game.ColorDefSelect;
import com.example.jmastermind.Game.Popup;
import com.example.jmastermind.Game.Game;
import com.example.jmastermind.Menu.Menu;
import com.example.jmastermind.R;
public class PopupEvent implements DialogInterface.OnClickListener, View.OnClickListener {
private MediaPlayer mp;
private int tentative;
private AppCompatActivity context;
private Boolean isMulti;
/**
* Event lié au popup de fin de partie
* @param context Le context
* @param tentative Le nombre de tentative
* @param isMulti Le mode de jeu
* */
public PopupEvent(AppCompatActivity context, int tentative, MediaPlayer mp, Boolean isMulti) {
this.context = context;
this.tentative = tentative;
this.mp = mp;
this.isMulti = isMulti;
}
@Override
public void onClick(DialogInterface dialogInterface, int i) {
switch(i) {
case 0: {
this.mp.stop();
Intent a;
if(!this.isMulti) {
a = new Intent(this.context, Game.class);
} else {
a = new Intent(this.context, ColorDefSelect.class);
}
this.context.startActivity(a);
break;
}
case 1: {
this.mp.stop();
Button btn = (Button) this.context.findViewById(R.id.validate);
btn.setText("Finish HIM");
btn.setOnClickListener(this);
dialogInterface.cancel();
break;
}
case 2: {
this.mp.stop();
Intent c = new Intent(this.context, Menu.class);
this.context.startActivity(c);
break;
}
}
}
@Override
public void onClick(View view) {
String[] opts = new String[] {
"Rejouer",
"Voir votre jeu",
"Retourner au menu"
};
Popup pop = new Popup(this.context, opts, this.isMulti, this.tentative);
pop.show();
}
}

View File

@ -0,0 +1,33 @@
package com.example.jmastermind.Events;
import android.content.Intent;
import android.media.MediaPlayer;
import android.view.animation.Animation;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Menu.Menu;
public class PrologueAnimation implements Animation.AnimationListener {
private AppCompatActivity context;
private MediaPlayer mp;
public PrologueAnimation(AppCompatActivity context, MediaPlayer mp) {
this.context = context;
this.mp = mp;
}
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
this.mp.stop();
Intent i = new Intent(this.context, Menu.class);
this.context.startActivity(i);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
}

View File

@ -0,0 +1,59 @@
package com.example.jmastermind.Game;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.Button;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Events.DefendCombiSelectorEvent;
import com.example.jmastermind.Events.DefendValidateEvent;
import com.example.jmastermind.Geometrics.Circle;
import com.example.jmastermind.R;
public class ColorDefSelect extends AppCompatActivity {
/**
* Le jeu mode Multi
* */
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.defend);
DefendCombiSelectorEvent dce = new DefendCombiSelectorEvent(this);
DefendValidateEvent dve = new DefendValidateEvent(this, dce);
Circle red = (Circle) findViewById(R.id.selectRed);
red.setColor(Color.RED);
red.setOnClickListener(dce);
Circle blue = (Circle) findViewById(R.id.selectBlue);
blue.setColor(Color.BLUE);
blue.setOnClickListener(dce);
Circle yellow = (Circle) findViewById(R.id.selectYellow);
yellow.setColor(Color.YELLOW);
yellow.setOnClickListener(dce);
Circle green = (Circle) findViewById(R.id.selectGreen);
green.setColor(Color.GREEN);
green.setOnClickListener(dce);
Circle black = (Circle) findViewById(R.id.selectBlack);
black.setColor(Color.BLACK);
black.setOnClickListener(dce);
Circle white = (Circle) findViewById(R.id.selectWhite);
white.setColor(Color.WHITE);
white.setOnClickListener(dce);
Button validate = (Button) findViewById(R.id.selectValidate);
validate.setOnClickListener(dve);
Button reset = (Button) findViewById(R.id.selectReset);
reset.setOnClickListener(dve);
Button back = (Button) findViewById(R.id.selectBack);
back.setOnClickListener(dve);
}
}

View File

@ -0,0 +1,64 @@
package com.example.jmastermind.Game;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Deck.DeckWinner;
import com.example.jmastermind.Events.ColorSelectorEvent;
import com.example.jmastermind.Events.ControlEvent;
import java.util.Random;
public class Controller {
private Vuew vuew;
private Model model;
private AppCompatActivity context;
private ColorSelectorEvent event;
private ControlEvent controlEvent;
/**
* Controlleur du jeu
* @param context Le contexte
* @param mode 0 Solo ou 1 multi
* */
public Controller(AppCompatActivity context, int mode, DeckWinner... win) {
this.context = context;
this.controlEvent = new ControlEvent(this.context, this);
this.model = new Model(this.context);
this.model.init();
if(mode == 0) {
this.model.genWinner();
DeckWinner winner = this.model.getWinner();
Log.d("COMBINAISON GAGNANTE", winner.displayComb());
this.event = new ColorSelectorEvent(this.context, winner);
} else {
Log.d("COMBINAISON GAGNANTE", win[0].displayComb());
this.event = new ColorSelectorEvent(this.context, win[0]);
}
this.vuew = new Vuew(
this.context,
this.model.getListOfNormalCircle(),
this.model.getListOfCheckCircle(),
this.event,
this.controlEvent
);
this.vuew.init();
}
/**
* Quand le joueur appuie sur "valider"
* */
public void viewValidate() {
this.event.goNext();
}
/**
* Quand le joueur appuie sur "effacer"
* */
public void viewReset() {
this.event.resetCombi();
}
}

View File

@ -0,0 +1,39 @@
package com.example.jmastermind.Game;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Deck.DeckWinner;
import com.example.jmastermind.Menu.Menu;
import com.example.jmastermind.R;
import java.util.ArrayList;
public class Game extends AppCompatActivity {
public Game(){}
/**
* Le jeu mode SOLO
* */
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.game);
Intent i = this.getIntent();
ArrayList<Integer> combi = i.getIntegerArrayListExtra("DefendCombi");
if(combi != null) {
DeckWinner dw = new DeckWinner(combi.get(0), combi.get(1), combi.get(2), combi.get(3), true);
Controller controller = new Controller(this, 1, dw);
} else {
Controller controller = new Controller(this, 0);
}
}
@Override
public void onBackPressed() {
Intent i = new Intent(this, Menu.class);
this.startActivity(i);
}
}

View File

@ -0,0 +1,139 @@
package com.example.jmastermind.Game;
import android.graphics.Color;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Deck.DeckWinner;
import com.example.jmastermind.Geometrics.Circle;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
public class Model extends View {
private List<Circle> listOfNormalCircle;
private List<Circle> listOfCheckCircle;
private DeckWinner winner;
private AppCompatActivity context;
/**
* Le model du jeu
* @param context Le contexte
* */
public Model(AppCompatActivity context) {
super(context);
this.context = context;
this.listOfNormalCircle = new LinkedList<>();
this.listOfCheckCircle = new LinkedList<>();
this.winner = null;
}
/**
* Genere une combinaison aleatoire
* */
public void genWinner() {
Integer[] color = new Integer[]{0, 0, 0, 0};
for(int i = 0; i <= 3; i++) {
Random rand = new Random();
int ran = rand.nextInt(6) + 1;
switch(ran) {
case 1: {
color[i] = Color.RED;
break;
}
case 2: {
color[i] = Color.YELLOW;
break;
}
case 3: {
color[i] = Color.BLUE;
break;
}
case 4: {
color[i] = Color.GREEN;
break;
}
case 5: {
color[i] = Color.WHITE;
break;
}
case 6: {
color[i] = Color.BLACK;
break;
}
case 7: {
color[i] = Color.GRAY;
break;
}
default: {
break;
}
}
}
this.winner = new DeckWinner(color[1], color[0], color[2], color[3]);
}
/**
* Recupere le deck gagant du jeu
* @return DeckWinner Le deck gagant du jeu
* */
public DeckWinner getWinner() {
return this.winner;
}
/**
* Demarrage du Model
* @return Si oui ou non ca a fonctionné
* */
public Boolean init() {
try {
for(int i = 1; i <= 10; i++) {
for(int j = 1; j <= 4; j++) {
int normalId = this.context.getResources().
getIdentifier("normalCircle" + i + j, "id", this.context.getPackageName());
Circle normal = this.context.findViewById(normalId);
int checkId = this.context.getResources()
.getIdentifier("checkCircle" + i + j, "id", this.context.getPackageName());
Circle check = this.context.findViewById(checkId);
this.listOfNormalCircle.add(normal);
this.listOfCheckCircle.add(check);
}
}
return true;
} catch(ArrayIndexOutOfBoundsException e) {
System.out.println("[!] Probleme lors de l'initiliation du model (ArrayIndexOutOfBoundsException).");
return false;
} catch(NullPointerException e) {
System.out.println("[!] Probleme lors de l'initiliation du model (NullPointerException).");
return false;
}
}
/**
* Recuperation des cercles normaux du jeu (id="normalCircleXY" du xml)
* @return La liste des references vers les cercles normaux
* */
public List<Circle> getListOfNormalCircle() {
return this.listOfNormalCircle;
}
/**
* Recuperation des clercles de verification du jeu (noir et blanc) (id="checkCircleXY" du xml)
* @return La liste des references vers les cercles de verification
* */
public List<Circle> getListOfCheckCircle() {
return this.listOfCheckCircle;
}
}

View File

@ -0,0 +1,42 @@
package com.example.jmastermind.Game;
import android.media.MediaPlayer;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Events.PopupEvent;
import com.example.jmastermind.R;
public class Popup extends AlertDialog.Builder {
private MediaPlayer mp;
private AppCompatActivity context;
private PopupEvent event;
/**
* Affiche la popup de fin de jeu
* @param context Le context
* @param options La liste des options (rejouer, ...)
* @param tentative Le nombre de tentatives
* */
public Popup(AppCompatActivity context, String[] options, Boolean isMulti, int... tentative) {
super(context);
this.context = context;
this.setCancelable(false);
if(tentative[0] > 0) {
this.mp = MediaPlayer.create(this.context, R.raw.winningsong);
this.mp.setLooping(true);
this.mp.start();
this.setTitle("Félicitation ! Vous avez gagner en : " + tentative[0] + " coup(s).");
} else {
this.mp = MediaPlayer.create(this.context, R.raw.loosegamesong);
this.mp.setLooping(true);
this.mp.start();
this.setTitle("Perdu !");
}
this.event = new PopupEvent(this.context, tentative[0], this.mp, isMulti);
this.setItems(options, this.event);
}
}

View File

@ -0,0 +1,27 @@
package com.example.jmastermind.Game;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Deck.DeckWinner;
import com.example.jmastermind.Menu.Menu;
import com.example.jmastermind.R;
import java.util.ArrayList;
public class Rules extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.rules);
}
@Override
public void onBackPressed() {
Intent i = new Intent(this, Menu.class);
this.startActivity(i);
}
}

View File

@ -0,0 +1,86 @@
package com.example.jmastermind.Game;
import android.graphics.Color;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Events.ColorSelectorEvent;
import com.example.jmastermind.Events.ControlEvent;
import com.example.jmastermind.Geometrics.Circle;
import com.example.jmastermind.R;
import java.util.List;
public class Vuew {
private ColorSelectorEvent event;
private List<Circle> normalCircle;
private List<Circle> checkedCircle;
private AppCompatActivity context;
private ControlEvent controlEvent;
/**
* La vue du jeu
* @param context Le context
* @param normalCircle Les references vers les cercles normaux
* @param checkCircle Les references vers les cercles de verification
* @param event L'event de la selection de couleur
* @param controlEvent L'event vers les deux boutons Valider et Effacer
* */
public Vuew(AppCompatActivity context, List<Circle> normalCircle, List<Circle> checkCircle, ColorSelectorEvent event, ControlEvent controlEvent) {
this.context = context;
this.normalCircle = normalCircle;
this.checkedCircle = checkCircle;
this.event = event;
this.controlEvent = controlEvent;
}
/**
* Parametrage du plateau de jeu
* */
public Boolean init() {
try {
Circle yellow = (Circle) this.context.findViewById(R.id.yellow);
yellow.setColor(Color.YELLOW);
yellow.setOnClickListener(this.event);
Circle red = (Circle) this.context.findViewById(R.id.red);
red.setColor(Color.RED);
red.setOnClickListener(this.event);
Circle green = (Circle) this.context.findViewById(R.id.green);
green.setColor(Color.GREEN);
green.setOnClickListener(this.event);
Circle blue = (Circle) this.context.findViewById(R.id.blue);
blue.setColor(Color.BLUE);
blue.setOnClickListener(this.event);
Circle gray = (Circle) this.context.findViewById(R.id.gray);
gray.setColor(Color.GRAY);
gray.setOnClickListener(this.event);
Circle white = (Circle) this.context.findViewById(R.id.white);
white.setColor(Color.WHITE);
white.setOnClickListener(this.event);
Circle black = (Circle) this.context.findViewById(R.id.black);
black.setColor(Color.BLACK);
black.setOnClickListener(this.event);
Button validate = (Button) this.context.findViewById(R.id.validate);
validate.setOnClickListener(this.controlEvent);
Button reset = (Button) this.context.findViewById(R.id.reset);
reset.setOnClickListener(this.controlEvent);
Button leave = (Button) this.context.findViewById(R.id.leave);
leave.setOnClickListener(this.controlEvent);
return true;
} catch(NullPointerException e) {
System.out.println("[!] Probleme lors de l'initiliation de la vue (NullPointerException).");
return false;
} catch(ArrayIndexOutOfBoundsException e) {
System.out.println("[!] Probleme lors de l'initiliation de la vue (ArrayIndexOutOfBoundsException).");
return false;
}
}
}

View File

@ -0,0 +1,57 @@
package com.example.jmastermind.Geometrics;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
public class Circle extends View {
private Paint picasso;
private int color;
/**
* Les cercles du jeu "programmiser" en Java
* @param context Le context
* @param attrs Les attributs (notamment id)
* */
public Circle(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
this.color = Color.GRAY;
this.picasso = new Paint();
}
/**
* Recuperer la couleur du cercle
* @return La couleur du cercle en int
* */
public int getColor() {
return this.color;
}
/**
* Changer la couleur d'un cercle
* @param c La nouvelle couleur
* */
public void setColor(int c) {
this.color = c;
this.invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int centerX = getWidth() / 2;
int centerY = getHeight() / 2;
int radius = Math.min(centerX, centerY);
this.picasso.setColor(this.color);
this.picasso.setStyle(Paint.Style.FILL);
canvas.drawCircle(centerX, centerY, radius-2, this.picasso);
int corail = Color.rgb(255, 127, 80);
this.picasso.setColor(corail);
this.picasso.setStyle(Paint.Style.STROKE);
this.picasso.setStrokeWidth(4f);
canvas.drawCircle(centerX, centerY, radius-3, this.picasso);
}
}

View File

@ -0,0 +1,51 @@
package com.example.jmastermind.Menu;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.widget.Button;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.example.jmastermind.Events.MenuEvent;
import com.example.jmastermind.Game.ColorDefSelect;
import com.example.jmastermind.Game.Game;
import com.example.jmastermind.Game.Rules;
import com.example.jmastermind.R;
public class Menu extends AppCompatActivity {
private MediaPlayer mp;
/**
* Le jeu mode SOLO
* */
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
this.mp = MediaPlayer.create(this, R.raw.menusong);
this.mp.setLooping(true);
this.mp.start();
Button btnSoloGame = (Button) findViewById(R.id.robotselect);
btnSoloGame.setOnClickListener(new MenuEvent(this, Game.class, this.mp));
Button btnMultiGame = (Button) findViewById(R.id.jcjselect);
btnMultiGame.setOnClickListener(new MenuEvent(this, ColorDefSelect.class, this.mp));
Button btnRules = (Button) findViewById(R.id.rules);
btnRules.setOnClickListener(new MenuEvent(this, Rules.class, this.mp));
/**
* Ethan tu bosses a partir d'ici en "immitant" ce que
* j'ai fais en haut (en castant findViewById() en (Switch).
* + oublies pas de creer une classe special event qui change le parametre depuis le Model puis envoyer
* au controlleur
* */
}
@Override
public void onBackPressed() {
this.mp.stop();
this.finishAffinity();
}
}

View File

@ -0,0 +1,69 @@
package com.example.jmastermind;
import androidx.appcompat.app.AppCompatActivity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.LinearInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.jmastermind.Events.MenuEvent;
import com.example.jmastermind.Events.PrologueAnimation;
import com.example.jmastermind.Menu.Menu;
public class Prologue extends AppCompatActivity {
private MediaPlayer mp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.prologue);
this.mp = MediaPlayer.create(this, R.raw.prologuesong);
this.mp.setLooping(false);
this.mp.start();
LinearLayout prologue = (LinearLayout) findViewById(R.id.prologue);
prologue.setOnClickListener(new MenuEvent(this, Menu.class, this.mp));
TextView tx = (TextView) findViewById(R.id.prologuetext);
AnimationSet animationSet = new AnimationSet(true);
animationSet.setInterpolator(new LinearInterpolator());
TranslateAnimation animationUp = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, -1f
);
animationUp.setDuration(30000);
animationUp.setFillAfter(true);
animationSet.addAnimation(animationUp);
TranslateAnimation animationDown = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 1f,
Animation.RELATIVE_TO_SELF, 0f
);
animationDown.setDuration(30000);
animationDown.setFillAfter(true);
animationSet.addAnimation(animationDown);
PrologueAnimation pa = new PrologueAnimation(this, mp);
animationSet.setAnimationListener(pa);
tx.startAnimation(animationSet);
}
@Override
public void onBackPressed() {
this.mp.stop();
this.finishAffinity();
}
}

View File

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:gravity="center"
android:background="@drawable/space"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/white"
android:background="@color/black"
android:layout_marginBottom="35dp"
android:textSize="30sp"
android:text="Defenseur, choisis ta combinaison secrete !"
/>
<LinearLayout
android:layout_width="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:layout_marginBottom="50dp"
android:layout_height="wrap_content">
<com.example.jmastermind.Geometrics.Circle
android:id="@+id/receiveOne"
android:layout_width="70dp"
android:layout_height="70dp"
/>
<com.example.jmastermind.Geometrics.Circle
android:id="@+id/receiveTwo"
android:layout_width="70dp"
android:layout_height="70dp"
/>
<com.example.jmastermind.Geometrics.Circle
android:id="@+id/receiveThree"
android:layout_width="70dp"
android:layout_height="70dp"
/>
<com.example.jmastermind.Geometrics.Circle
android:id="@+id/receiveFour"
android:layout_width="70dp"
android:layout_height="70dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:gravity="center"
android:layout_height="wrap_content">
<com.example.jmastermind.Geometrics.Circle
android:id="@+id/selectRed"
android:layout_width="70dp"
android:layout_height="70dp"
/>
<com.example.jmastermind.Geometrics.Circle
android:id="@+id/selectBlue"
android:layout_width="70dp"
android:layout_height="70dp"
/>
<com.example.jmastermind.Geometrics.Circle
android:id="@+id/selectGreen"
android:layout_width="70dp"
android:layout_height="70dp"
/>
<com.example.jmastermind.Geometrics.Circle
android:id="@+id/selectYellow"
android:layout_width="70dp"
android:layout_height="70dp"
/>
<com.example.jmastermind.Geometrics.Circle
android:id="@+id/selectWhite"
android:layout_width="70dp"
android:layout_height="70dp"
/>
<com.example.jmastermind.Geometrics.Circle
android:id="@+id/selectBlack"
android:layout_width="70dp"
android:layout_height="70dp"
/>
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<Button
android:id="@+id/selectValidate"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:backgroundTint="@color/white"
android:text="Valider"/>
<Button
android:id="@+id/selectReset"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:backgroundTint="@color/white"
android:text="Effacer"/>
<Button
android:id="@+id/selectBack"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:backgroundTint="@color/white"
android:text="Retour"/>
</LinearLayout>
</LinearLayout>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
tools:context=".Prologue"
android:screenOrientation="portrait"
android:background="@drawable/space"
android:gravity="center"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="40dp"
android:textColor="@color/white"
android:gravity="center"
android:text="JMastermind" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
>
<Button
android:id="@+id/robotselect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@color/white"
android:textColor="@color/black"
android:text="Joueur vs Robot"
/>
<Button
android:id="@+id/jcjselect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@color/white"
android:textColor="@color/black"
android:text="Joueur contre Joueur" />
<Button
android:id="@+id/rules"
android:layout_width="wrap_content"
android:backgroundTint="@color/white"
android:textColor="@color/black"
android:layout_height="wrap_content"
android:text="Regles du jeu" />
</LinearLayout>
</LinearLayout>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/space"
android:gravity="center"
android:orientation="vertical"
>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/black"
android:textColor="@color/white"
android:textSize="40sp"
android:text="Mode Solo"/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/black"
android:textColor="@color/white"
android:textSize="20sp"
android:text="1. Selectionner le mode Joueur VS Robot"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/black"
android:src="@drawable/rulesone"
/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/black"
android:textColor="@color/white"
android:textSize="40sp"
android:text="Mode Multi"/>
</LinearLayout>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Some files were not shown because too many files have changed in this diff Show More