From c059255e540ace2f9f48394068a8cb2c7fbdce51 Mon Sep 17 00:00:00 2001 From: monint Date: Wed, 11 May 2022 20:31:30 +0200 Subject: [PATCH] ajout --- .vscode/configurationCache.log | 1 + .vscode/dryrun.log | 17 ++ .vscode/settings.json | 3 + .vscode/targets.log | 410 +++++++++++++++++++++++++++++++++ Makefile | 2 +- observateurButtonEtText.java | 32 ++- paintMenuJeu.java | 61 +++-- plateau.java | 90 +++++--- sauvegarde.data | Bin 39650 -> 18570 bytes 9 files changed, 545 insertions(+), 71 deletions(-) create mode 100644 .vscode/configurationCache.log create mode 100644 .vscode/dryrun.log create mode 100644 .vscode/settings.json create mode 100644 .vscode/targets.log diff --git a/.vscode/configurationCache.log b/.vscode/configurationCache.log new file mode 100644 index 0000000..74f0781 --- /dev/null +++ b/.vscode/configurationCache.log @@ -0,0 +1 @@ +{"buildTargets":["Case.class","but","clean","main_ex.class","observateurButtonEtText.class","observateurCase.class","observateurChoix.class","observateurFenetre.class","observateurSAV.class","paintChoix.class","paintMenuJeu.class","plateau.class","plusoumoins.class","run"],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}} \ No newline at end of file diff --git a/.vscode/dryrun.log b/.vscode/dryrun.log new file mode 100644 index 0000000..2905db7 --- /dev/null +++ b/.vscode/dryrun.log @@ -0,0 +1,17 @@ +make --dry-run --always-make --keep-going --print-directory +make: Entering directory `/Users/tommonin/Documents/SAE21_2021' +javac -implicit:none Case.java + +javac -implicit:none plateau.java +javac -implicit:none observateurCase.java +javac -implicit:none paintMenuJeu.java +javac -implicit:none observateurSAV.java +javac -implicit:none observateurFenetre.java +javac -implicit:none paintChoix.java +javac -implicit:none observateurChoix.java + +javac -implicit:none plusoumoins.java +javac -implicit:none observateurButtonEtText.java +javac -implicit:none main_ex.java +make: Leaving directory `/Users/tommonin/Documents/SAE21_2021' + diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..65e1ec0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "makefile.extensionOutputFolder": "./.vscode" +} \ No newline at end of file diff --git a/.vscode/targets.log b/.vscode/targets.log new file mode 100644 index 0000000..422eb40 --- /dev/null +++ b/.vscode/targets.log @@ -0,0 +1,410 @@ +make all --print-data-base --no-builtin-variables --no-builtin-rules --question +# GNU Make 3.81 +# Copyright (C) 2006 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. +# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# This program built for i386-apple-darwin11.3.0 + +# Make data base, printed on Wed May 11 20:30:49 2022 + +# Variables + +# automatic +/dev/null || echo /Developer)/Makefiles +# environment +VSCODE_CODE_CACHE_PATH = /Users/tommonin/Library/Application Support/Code/CachedData/da15b6fd3ef856477bf6f4fb29ba1b7af717770d +# environment +LOGNAME = tommonin +# environment +APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = 1 +# environment +ZSH = /Users/tommonin/.oh-my-zsh +# environment +VSCODE_HANDLES_UNCAUGHT_ERRORS = true +# automatic +^D = $(patsubst %/,%,$(dir $^)) +# environment +XPC_FLAGS = 0x0 +# default +MAKE = $(MAKE_COMMAND) +# default +MAKECMDGOALS := all +# environment +SHLVL = 1 +# default +MAKE_VERSION := 3.81 +# environment +USER = tommonin +# makefile +.DEFAULT_GOAL := but +# environment +LESS = -R +# automatic +%D = $(patsubst %/,%,$(dir $%)) +# default +MAKE_COMMAND := /Library/Developer/CommandLineTools/usr/bin/make +# default +.VARIABLES := +# environment +TMPDIR = /var/folders/z7/5ldy4cvx299dqsp97x3f2vj80000gn/T/ +# automatic +*F = $(notdir $*) +# environment +VSCODE_IPC_HOOK = /Users/tommonin/Library/Application Support/Code/1.67.1-main.sock +# makefile +MAKEFLAGS = Rrqp +# environment +MFLAGS = -Rrqp +# automatic +*D = $(patsubst %/,%,$(dir $*)) +# environment +XPC_SERVICE_NAME = application.com.microsoft.VSCode.23049971.23049977 +# environment +HOMEBREW_PREFIX = /opt/homebrew +# automatic ++D = $(patsubst %/,%,$(dir $+)) +# automatic ++F = $(notdir $+) +# environment +HOMEBREW_REPOSITORY = /opt/homebrew +# environment +__CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x1 +# environment +COMMAND_MODE = unix2003 +# default +MAKEFILES := +# automatic +this.plat.getLigne()*this.plat.getCollonne()){ + nombre=this.plat.getLigne()*this.plat.getCollonne(); + } + this.plat.setBombe(nombre); + if(this.plat.getLigne()!=-1 && this.plat.getCollonne()!=-1 && this.plat.getBombe()!=-1){ + this.plat.newGame(); + }else{ + if(this.plat.getBombe()==-1){ + this.zone.setBackground(Color.red); + this.zone.setText("Rentrer un nombre de Bobme"); + } + } + }else{ + this.zone.setBackground(Color.red); + this.zone.setText("Selectionner Ligne et Collonne Avant"); + this.plat.setBombe(-1); + } + this.plat.setBombe(nombre); + }catch(NumberFormatException e1){ + this.zone.setBackground(Color.red); + this.zone.setText("rentrer un nombre valide"); + this.plat.setBombe(-1); } } if(this.fonction==3){ diff --git a/paintMenuJeu.java b/paintMenuJeu.java index 0739021..f831302 100644 --- a/paintMenuJeu.java +++ b/paintMenuJeu.java @@ -5,27 +5,11 @@ import javax.swing.JComponent; public class paintMenuJeu extends JComponent{ private int choix; private int scoreMax, score; - private Image un, deux, trois, quatre, cinq, six, sept, huit, neuf, zero, err, sav, lose, win, replay; private boolean survol; public paintMenuJeu(int choix0, int score0, int scoreMax0){ this.choix=choix0; this.score=score0; this.scoreMax=scoreMax0; - this.un=Toolkit.getDefaultToolkit().getImage("./IMAGE/unD.png"); - this.deux=Toolkit.getDefaultToolkit().getImage("./IMAGE/deuxD.png"); - this.trois=Toolkit.getDefaultToolkit().getImage("./IMAGE/troisD.png"); - this.quatre=Toolkit.getDefaultToolkit().getImage("./IMAGE/quatreD.png"); - this.cinq=Toolkit.getDefaultToolkit().getImage("./IMAGE/cinqD.png"); - this.six=Toolkit.getDefaultToolkit().getImage("./IMAGE/sixD.png"); - this.sept=Toolkit.getDefaultToolkit().getImage("./IMAGE/septD.png"); - this.huit=Toolkit.getDefaultToolkit().getImage("./IMAGE/huitD.png"); - this.neuf=Toolkit.getDefaultToolkit().getImage("./IMAGE/neufD.png"); - this.zero=Toolkit.getDefaultToolkit().getImage("./IMAGE/zeroD.png"); - this.err=Toolkit.getDefaultToolkit().getImage("./IMAGE/err.png"); - this.sav=Toolkit.getDefaultToolkit().getImage("./IMAGE/sav.png"); - this.lose=Toolkit.getDefaultToolkit().getImage("./IMAGE/lose.png"); - this.win=Toolkit.getDefaultToolkit().getImage("./IMAGE/win.png"); - this.replay=Toolkit.getDefaultToolkit().getImage("./IMAGE/replay.png"); this.survol=false; } public void setChoix(int choix0){ @@ -86,56 +70,71 @@ public class paintMenuJeu extends JComponent{ secondPinceau.setColor(new Color(0,255,0)); secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); } - secondPinceau.drawImage(this.sav, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image sav=Toolkit.getDefaultToolkit().getImage("./IMAGE/sav.png"); + secondPinceau.drawImage(sav, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } if(this.choix==5){ - secondPinceau.drawImage(this.lose, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image lose=Toolkit.getDefaultToolkit().getImage("./IMAGE/lose.png"); + secondPinceau.drawImage(lose, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } if(this.choix==6){ - secondPinceau.drawImage(this.win, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image win=Toolkit.getDefaultToolkit().getImage("./IMAGE/win.png"); + secondPinceau.drawImage(win, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } if(this.choix==7){ if(this.survol==true){ secondPinceau.setColor(new Color(0,255,0)); secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); } - secondPinceau.drawImage(this.replay, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image replay=Toolkit.getDefaultToolkit().getImage("./IMAGE/replay.png"); + secondPinceau.drawImage(replay, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } } private void paintNombre(Graphics secondPinceau, int nombre){ if(this.score>=0){ if(nombre==1){ - secondPinceau.drawImage(this.un, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image un=Toolkit.getDefaultToolkit().getImage("./IMAGE/unD.png"); + secondPinceau.drawImage(un, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } if(nombre==2){ - secondPinceau.drawImage(this.deux, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image deux=Toolkit.getDefaultToolkit().getImage("./IMAGE/deuxD.png"); + secondPinceau.drawImage(deux, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } if(nombre==3){ - secondPinceau.drawImage(this.trois, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image trois=Toolkit.getDefaultToolkit().getImage("./IMAGE/troisD.png"); + secondPinceau.drawImage(trois, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } if(nombre==4){ - secondPinceau.drawImage(this.quatre, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image quatre=Toolkit.getDefaultToolkit().getImage("./IMAGE/quatreD.png"); + secondPinceau.drawImage(quatre, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } if(nombre==5){ - secondPinceau.drawImage(this.cinq, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image cinq=Toolkit.getDefaultToolkit().getImage("./IMAGE/cinqD.png"); + secondPinceau.drawImage(cinq, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } if(nombre==6){ - secondPinceau.drawImage(this.six, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image six=Toolkit.getDefaultToolkit().getImage("./IMAGE/sixD.png"); + secondPinceau.drawImage(six, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } if(nombre==7){ - secondPinceau.drawImage(this.sept, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image sept=Toolkit.getDefaultToolkit().getImage("./IMAGE/septD.png"); + secondPinceau.drawImage(sept, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } if(nombre==8){ - secondPinceau.drawImage(this.huit, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image huit=Toolkit.getDefaultToolkit().getImage("./IMAGE/huitD.png"); + secondPinceau.drawImage(huit, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } if(nombre==9){ - secondPinceau.drawImage(this.neuf, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image neuf=Toolkit.getDefaultToolkit().getImage("./IMAGE/neufD.png"); + secondPinceau.drawImage(neuf, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } if(nombre==0){ - secondPinceau.drawImage(this.zero, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image zero=Toolkit.getDefaultToolkit().getImage("./IMAGE/zeroD.png"); + secondPinceau.drawImage(zero, this.getWidth()/6, this.getHeight()/6, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } }else{ - secondPinceau.drawImage(this.err, this.getWidth()/20*5, this.getHeight()/20*5, this.getWidth()/6*4, this.getHeight()/6*4 ,this); + Image err=Toolkit.getDefaultToolkit().getImage("./IMAGE/err.png"); + secondPinceau.drawImage(err, this.getWidth()/20*5, this.getHeight()/20*5, this.getWidth()/6*4, this.getHeight()/6*4 ,this); } } diff --git a/plateau.java b/plateau.java index 06ebae4..ac27937 100644 --- a/plateau.java +++ b/plateau.java @@ -20,8 +20,9 @@ public class plateau{ this.fenetre=fenetre0; this.ligne=-1; this.collonne=-1; - this.bombe=0; + this.bombe=-1; } + //-------------------> Debut Seter et Getteur <------------------------- public void setLogo(paintMenuJeu logo0){ this.logo=logo0; } @@ -49,6 +50,8 @@ public class plateau{ public void setBombe(int n){ this.bombe=n; } + //-------------------------> fin Setter et Getteur <----------------------------- + //-------------------------Fonction plaçant les bombes aléatoirement------------------------ private void setAllBombe(){ @@ -227,7 +230,7 @@ public class plateau{ for(int i=0; i Fonction pour sauvegarder la partie <------------------------- +/* + +Mettre les bloc try catch au bon endroit +*/ + + + public void save(){ //les fonctions vont lever des Exeption nous devons donc mettre un try Catch try{ //nous initialison le outputStream en créant le fichier "sauvegarde.data" FileOutputStream sav = new FileOutputStream(new File("sauvegarde.data")); - //nous allons sérialiser le tableau de Case - ObjectOutputStream oos = new ObjectOutputStream(sav); - //nous écrivons donc tout d'abord la taille de celui-ci - oos.writeInt(this.ligne); - oos.writeInt(this.collonne); - //puis nous parcourons le tableau en sérialisant toute les Case - for(int i=0; ie%_Ih{Qg75~}nw9q9@i*h& ze6Rm{Bjxfhtf$(~7{lj~^jP;Sm*T{=2d~WcefCY3b#Jhqg0oc+c{U(@>6*%P>QBwH}<_U^}?49BFutWyw72DOtQMH`p#y&O|fTglZo-O(XYKglCrOdE52Xi<`n; za139b;$B&(MK-_Wu|35Owp}O+e#2l2@?$r8f09?#ua?SS z9=JM(OD+bZ+~#HBfmz=cudTs$6dP-+BeAw8<5Fm+ws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