NetBeansProjects
@ -0,0 +1,40 @@
|
||||
<!--
|
||||
* affichageVisite.php
|
||||
-->
|
||||
<?php
|
||||
include_once("entete.php");
|
||||
include_once("modele/accesBDD.php");
|
||||
?>
|
||||
<h2>Liste des comptes rendu</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Client </th><th>Date </th><th>Heure </th><th>Remarque </th><th>Compte rendu </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
if (isset(($_GET["msg"]))) {
|
||||
$msg = $_GET["msg"];
|
||||
echo "<p>$msg</p>";
|
||||
unset($_GET["msg"]);
|
||||
}
|
||||
//Recherche des visites de l'utilisateur afin de les afficher
|
||||
$dbh = connexion();
|
||||
$visites = rechercherLesComptesRendusDuCommercial($dbh, $id);
|
||||
while ($unCompteRendu = $visites->fetch()) { // Lecture 1ère ligne jeu d'enregistrements
|
||||
$idCompteRendu = $unCompteRendu['idCompteRendu'];
|
||||
$lib = $unCompteRendu['praNom'] . " " . $unCompteRendu['praPrenom'];
|
||||
$dateV = $unCompteRendu["date"];
|
||||
$heureV = $unCompteRendu["heure"];
|
||||
$rem = $unCompteRendu["remarque"];
|
||||
$cptRendu = $unCompteRendu['compteRendu'];
|
||||
echo "<tr><td>$lib </td><td>$dateV </td><td>$heureV </td><td>$rem </td><td>$cptRendu </td><td><a href='ajoutCompteRendu.php?idVisite=$idVisite'>Ajout comptes rendus</a> </td></tr>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
47
sioa/NetBeansProjects/Authentification24/affichageVisite.php
Normal file
@ -0,0 +1,47 @@
|
||||
<!--
|
||||
* affichageVisite.php
|
||||
-->
|
||||
<?php
|
||||
include_once("entete.php");
|
||||
include_once("modele/accesBDD.php");
|
||||
?>
|
||||
<h2>Liste des visites</h2>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Client </th><th>Ville </th><th>Date </th><th>Heure </th><th>Remarque </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
if (isset(($_GET["msg"]))) {
|
||||
$msg = $_GET["msg"];
|
||||
echo "<p>$msg</p>";
|
||||
unset($_GET["msg"]);
|
||||
}
|
||||
//Recherche des visites de l'utilisateur afin de les afficher
|
||||
$dbh = connexion();
|
||||
$visites = rechercherLesVisitesDuCommercial($dbh, $id);
|
||||
while ($uneVisite = $visites->fetch()) { // Lecture 1ère ligne jeu d'enregistrements
|
||||
$idVisite = $uneVisite['idVisite'];
|
||||
$lib = $uneVisite['praNom'] . " " . $uneVisite['praPrenom'];
|
||||
$ville = $uneVisite['praVille'];
|
||||
$dateV = $uneVisite["date"];
|
||||
$heureV = $uneVisite["heure"];
|
||||
$rem = $uneVisite["remarque"];
|
||||
echo "<tr><td>$lib </td><td>$ville </td><td>$dateV </td>"
|
||||
. "<td>$heureV </td><td>$rem </td><td><a href='affichageCompteRendu.php?idVisite=$idVisite'>Comptes rendus</a> </td> </tr>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</br> </br> </br>
|
||||
|
||||
<!--<p>
|
||||
<a href="nouvelleVisite.php">Ajouter une visite</a>
|
||||
</p>-->
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
include_once("entete.php");
|
||||
include_once("modele/accesBDD.php");
|
||||
?>
|
||||
<h2>Nouveau compte rendu</h2>
|
||||
<form method="POST">
|
||||
<label for="listeClient">Sélectionner le client à visiter </label>
|
||||
<select name=ldrClient id="listeClient" required>
|
||||
<optgroup label="Les clients">
|
||||
<?php
|
||||
$dbh = connexion();
|
||||
$lesClients = rechercherLesClients($dbh);
|
||||
while ($unClient = $lesClients->fetch()) { // Lecture 1ère ligne jeu d'enregistrements
|
||||
$id = $unClient['id'];
|
||||
$lib = $unClient['nom'] . " |" . $unClient['prenom'] . "| "
|
||||
. $unClient['adresse'] . " |" . $unClient['codePostal'] . " |" . $unClient['ville'];
|
||||
echo "<option value='$id'>$lib</option>";
|
||||
$unClient = $lesClients->fetch(); // Lecture suivante
|
||||
}
|
||||
?>
|
||||
</optgroup>
|
||||
</select>
|
||||
<br /><br />
|
||||
<label for="ztDate">Date du compte rendu</label>
|
||||
<input type="date" name="ztDate" id="ztDate" required />
|
||||
<label for="ztHeure">Heure du compte rendu</label>
|
||||
<input type="time" name="ztHeure" id="ztHeure" required />
|
||||
<br /><br />
|
||||
<label for="txtRemarque">Remarque </label>
|
||||
<textarea name="txtRemarque" id="txtRemarque"></textarea>
|
||||
<br /><br />
|
||||
<input type="submit" value="Valider" />
|
||||
</form>
|
||||
<?php
|
||||
if (isset($_GET['msg'])) {
|
||||
$message = $_GET['msg'];
|
||||
echo "<p>$message</p>";
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
8
sioa/NetBeansProjects/Authentification24/deconnexion.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/*
|
||||
* deconnexion.php
|
||||
*/
|
||||
session_start();
|
||||
session_unset();
|
||||
header("location:index.php");
|
||||
exit();
|
37
sioa/NetBeansProjects/Authentification24/entete.php
Normal file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
* entete.php
|
||||
* entete à inclure au début de chaque page
|
||||
-->
|
||||
<?php
|
||||
session_start();
|
||||
if(!isset($_SESSION['id'])) {
|
||||
$message = "Authentifiez-vous avant de poursuivre";
|
||||
header("location:index.php?msg=$message");
|
||||
exit();
|
||||
}
|
||||
$id = $_SESSION['id'];
|
||||
$nom = $_SESSION['nom'];
|
||||
$prenom = $_SESSION['prenom'];
|
||||
$role = $_SESSION['role'];
|
||||
|
||||
if($role==0){
|
||||
$libRole='Visiteur';
|
||||
}
|
||||
else{
|
||||
$libRole= 'Responsable';
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title> Gestion des visites - V4</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
<?php echo $libRole;?> identifié : <?php echo $prenom." ".$nom." "; ?>
|
||||
<a href="deconnexion.php">Déconnexion</a>
|
||||
</p>
|
||||
<h1>Organisation des visites clients</h1>
|
||||
|
30
sioa/NetBeansProjects/Authentification24/index.php
Normal file
@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
index.php
|
||||
Saisie login et mot de passe
|
||||
Envoi vers verifLogin.php pour contrôle
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Authentification V3.1</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Authentification</h2>
|
||||
<form method="POST" action ="verifLogin.php">
|
||||
<label for="ztLogin">Login </label>
|
||||
<input type="text" name="ztLogin" id="ztLogin" required=""/>
|
||||
<label for="ztMdp">Mot de passe </label>
|
||||
<input type="password" name="ztMdp" id="ztMdp" required=""/>
|
||||
<br /> <br />
|
||||
<input type="submit" value="Valider" />
|
||||
</form>
|
||||
<?php
|
||||
// Affichage message d'erreur s'il existe
|
||||
if (isset($_GET["msg"])) {
|
||||
$msg = $_GET["msg"];
|
||||
echo "<p>$msg</p>";
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
177
sioa/NetBeansProjects/Authentification24/modele/accesBDD.php
Normal file
@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
/* * ***************************************************************************
|
||||
* accesBDD.php
|
||||
* Regroupement de toutes les fonctions d'accès à la base de données
|
||||
* ************************************************************************** */
|
||||
define("DEBUG_SQL", "debug-sql"); // nom du fichier de log
|
||||
define("TYPE_LOG", 0); // utilisation du fichier de log standard
|
||||
//define("TYPE_LOG", 3); // utilisation du fichier de log défini dans DEBUG_SQL
|
||||
//unlink(DEBUG_SQL); // suppression fichier log
|
||||
|
||||
/**
|
||||
* Connexion persistante au serveur
|
||||
* @return \PDO Connexion
|
||||
*/
|
||||
function connexion() {
|
||||
// Définition des variables de connexion
|
||||
$user = "admin";
|
||||
$pass = "minda";
|
||||
$dsn = 'mysql:host=localhost;dbname=bdgsb'; //Data Source Name
|
||||
// Connexion
|
||||
try {
|
||||
$dbh = new PDO($dsn, $user, $pass, array(
|
||||
PDO::ATTR_PERSISTENT => true, // Connexion persistante
|
||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''));
|
||||
} catch (PDOException $e) {
|
||||
erreurSQL($e->getMessage(), "Pb connexion", $dbh);
|
||||
}
|
||||
return $dbh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajout de l'utilisateur dont les données sont passée en paramètre
|
||||
* @param type $dbh chaine de connexion
|
||||
* @param type $nom nom du nouvel utilisateur
|
||||
* @param type $prenom prenom du nouvel utilisateur
|
||||
* @param type $mail courriel du nouvel utilisateur
|
||||
* @param type $login login, qui devra être unique
|
||||
* @param type $mdp mot de passe
|
||||
*/
|
||||
function ajouterUtilisateur($dbh, $nom, $prenom, $mail, $login, $mdp) {
|
||||
$ajout = false;
|
||||
if (!existLogin($dbh, $login)) {
|
||||
//echo("<br>mdpChiffre : " . $mdpChiffre);
|
||||
$mdpChiffre = password_hash($mdp, PASSWORD_DEFAULT); //************ Chiffrement
|
||||
$sql = "INSERT INTO utilisateur VALUES (NULL, '$nom', '$prenom', '$mail', '$login', '$mdpChiffre');";
|
||||
$resultat = $dbh->exec($sql);
|
||||
if ($resultat === false) {
|
||||
erreurSQL("Pb lors de l ajout d un utilisateur.", $sql, $dbh);
|
||||
}
|
||||
$ajout = true;
|
||||
}
|
||||
return $ajout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recherche si le login existe déjà
|
||||
* @param type $dbh Connexion
|
||||
* @param type $login pseudo à vérifier
|
||||
* @return type booléen, true si le login existe
|
||||
*/
|
||||
function existLogin($dbh, $login) {
|
||||
$sql = "SELECT COUNT(*) FROM utilisateur WHERE login = '$login';";
|
||||
$resultat = $dbh->query($sql); // Execution de la requete
|
||||
if ($resultat === false) {
|
||||
erreurSQL("Pb lors de la recherche du login.", $sql, $dbh);
|
||||
}
|
||||
$count = $resultat->fetchColumn(); // Retourne la valeur de la 1ère col de la ligne suivante (param 0 par défaut)
|
||||
return ($count > 0);
|
||||
}
|
||||
|
||||
/** afficherErreurSQL :
|
||||
* Ajout message d'erreur dans le fichier log, fin de l'application
|
||||
* @param $message : message a afficher
|
||||
* @param $req : requete executee
|
||||
* @param $dbh : connexion PDO
|
||||
*/
|
||||
function erreurSQL($message, $req, $dbh) {
|
||||
error_log("\n***Erreur SQL*** " . date('Y-m-d H-i-s') . "\tAdresse IP : " . getIp(), TYPE_LOG, DEBUG_SQL);
|
||||
error_log("\n\tMessage: " . $message, TYPE_LOG, DEBUG_SQL);
|
||||
error_log("\n\tRequete: " . $req, TYPE_LOG, DEBUG_SQL);
|
||||
if ($dbh) {
|
||||
//$erreur = print_r($dbh->errorInfo(), true);
|
||||
$erreur = $dbh->errorInfo()[2];
|
||||
error_log("\n\tErreur: " . $erreur, TYPE_LOG, DEBUG_SQL);
|
||||
}
|
||||
//echo("Taille log : " . stat(DEBUG_SQL)[7]);
|
||||
//echo(" - Date dernière modif : " . date("d m Y H:i:s.", filemtime(DEBUG_SQL)));
|
||||
if (isset($_SESSION)) {
|
||||
session_unset();
|
||||
session_destroy();
|
||||
}
|
||||
die("<p id='erreur1'>Désolé, site actuellement indisponible </p>");
|
||||
}
|
||||
|
||||
/**
|
||||
* Controle de l'utilisateur, mot de passe non chiffré
|
||||
* @param type $dbh
|
||||
* @param type $pseudo
|
||||
* @param type $mdp
|
||||
* @return type utilisateur trouvé ou false sinon;
|
||||
*/
|
||||
function rechercherUtilisateur($dbh, $login, $mdp) {
|
||||
$sql = "SELECT * FROM utilisateur WHERE login = '$login' AND mdp = '$mdp';";
|
||||
$resultat = $dbh->query($sql); // Execution de la requete
|
||||
if ($resultat === false) {
|
||||
erreurSQL("Pb lors de la recherche de l utilisateur.", $sql, $dbh);
|
||||
}
|
||||
return $resultat->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Recherche de tous les clients
|
||||
* @param type $dbh
|
||||
* @return type jeu d'enregistrements
|
||||
*/
|
||||
function rechercherLesClients($dbh) {
|
||||
$sql = "SELECT * FROM client ORDER BY codePostal;";
|
||||
$resultat = $dbh->query($sql); // Execution de la requete
|
||||
if ($resultat === false) {
|
||||
erreurSQL("Pb lors de la recherche des clients.", $sql, $dbh);
|
||||
}
|
||||
return $resultat;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Controle de l'utilisateur, mot de passe chiffré
|
||||
* @param type $dbh
|
||||
* @param type $login
|
||||
* @param type $mdp
|
||||
* @return type false si le contrôle a échoué, l'utilisateur sinon
|
||||
*/
|
||||
function controlerUtilisateur($dbh, $login, $mdp) {
|
||||
$sql = "SELECT * FROM utilisateur WHERE login = '$login';";
|
||||
$resultat = $dbh->query($sql); // Execution de la requete
|
||||
if ($resultat === false) {
|
||||
erreurSQL("Pb lors de la recherche de l utilisateur.", $sql, $dbh);
|
||||
}
|
||||
$user = $resultat->fetch();
|
||||
$hash = $user ? $user["mdp"] : " ";
|
||||
return password_verify($mdp, $hash) ? $user : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupération adresse IP du client
|
||||
* @return type
|
||||
*/
|
||||
function getIp() {
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
} else {
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
return $ip;
|
||||
}
|
||||
|
||||
function rechercherLesVisitesDuCommercial($dbh, $id) {
|
||||
$sql = "SELECT idVisite, praNom, praPrenom, praVille, date, heure, remarque FROM visite INNER JOIN praticien ON visite.praNum= praticien.praNum ORDER BY date, heure";
|
||||
$resultat = $dbh->query($sql); // Execution de la requete
|
||||
if ($resultat === false) {
|
||||
erreurSQL("Pb lors de la recherche des visites.", $sql, $dbh);
|
||||
}
|
||||
return $resultat;
|
||||
}
|
||||
|
||||
function rechercherLesComptesRendusDuCommercial($dbh, $idVisite){
|
||||
$sql = "SELECT idCompteRendu, praNom, praPrenom, visite.date, visite.heure, remarque, compteRendu FROM comptesRendus INNER JOIN visite ON visite.idVisite= comptesRendus.idVisite NATURAL JOIN praticien WHERE visite.idVisite = $idVisite";
|
||||
$resultat = $dbh->query($sql); // Execution de la requete
|
||||
if ($resultat === false) {
|
||||
erreurSQL("Pb lors de la recherche des comptes rendus.", $sql, $dbh);
|
||||
}
|
||||
return $resultat;
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
include_once("entete.php");
|
||||
include_once("modele/accesBDD.php");
|
||||
?>
|
||||
<h2>Module responsable</h2>
|
||||
|
||||
<h5>module en cours de construction</h5>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,4 @@
|
||||
copy.src.on.open=false
|
||||
index.file=index.php
|
||||
run.as=LOCAL
|
||||
url=http://localhost/PHPProjects/Authentification25
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/Authentification24/affichageVisite.php</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/Authentification24/moduleResponsable.php</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/Authentification24/validInscription.php</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/Authentification24/entete.php</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/Authentification24/nouvelleVisite.php</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/Authentification24/index.php</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/Authentification24/verifLogin.php</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/Authentification24/affichageCompteRendu.php</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/Authentification24/ajoutCompteRendu.php</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/Authentification24/deconnexion.php</file>
|
||||
</group>
|
||||
</open-files>
|
||||
</project-private>
|
@ -0,0 +1,7 @@
|
||||
include.path=${php.global.include.path}
|
||||
php.version=PHP_73
|
||||
source.encoding=UTF-8
|
||||
src.dir=.
|
||||
tags.asp=false
|
||||
tags.short=false
|
||||
web.root=.
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.php.project</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/php-project/1">
|
||||
<name>Authentification2</name>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
44
sioa/NetBeansProjects/Authentification24/nouvelleVisite.php
Normal file
@ -0,0 +1,44 @@
|
||||
<!--
|
||||
* nouvelleVisite.php
|
||||
-->
|
||||
<?php
|
||||
include_once("entete.php");
|
||||
include_once("modele/accesBDD.php");
|
||||
?>
|
||||
<h2>Nouvelle visite</h2>
|
||||
<form method="POST">
|
||||
<label for="listeClient">Sélectionner le client à visiter </label>
|
||||
<select name=ldrClient id="listeClient" required>
|
||||
<optgroup label="Les clients">
|
||||
<?php
|
||||
$dbh = connexion();
|
||||
$lesClients = rechercherLesClients($dbh);
|
||||
while ($unClient = $lesClients->fetch()) { // Lecture 1ère ligne jeu d'enregistrements
|
||||
$id = $unClient['id'];
|
||||
$lib = $unClient['nom'] . " " . $unClient['prenom'] . ", "
|
||||
. $unClient['adresse'] . " " . $unClient['codePostal'] . " " . $unClient['ville'];
|
||||
echo "<option value='$id'>$lib</option>";
|
||||
$unClient = $lesClients->fetch(); // Lecture suivante
|
||||
}
|
||||
?>
|
||||
</optgroup>
|
||||
</select>
|
||||
<br /><br />
|
||||
<label for="ztDate">Date de la visite </label>
|
||||
<input type="date" name="ztDate" id="ztDate" required />
|
||||
<label for="ztHeure">Heure de la visite </label>
|
||||
<input type="time" name="ztHeure" id="ztHeure" required />
|
||||
<br /><br />
|
||||
<label for="txtRemarque">Remarque </label>
|
||||
<textarea name="txtRemarque" id="txtRemarque"></textarea>
|
||||
<br /><br />
|
||||
<input type="submit" value="Valider" />
|
||||
</form>
|
||||
<?php
|
||||
if (isset($_GET['msg'])) {
|
||||
$message = $_GET['msg'];
|
||||
echo "<p>$message</p>";
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/*
|
||||
* validInscription.php
|
||||
* Validation des données saisies dans le formulaire inscription.php
|
||||
*/
|
||||
|
||||
// Suppression des caractères spéciaux
|
||||
$data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
|
||||
//var_dump($data);
|
||||
|
||||
// Si le nombre de variables reçues est différents du nombre attendu, retour au formulaire
|
||||
const NB_VAR = 5; // Nombre de variables attendues
|
||||
if (count($data)!=NB_VAR) {
|
||||
header("location:inscription.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Contrôles des zones obligatoires
|
||||
$lib=["Nom", "Prénom", "Adresse de courriel","Login", "Mot de passe"];
|
||||
$valeurs = array_values($data);
|
||||
for($i=0; $i<NB_VAR; $i++) {
|
||||
if (strlen(trim($valeurs[$i]))<=0) {
|
||||
$message = $lib[$i]." non valide";
|
||||
header("location:inscription.php?msg=$message");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
// Contrôle de l'adresse mail
|
||||
//$mail=filter_input(INPUT_POST, 'ztMail', FILTER_VALIDATE_EMAIL);
|
||||
$mail=filter_var($data["ztMail"], FILTER_VALIDATE_EMAIL);
|
||||
if ($mail===false or $mail === null) {
|
||||
$message = "Adresse de courriel non valide";
|
||||
//echo $message;
|
||||
header("location:inscription.php?msg=$message");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Contrôles ok, affichage des données
|
||||
echo "<h3>Les données de l'inscription sont validées</h3>";
|
||||
for($i=0; $i<NB_VAR; $i++) {
|
||||
echo "$lib[$i] : $valeurs[$i]<br>";
|
||||
}
|
||||
|
||||
// Test
|
||||
/*$script = "<script>alert(\"Coucou!\")</script>";
|
||||
$texte = "Bonjour Èric ".$script ;
|
||||
echo $script; // Sans filtre
|
||||
$mess = filter_var($texte, FILTER_SANITIZE_SPECIAL_CHARS);
|
||||
echo ("<br>texte : $mess"); */
|
||||
|
||||
// Ajout de l'utilisateur dans la base de données
|
||||
require_once('modele/accesBDD.php');
|
||||
$dbh = connexion();
|
||||
if (ajouterUtilisateur($dbh, $data['ztNom'], $data['ztPrenom'], $data['ztMail'], $data['ztLogin'], $data['ztMdp'])) {
|
||||
$message = "<p>Votre compte a été créé, vous pouvez désormais vous authentifier</p>";
|
||||
header("location:index.php?msg=$message");
|
||||
} else {
|
||||
$message = "<p>Désolé, ce login n'est pas possible</p>";
|
||||
header("location:inscription.php?msg=$message");
|
||||
}
|
68
sioa/NetBeansProjects/Authentification24/verifLogin.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
session_start();
|
||||
/*
|
||||
* verifLogin.php
|
||||
* Contrôle du login et du mot de passe saisi
|
||||
*/
|
||||
|
||||
// Si ztLogin ou si ztMdp n'existe pas, retour à la page index
|
||||
//if (!isset($_POST["ztLogin"]) or !isset($_POST["ztMdp"])) {
|
||||
// header('location: index.php'); // retour page index
|
||||
// exit();
|
||||
//}
|
||||
// Récupération du login et du mot de passe saisi
|
||||
//$login = $_POST["ztLogin"];
|
||||
//$mdp = $_POST["ztMdp"];
|
||||
//echo "<p>Login saisi : $login, mot de passe saisi : $mdp</p>";
|
||||
// Contrôle login et mot de passe
|
||||
//if ($login == "tintin" and $mdp == "milou"){
|
||||
// echo "<h3>Bienvenue $login</h3";
|
||||
//} else {
|
||||
// header('location: index.php?msg=Erreur login ou mot de passe'); // retour page index avec message d'erreur
|
||||
// exit();
|
||||
//}
|
||||
// Suppression des caractères spéciaux
|
||||
$data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
|
||||
|
||||
//var_dump($data);
|
||||
// Si le nombre de variables reçues est différents du nombre attendu, retour au formulaire
|
||||
const NB_VAR = 2; // Nombre de variables attendues
|
||||
if (count($data) != NB_VAR) {
|
||||
header("location:index.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Contrôles des zones obligatoires
|
||||
$lib = ["Login", "Mot de passe"];
|
||||
$valeurs = array_values($data);
|
||||
for ($i = 0; $i < NB_VAR; $i++) {
|
||||
if (strlen(trim($valeurs[$i])) <= 0) {
|
||||
$message = $lib[$i] . " non valide";
|
||||
header("location:inscription.php?msg=$message");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
require_once('modele/accesBDD.php');
|
||||
$dbh = connexion();
|
||||
$user = controlerUtilisateur($dbh, $data["ztLogin"], $data["ztMdp"]);
|
||||
if ($user) {
|
||||
$_SESSION['id'] = $user['id'];
|
||||
$_SESSION['nom'] = $user['nom'];
|
||||
$_SESSION['prenom'] = $user['prenom'];
|
||||
$_SESSION['role']= $user['role'];
|
||||
if ($user['role']==0){
|
||||
header("location:affichageVisite.php");
|
||||
}
|
||||
else{
|
||||
header("location:moduleResponsable.php");
|
||||
}
|
||||
//echo "<p>Authentification réussie, bienvenue " . $user['prenom'] . " " . $user['nom'] . "</p>";
|
||||
} else {
|
||||
$message = "Login ou mot de passe erroné";
|
||||
header("location:index.php?msg=$message");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
73
sioa/NetBeansProjects/ChasseAuTresor/build.xml
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="ChasseAuTresor" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project ChasseAuTresor.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="ChasseAuTresor-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
3
sioa/NetBeansProjects/ChasseAuTresor/manifest.mf
Normal file
@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
1770
sioa/NetBeansProjects/ChasseAuTresor/nbproject/build-impl.xml
Normal file
@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=0c18b458
|
||||
build.xml.script.CRC32=aa46bd7d
|
||||
build.xml.stylesheet.CRC32=f85dc8f2@1.95.0.48
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=0c18b458
|
||||
nbproject/build-impl.xml.script.CRC32=37e2ad13
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=f89f7d21@1.95.0.48
|
@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=/home/clement.bouillot/.netbeans/12.0/build.properties
|
@ -0,0 +1,95 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.modulepath=\
|
||||
${run.modulepath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
debug.test.modulepath=\
|
||||
${run.test.modulepath}
|
||||
# Files in build.classes.dir which should be excluded from distribution jar
|
||||
dist.archive.excludes=
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/ChasseAuTresor.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
dist.jlink.dir=${dist.dir}/jlink
|
||||
dist.jlink.output=${dist.jlink.dir}/ChasseAuTresor
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.external.vm=true
|
||||
javac.modulepath=
|
||||
javac.processormodulepath=
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=11
|
||||
javac.target=11
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.modulepath=\
|
||||
${javac.modulepath}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.html5=false
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
# The jlink additional root modules to resolve
|
||||
jlink.additionalmodules=
|
||||
# The jlink additional command line parameters
|
||||
jlink.additionalparam=
|
||||
jlink.launcher=true
|
||||
jlink.launcher.name=ChasseAuTresor
|
||||
main.class=chasseautresor.ChasseAuTresor
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.modulepath=\
|
||||
${javac.modulepath}
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
run.test.modulepath=\
|
||||
${javac.test.modulepath}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
15
sioa/NetBeansProjects/ChasseAuTresor/nbproject/project.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>ChasseAuTresor</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package chasseautresor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clement.bouillot
|
||||
*/
|
||||
public class ChasseAuTresor {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// TODO code application logic here
|
||||
}
|
||||
|
||||
}
|
14
sioa/NetBeansProjects/ChasseAuTresor/src/métier/joueur.java
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package métier;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clement.bouillot
|
||||
*/
|
||||
public class joueur {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package métier;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clement.bouillot
|
||||
*/
|
||||
public class position {
|
||||
|
||||
}
|
3
sioa/NetBeansProjects/GSB prototype/manifest.mf
Normal file
@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package gsb.prototype;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clement.bouillot
|
||||
*/
|
||||
public class GSBPrototype {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// TODO code application logic here
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="474" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="422" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Form>
|
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package gsb.prototype;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clement.bouillot
|
||||
*/
|
||||
public class JFormGSB extends javax.swing.JFrame {
|
||||
|
||||
/**
|
||||
* Creates new form JFormGSB
|
||||
*/
|
||||
public JFormGSB() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 474, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 422, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
java.util.logging.Logger.getLogger(JFormGSB.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(JFormGSB.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(JFormGSB.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(JFormGSB.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the form */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
new JFormGSB().setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
73
sioa/NetBeansProjects/JeuDeRole2/build.xml
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="JeuDeRole2" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project JeuDeRole2.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="JeuDeRole2-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
@ -0,0 +1,4 @@
|
||||
#Wed, 05 May 2021 09:30:40 +0200
|
||||
|
||||
|
||||
/home/clement.bouillot/NetBeansProjects/JeuDeRole2=
|
BIN
sioa/NetBeansProjects/JeuDeRole2/build/classes/img/Barbare04.jpg
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/build/classes/img/Combat.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.5 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/build/classes/img/Simone.JPG
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/build/classes/img/Sorcier02.JPG
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/build/classes/img/Sorciere1.jpg
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/build/classes/img/adj_1.jpg
Normal file
After Width: | Height: | Size: 9.1 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/build/classes/img/des.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/build/classes/img/famille_1.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/build/classes/img/imgSup.zip
Normal file
BIN
sioa/NetBeansProjects/JeuDeRole2/build/classes/img/magie.jpg
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/build/classes/img/panoramix.gif
Normal file
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 13 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/build/classes/metier/Jeu.class
Normal file
3
sioa/NetBeansProjects/JeuDeRole2/manifest.mf
Normal file
@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
1770
sioa/NetBeansProjects/JeuDeRole2/nbproject/build-impl.xml
Normal file
@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=17786340
|
||||
build.xml.script.CRC32=221123fd
|
||||
build.xml.stylesheet.CRC32=f85dc8f2@1.95.0.48
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=17786340
|
||||
nbproject/build-impl.xml.script.CRC32=f1457fcd
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=f89f7d21@1.95.0.48
|
@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=/home/clement.bouillot/.netbeans/12.0/build.properties
|
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/JeuDeRole2/src/metier/Personnage.java</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/JeuDeRole2/src/metier/Voleur.java</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/JeuDeRole2/src/metier/Affrontement.java</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/JeuDeRole2/src/jeuderole/JeuDeRole.java</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/JeuDeRole2/src/metier/Enigme.java</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/JeuDeRole2/src/metier/Sorcier.java</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/JeuDeRole2/src/metier/Jeu.java</file>
|
||||
<file>file:/home/clement.bouillot/NetBeansProjects/JeuDeRole2/src/metier/Guerrier.java</file>
|
||||
</group>
|
||||
</open-files>
|
||||
</project-private>
|
@ -0,0 +1,95 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.modulepath=\
|
||||
${run.modulepath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
debug.test.modulepath=\
|
||||
${run.test.modulepath}
|
||||
# Files in build.classes.dir which should be excluded from distribution jar
|
||||
dist.archive.excludes=
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/JeuDeRole2.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
dist.jlink.dir=${dist.dir}/jlink
|
||||
dist.jlink.output=${dist.jlink.dir}/JeuDeRole2
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.external.vm=true
|
||||
javac.modulepath=
|
||||
javac.processormodulepath=
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=11
|
||||
javac.target=11
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.modulepath=\
|
||||
${javac.modulepath}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.html5=false
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
# The jlink additional root modules to resolve
|
||||
jlink.additionalmodules=
|
||||
# The jlink additional command line parameters
|
||||
jlink.additionalparam=
|
||||
jlink.launcher=true
|
||||
jlink.launcher.name=JeuDeRole2
|
||||
main.class=jeuderole.JeuDeRole
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.modulepath=\
|
||||
${javac.modulepath}
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
run.test.modulepath=\
|
||||
${javac.test.modulepath}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
15
sioa/NetBeansProjects/JeuDeRole2/nbproject/project.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>JeuDeRole2</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/Barbare04.jpg
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/Combat.jpg
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/CombatPerdu.jpg
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/Guerrier05.JPG
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/Guerrier08.JPG
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/Guerrier10.JPG
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/Guerrier12.JPG
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/Simone.JPG
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/Sorcier02.JPG
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/Sorciere1.jpg
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/adj_1.jpg
Normal file
After Width: | Height: | Size: 9.1 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/des.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/famille_1.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/magie.jpg
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
sioa/NetBeansProjects/JeuDeRole2/src/img/panoramix.gif
Normal file
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package jeuderole;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import metier.Guerrier;
|
||||
import metier.Jeu;
|
||||
import metier.Personnage;
|
||||
import metier.Sorcier;
|
||||
import metier.Voleur;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dominique_2
|
||||
*/
|
||||
public class JeuDeRole {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
/* System.out.println("1. Création de 2 guerrier identiques : ");
|
||||
Guerrier leGuerrier1 = new Guerrier("Invincible", "Guerrier05.JPG", 30, 10, "Epée");
|
||||
Guerrier leGuerrier2 = new Guerrier("Invincible", "Guerrier05.JPG", 30, 10, "Epée");
|
||||
System.out.println("\tleGuerrier1 : " + leGuerrier1);
|
||||
System.out.println("\tleGuerrier2 : " + leGuerrier2);
|
||||
|
||||
System.out.println("\n2. Comparaison des 2 guerriers : ");
|
||||
if (leGuerrier1.equals(leGuerrier2)) {
|
||||
System.out.println("\tLes 2 guerriers sont identiques");
|
||||
} else {
|
||||
System.out.println("\tLes 2 guerriers sont différents");
|
||||
}
|
||||
|
||||
System.out.println("\n3. Création d'un 3ème guerrier : et comparaison guerrier1 et guerrier3");
|
||||
Guerrier leGuerrier3 = new Guerrier("Spartacus", "Guerrier05.JPG", 30, 10, "Epée");
|
||||
System.out.println("\tleGuerrier3 : " + leGuerrier3);
|
||||
|
||||
if (leGuerrier1.equals(leGuerrier3)) {
|
||||
System.out.println("\tLes 2 guerriers sont identiques");
|
||||
} else {
|
||||
System.out.println("\tLes 2 guerriers sont différents");
|
||||
}
|
||||
|
||||
System.out.println("\n4. Création d'un Sorcier et d'un Voleur : ");
|
||||
Sorcier laSorciere = new Sorcier("ReineSorciere", "Sorciere1.jpg", 20, 30, "Pomme","enigme");
|
||||
Voleur leVoleur1 = new Voleur("Arsène Lupin", "Barbare04.jpg", 15, 25, "Pince");
|
||||
System.out.println("\tlaSorciere : " + laSorciere);
|
||||
System.out.println("\tleVoleur1 : " + leVoleur1);
|
||||
|
||||
System.out.println("\n5. Rencontre entre le sorcier et le guerrier2 : ");
|
||||
//System.out.println(laSorciere.rencontrer(leGuerrier2));
|
||||
|
||||
System.out.println("\n6. Salutation entre la sorciere et le guerrier2 : ");
|
||||
laSorciere.saluer(leGuerrier2);
|
||||
|
||||
System.out.println("\n7. Salutation entre le guerrier2 et le voleur1 : ");
|
||||
leGuerrier2.saluer(leVoleur1);
|
||||
|
||||
System.out.println("\n8. Salutation entre le voleur1 et la sorciere : ");
|
||||
leVoleur1.saluer(laSorciere);
|
||||
|
||||
// Création d'une collection de Personnage
|
||||
ArrayList<Personnage> lesPersonnages = new ArrayList<>();
|
||||
Personnage g1 = new Guerrier("Barbare","", 6, 4, "Hache");
|
||||
lesPersonnages.add(g1);
|
||||
Personnage v1 = new Voleur("Raptout", "", 2, 4 , "Marteau");
|
||||
lesPersonnages.add(v1);
|
||||
Sorcier s1 = new Sorcier("Panoramix","", 10, 5, "De laurier","Enigme");
|
||||
lesPersonnages.add(s1);
|
||||
System.out.println("\n9. Collection de personnages créée :\n "+lesPersonnages);
|
||||
|
||||
System.out.println("\n10. Rencontre entre le guerrier2 et la sorcière : ");
|
||||
leGuerrier2.rencontrer(laSorciere);
|
||||
|
||||
System.out.println("\n11. Rencontre entre un voleur et la sorcière : ");
|
||||
leVoleur1.rencontrer(laSorciere);
|
||||
*/
|
||||
Jeu unJeu=new Jeu("Rencontre fatale");
|
||||
unJeu.getLesPersonnages().get(5).rencontrer(unJeu.getLesPersonnages().get(6));
|
||||
|
||||
|
||||
unJeu.getLesPersonnages().get(6).setEnergie(0);
|
||||
unJeu.getLesPersonnages().get(5).combattre(unJeu.getLesPersonnages().get(6));
|
||||
|
||||
}
|
||||
}
|
317
sioa/NetBeansProjects/JeuDeRole2/src/metier/Affrontement.form
Normal file
@ -0,0 +1,317 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="220" max="-2" attributes="0"/>
|
||||
<Component id="okBT" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="okBT" min="-2" pref="31" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="33" green="33" red="33" type="rgb"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" pref="237" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="image1" min="-2" pref="209" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
||||
<Component id="image1" pref="0" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" min="-2" pref="368" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="image1">
|
||||
<Properties>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ee" green="ee" red="ee" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/img/adj_1.jpg"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextArea" name="descriptionAffrontement">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="33" green="33" red="33" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="columns" type="int" value="20"/>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ee" green="ee" red="ee" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="rows" type="int" value="5"/>
|
||||
<Property name="text" type="java.lang.String" value="Texte"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel3" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="149" max="-2" attributes="0"/>
|
||||
<Component id="image2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
|
||||
<Component id="image2" min="-2" pref="124" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jPanel3" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="image2">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/img/famille_1.jpg"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel4" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="choixAttaquant" min="-2" pref="200" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="43" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel5" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="choixAttaqué" alignment="1" min="-2" pref="200" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="choixAttaquant" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="choixAttaqué" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel4" max="32767" attributes="0"/>
|
||||
<Component id="jPanel5" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JComboBox" name="choixAttaquant">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="4">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="choixAttaquantActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="choixAttaqué">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="4">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel4">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="descriprionAttaquant" min="-2" pref="201" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="62" max="-2" attributes="0"/>
|
||||
<Component id="imageAttaquant" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="descriprionAttaquant" min="-2" pref="181" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
|
||||
<Component id="imageAttaquant" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="45" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextField" name="descriprionAttaquant">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jTextField1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="imageAttaquant">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jLabel1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel5">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="61" max="-2" attributes="0"/>
|
||||
<Component id="imageAttaqué" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="descriptionAttaqué" min="-2" pref="201" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="descriptionAttaqué" min="-2" pref="181" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
|
||||
<Component id="imageAttaqué" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextField" name="descriptionAttaqué">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jTextField2"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="imageAttaqué">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jLabel2"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JToggleButton" name="okBT">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Ok"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="okBTActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
254
sioa/NetBeansProjects/JeuDeRole2/src/metier/Affrontement.java
Normal file
@ -0,0 +1,254 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package metier;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clement.bouillot
|
||||
*/
|
||||
public class Affrontement extends javax.swing.JPanel {
|
||||
|
||||
/**
|
||||
* Creates new form Affrontement
|
||||
*/
|
||||
public Affrontement() {
|
||||
initComponents();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
image1 = new javax.swing.JLabel();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
descriptionAffrontement = new javax.swing.JTextArea();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
image2 = new javax.swing.JLabel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
choixAttaquant = new javax.swing.JComboBox<>();
|
||||
choixAttaqué = new javax.swing.JComboBox<>();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
descriprionAttaquant = new javax.swing.JTextField();
|
||||
imageAttaquant = new javax.swing.JLabel();
|
||||
jPanel5 = new javax.swing.JPanel();
|
||||
descriptionAttaqué = new javax.swing.JTextField();
|
||||
imageAttaqué = new javax.swing.JLabel();
|
||||
okBT = new javax.swing.JToggleButton();
|
||||
|
||||
jPanel1.setBackground(new java.awt.Color(51, 51, 51));
|
||||
|
||||
image1.setForeground(new java.awt.Color(238, 238, 238));
|
||||
image1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/adj_1.jpg"))); // NOI18N
|
||||
|
||||
descriptionAffrontement.setBackground(new java.awt.Color(51, 51, 51));
|
||||
descriptionAffrontement.setColumns(20);
|
||||
descriptionAffrontement.setForeground(new java.awt.Color(238, 238, 238));
|
||||
descriptionAffrontement.setRows(5);
|
||||
descriptionAffrontement.setText("Texte");
|
||||
jScrollPane1.setViewportView(descriptionAffrontement);
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(image1, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(10, 10, 10)))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(image1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 368, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
image2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/famille_1.jpg"))); // NOI18N
|
||||
|
||||
choixAttaquant.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
choixAttaquant.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
choixAttaquantActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
choixAttaqué.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
|
||||
descriprionAttaquant.setText("jTextField1");
|
||||
|
||||
imageAttaquant.setText("jLabel1");
|
||||
|
||||
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
|
||||
jPanel4.setLayout(jPanel4Layout);
|
||||
jPanel4Layout.setHorizontalGroup(
|
||||
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addComponent(descriprionAttaquant, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addGap(62, 62, 62)
|
||||
.addComponent(imageAttaquant)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel4Layout.setVerticalGroup(
|
||||
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addComponent(descriprionAttaquant, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(32, 32, 32)
|
||||
.addComponent(imageAttaquant)
|
||||
.addContainerGap(45, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
descriptionAttaqué.setText("jTextField2");
|
||||
|
||||
imageAttaqué.setText("jLabel2");
|
||||
|
||||
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
|
||||
jPanel5.setLayout(jPanel5Layout);
|
||||
jPanel5Layout.setHorizontalGroup(
|
||||
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||
.addGap(61, 61, 61)
|
||||
.addComponent(imageAttaqué)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(descriptionAttaqué, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
jPanel5Layout.setVerticalGroup(
|
||||
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel5Layout.createSequentialGroup()
|
||||
.addComponent(descriptionAttaqué, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(32, 32, 32)
|
||||
.addComponent(imageAttaqué)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
|
||||
jPanel3.setLayout(jPanel3Layout);
|
||||
jPanel3Layout.setHorizontalGroup(
|
||||
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(choixAttaquant, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 43, Short.MAX_VALUE)
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(choixAttaqué, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel3Layout.setVerticalGroup(
|
||||
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(choixAttaquant, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(choixAttaqué, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
||||
jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGap(149, 149, 149)
|
||||
.addComponent(image2)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGap(6, 6, 6)
|
||||
.addComponent(image2, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(6, 6, 6))
|
||||
);
|
||||
|
||||
okBT.setText("Ok");
|
||||
okBT.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
okBTActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(220, 220, 220)
|
||||
.addComponent(okBT)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(okBT, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void okBTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okBTActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_okBTActionPerformed
|
||||
|
||||
private void choixAttaquantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_choixAttaquantActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_choixAttaquantActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JComboBox<String> choixAttaquant;
|
||||
private javax.swing.JComboBox<String> choixAttaqué;
|
||||
private javax.swing.JTextField descriprionAttaquant;
|
||||
private javax.swing.JTextArea descriptionAffrontement;
|
||||
private javax.swing.JTextField descriptionAttaqué;
|
||||
private javax.swing.JLabel image1;
|
||||
private javax.swing.JLabel image2;
|
||||
private javax.swing.JLabel imageAttaquant;
|
||||
private javax.swing.JLabel imageAttaqué;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel jPanel4;
|
||||
private javax.swing.JPanel jPanel5;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JToggleButton okBT;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
51
sioa/NetBeansProjects/JeuDeRole2/src/metier/Enigme.java
Normal file
@ -0,0 +1,51 @@
|
||||
package metier;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dominique_2
|
||||
*/
|
||||
public class Enigme implements Serializable{
|
||||
private String question;
|
||||
private String reponse;
|
||||
|
||||
/**
|
||||
* @return the question
|
||||
*/
|
||||
public String getQuestion() {
|
||||
return question;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param question the question to set
|
||||
*/
|
||||
public void setQuestion(String question) {
|
||||
this.question = question;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the reponse
|
||||
*/
|
||||
public String getReponse() {
|
||||
return reponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param reponse the reponse to set
|
||||
*/
|
||||
public void setReponse(String reponse) {
|
||||
this.reponse = reponse;
|
||||
}
|
||||
|
||||
public Enigme(String question, String reponse) {
|
||||
this.question = question;
|
||||
this.reponse = reponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Enigme {" + "question=" + question + ", reponse=" + reponse + '}';
|
||||
}
|
||||
|
||||
}
|
||||
|
146
sioa/NetBeansProjects/JeuDeRole2/src/metier/Guerrier.java
Normal file
@ -0,0 +1,146 @@
|
||||
package metier;
|
||||
import java.util.Objects;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JOptionPane;
|
||||
import static javax.swing.JOptionPane.WARNING_MESSAGE;
|
||||
|
||||
/**
|
||||
* Classe Guerrier, hérite de la classe Personnage
|
||||
* @author Dominique_2
|
||||
* @version 20210311
|
||||
*/
|
||||
public class Guerrier extends Personnage{
|
||||
// Variable membre
|
||||
private String arme;
|
||||
|
||||
/**
|
||||
* Valorisation des variables membres
|
||||
* @param nom nom du guerrier
|
||||
* @param img nom de l'image représentant le guerrier
|
||||
* @param energie valeur énergétique du guerrier
|
||||
* @param dureeVie durée de vie du guerrier
|
||||
* @param arme armu du guerrier
|
||||
*/
|
||||
public Guerrier(String nom, String img, int energie, int dureeVie, String arme) {
|
||||
super(nom, img, energie, dureeVie);
|
||||
this.arme = arme;
|
||||
}
|
||||
/**
|
||||
* Permet d'obtenir les valeurs des attributs de l'objet courant
|
||||
* @return liste des attributs avec leurs valeurs
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "\n\tGuerrier{" + "arme=" + arme + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = super.hashCode() + (13 * hash + Objects.hashCode(this.arme));
|
||||
return hash;
|
||||
}
|
||||
/**
|
||||
* Comparaison de l'objet courant avec l'objet passé en paramètre
|
||||
* @param obj objet à comparer avec l'objet courant
|
||||
* @return true : les 2 objets sont identiques, false sinon
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Guerrier other = (Guerrier) obj;
|
||||
if (!Objects.equals(this.arme, other.arme)) {
|
||||
return false;
|
||||
}
|
||||
if(!super.equals(obj)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of arme *
|
||||
* @return the value of arme
|
||||
*/
|
||||
public String getArme() {
|
||||
return arme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of arme *
|
||||
* @param arme new value of arme
|
||||
*/
|
||||
public void setArme(String arme) {
|
||||
this.arme = arme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rencontre du guerrier avec un autre personnage (Combat de dés)
|
||||
* @param p
|
||||
*/
|
||||
@Override
|
||||
public void rencontrer(Personnage p) {
|
||||
Icon iCombat;
|
||||
Icon iDes = new javax.swing.ImageIcon(getClass().getResource("../img/des.jpg"));
|
||||
int score1 = 0;
|
||||
int score2 = 0;
|
||||
int nbJeu = 0;
|
||||
String message = "Es-tu prêt à me combattre " + p.getNom() + " ? " ;
|
||||
String titre = this.getNom() + " rencontre " + p.getNom() + " : ";
|
||||
while (score1 == score2) {
|
||||
if (nbJeu > 0) {
|
||||
message = "Égalité. Rejoue vite ";
|
||||
}
|
||||
JOptionPane.showMessageDialog( null,
|
||||
message,
|
||||
titre + "défi dés",
|
||||
WARNING_MESSAGE,
|
||||
iDes);
|
||||
score1 = Jeu.genererNbAleatoire(1, 6);
|
||||
score2 = Jeu.genererNbAleatoire(1, 6);
|
||||
nbJeu++;
|
||||
}
|
||||
String resultat="Ton score : " + score2 + " - Le mien : " + score1;
|
||||
int type;
|
||||
if (score1 >= score2) {
|
||||
resultat += "\n\nTu as perdu,"
|
||||
+ "\nattention à toi " + p.getNom()
|
||||
+ ",\nta vie est en danger!";
|
||||
iCombat = new javax.swing.ImageIcon(getClass().getResource("/img/Combat.jpg"));
|
||||
p.varierDureeVie(-1);
|
||||
p.varierEnergie(-2);
|
||||
} else {
|
||||
resultat += "\n\nTu as gagné ce défi,"
|
||||
+ "\nmais je me vengerai de toi,\n"
|
||||
+ p.getNom() +", prends garde à toi!";
|
||||
iCombat = new javax.swing.ImageIcon(getClass().getResource("/img/CombatPerdu.jpg"));
|
||||
p.varierEnergie(+2); // +2 pour le gagnant attaqué
|
||||
varierEnergie(-1); // -1 pour le perdant attaquant
|
||||
}
|
||||
JOptionPane.showMessageDialog( null,
|
||||
resultat,
|
||||
titre + "résultat",
|
||||
WARNING_MESSAGE,
|
||||
iCombat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rencontre avec un autre personnage
|
||||
* @param unPerso personnage à saluer
|
||||
*/
|
||||
@Override
|
||||
public void saluer(Personnage unPerso) {
|
||||
String titre = this.getNom() + " salue " + unPerso.getNom();
|
||||
String message = "Bonjour " + unPerso.getNom() + ", \nsauve-toi vite avant que je ne te frappe avec mon arme redoutable!";
|
||||
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
}
|
141
sioa/NetBeansProjects/JeuDeRole2/src/metier/Jeu.java
Normal file
@ -0,0 +1,141 @@
|
||||
package metier;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dominique_2
|
||||
*/
|
||||
public class Jeu {
|
||||
|
||||
private String nomJeu;
|
||||
private ArrayList<Personnage> lesPersonnages;
|
||||
|
||||
/**
|
||||
* @return the nomJeu
|
||||
*/
|
||||
public String getNomJeu() {
|
||||
return nomJeu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lesPersonnages
|
||||
*/
|
||||
public ArrayList<Personnage> getLesPersonnages() {
|
||||
return lesPersonnages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Jeu{" + "lesPersonnages=" + lesPersonnages + '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructeur
|
||||
*
|
||||
* @param nomJeu
|
||||
*/
|
||||
public Jeu(String nomJeu) {
|
||||
this.nomJeu = nomJeu;
|
||||
this.lesPersonnages = new ArrayList<>();
|
||||
chargerLesPersonnages();
|
||||
}
|
||||
|
||||
/**
|
||||
* Création des personnages du jeu
|
||||
*/
|
||||
public void chargerLesPersonnages() {
|
||||
Personnage g1 = new Guerrier("Dudule", "Guerrier05.JPG", 5, 6, "Epée");
|
||||
Personnage g2 = new Guerrier("Toto", "Guerrier10.JPG", 8, 7, "Epée");
|
||||
Personnage g3 = new Guerrier("Dur à cuire", "Guerrier08.JPG", 4, 5, "Poignard");
|
||||
Personnage g4 = new Guerrier("Prêt à tout", "Guerrier12.JPG", 6, 4, "Matraque");
|
||||
lesPersonnages.add(g1);
|
||||
lesPersonnages.add(g2);
|
||||
lesPersonnages.add(g3);
|
||||
lesPersonnages.add(g4);
|
||||
|
||||
Personnage clampin = new Personnage("Simone", "Simone.JPG", 4, 3);
|
||||
lesPersonnages.add(clampin);
|
||||
|
||||
Sorcier s1 = new Sorcier("Panoramix", "panoramix.gif", 10, 5, "Sortilèges");
|
||||
Enigme uneEnigme = new Enigme("Je suis vague en bord de mer.\n"
|
||||
+ "Je descends des montagnes en hiver.\n"
|
||||
+ "Sans moi vous n'aurez plus une larme.",
|
||||
"L'eau");
|
||||
s1.ajouterEnigme(uneEnigme);
|
||||
uneEnigme = new Enigme("Je serai hier, j'étais demain.",
|
||||
"Aujourd'hui");
|
||||
s1.ajouterEnigme(uneEnigme);
|
||||
uneEnigme = new Enigme("Si de ton doigt tu veux me toucher, apprête toi alors à le retirer.\n"
|
||||
+ "Mais si tu sais me manipuler ta demeure en sera réchauffée et illuminée.\n"
|
||||
+ "Qui suis-je ?",
|
||||
"Le feu");
|
||||
s1.ajouterEnigme(uneEnigme);
|
||||
uneEnigme = new Enigme("Je suis si fragile que lorsque l'on prononce mon nom, je meurs.",
|
||||
"Le silence");
|
||||
s1.ajouterEnigme(uneEnigme);
|
||||
lesPersonnages.add(s1);
|
||||
s1 = new Sorcier("FaitPeur", "Sorcier02.JPG", 10, 4, "Sortilèges");
|
||||
s1.ajouterEnigme(uneEnigme);
|
||||
uneEnigme = new Enigme("Connu pour ses galeries,\n"
|
||||
+ "Et le ton de son gris,\n"
|
||||
+ "Elle évoque la mauvaise vision,\n"
|
||||
+ "Et c'est un excellent espion",
|
||||
"La taupe");
|
||||
s1.ajouterEnigme(uneEnigme);
|
||||
uneEnigme = new Enigme("Symbole de maladresse, pour beaucoup je suis signe de malédiction.\n"
|
||||
+ "Quand on passe l'arme, c'est parfois à moi.\n"
|
||||
+ "Que suis-je ?",
|
||||
"La gauche");
|
||||
s1.ajouterEnigme(uneEnigme);
|
||||
uneEnigme = new Enigme("Vous ne pouvez que me deviner et ne pouvez qu'avancer vers moi.\n"
|
||||
+ "Quand vous arrivez, je ne suis plus là.\n"
|
||||
+ "Car à chaque pas avancé, je recule d'autant.\n"
|
||||
+ "Que suis-je ?",
|
||||
"Le futur");
|
||||
s1.ajouterEnigme(uneEnigme);
|
||||
lesPersonnages.add(s1);
|
||||
|
||||
Personnage rapTout = new Voleur("Raptout", "Barbare04.jpg", 2, 4, "Tournevis");
|
||||
lesPersonnages.add(rapTout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recherche du personnage dont le nom est passé en paramètre
|
||||
*
|
||||
* @param n nom du personnage recherché
|
||||
* @return personnage correspondant au nom s'il existe, null sinon
|
||||
*/
|
||||
public Personnage rechercherPerso(String n) {
|
||||
int i = 0;
|
||||
Personnage p = null;
|
||||
while (p == null && i < lesPersonnages.size()) {
|
||||
if (lesPersonnages.get(i).getNom().equals(n)) {
|
||||
p = lesPersonnages.get(i);
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recherche d'un nombre aléatoire entre min et max inclus
|
||||
*
|
||||
* @param min
|
||||
* @param max
|
||||
* @return entier compris entre min et max
|
||||
*/
|
||||
public static int genererNbAleatoire(int min, int max) {
|
||||
return min + (int) (Math.random() * ((max - min) + 1));
|
||||
}
|
||||
|
||||
/* public Vector<String> getPersonnagesVivants{
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
195
sioa/NetBeansProjects/JeuDeRole2/src/metier/Personnage.java
Normal file
@ -0,0 +1,195 @@
|
||||
package metier;
|
||||
import java.util.Objects;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
/**
|
||||
* Classe Mère Personnage
|
||||
* @author Dominique_2
|
||||
* @version 20210311
|
||||
*/
|
||||
public class Personnage {
|
||||
// Variables membres
|
||||
private String nom;
|
||||
private String img;
|
||||
private int energie;
|
||||
private int dureeVie;
|
||||
/**
|
||||
* Valorisation des variables membres
|
||||
* @param nom nom du personnage
|
||||
* @param img nom de l'image du personnage
|
||||
* @param energie valeur énergétique
|
||||
* @param dureeVie durée de vie, en année
|
||||
*/
|
||||
public Personnage(String nom, String img, int energie, int dureeVie) {
|
||||
this.nom = nom;
|
||||
this.img = img;
|
||||
this.energie = energie;
|
||||
this.dureeVie = dureeVie;
|
||||
}
|
||||
/**
|
||||
* Permet d'obtenir les valeurs des attributs de l'objet courant
|
||||
* @return liste des attributs avec leurs valeurs
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Personnage{" + "nom=" + nom + ", img=" + img + ", energie=" + energie + ", dureeVie=" + dureeVie + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 47 * hash + Objects.hashCode(this.nom);
|
||||
hash = 47 * hash + Objects.hashCode(this.img);
|
||||
hash = 47 * hash + this.energie;
|
||||
hash = 47 * hash + this.dureeVie;
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comparaison de l'objet courant avec l'objet passé en paramètre
|
||||
* @param obj objet à comparer avec l'objet courant
|
||||
* @return true : les 2 objets sont identiques, false sinon
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Personnage other = (Personnage) obj;
|
||||
if (this.energie != other.energie) {
|
||||
return false;
|
||||
}
|
||||
if (this.dureeVie != other.dureeVie) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.nom, other.nom)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.img, other.img)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of energie *
|
||||
* @return the value of energie
|
||||
*/
|
||||
public int getEnergie() {
|
||||
return energie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of energie *
|
||||
* @param energie new value of energie
|
||||
*/
|
||||
public void setEnergie(int energie) {
|
||||
this.energie = energie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of dureeVie *
|
||||
* @return the value of dureeVie
|
||||
*/
|
||||
public int getDureeVie() {
|
||||
return dureeVie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of dureeVie *
|
||||
* @param dureeVie new value of dureeVie
|
||||
*/
|
||||
public void setDureeVie(int dureeVie) {
|
||||
this.dureeVie = dureeVie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of img *
|
||||
* @return the value of img
|
||||
*/
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of img *
|
||||
* @param img new value of img
|
||||
*/
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of nom *
|
||||
* @return the value of nom
|
||||
*/
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of nom *
|
||||
* @param nom new value of nom
|
||||
*/
|
||||
public void setNom(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rencontre avec un autre personnage
|
||||
* @param unPerso : personnage rencontré
|
||||
* @return
|
||||
*/
|
||||
public void rencontrer(Personnage unPerso) {
|
||||
String titre = this.getNom() + " rencontre " + unPerso.getNom();
|
||||
String message = "Bonjour " + unPerso.getNom() + " !";
|
||||
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE);
|
||||
String source = "/img/" + this.getImg();
|
||||
Icon imgPerso = new javax.swing.ImageIcon(getClass().getResource(source));
|
||||
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE, imgPerso);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rencontre avec un autre personnage
|
||||
* @param unPerso personnage à saluer
|
||||
*/
|
||||
public void saluer(Personnage unPerso) {
|
||||
String titre = this.getNom() + " salue " + unPerso.getNom();
|
||||
String message = "Bonjour " + unPerso.getNom() + ", \nje suis content de te revoir!";
|
||||
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajout du nombre passé en paramètre à l'énergie
|
||||
* Si le résultat de l'ajout est négatif, il est forcé à 0
|
||||
* @param nb ; nombre à ajouter (positif ou négatif)
|
||||
*/
|
||||
public void varierEnergie(int nb){
|
||||
energie = energie+nb > 0 ? energie+nb : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajout du nombre passé en paramètre à la durée de vie
|
||||
* Si le résultat de l'ajout est négatif, il est forcé à 0
|
||||
* @param nb ; nombre à ajouter (positif ou négatif)
|
||||
*/
|
||||
public void varierDureeVie(int nb){
|
||||
dureeVie = dureeVie+nb > 0 ? dureeVie+nb : 0;
|
||||
}
|
||||
|
||||
public void combattre(Personnage unPerso) {
|
||||
if(unPerso.getEnergie()==0){
|
||||
String titre = this.getNom() + " veut combattre " + unPerso.getNom();
|
||||
String message = "Aide moi..."+ getNom() +" Je n'ai plus d'énérgie" ;
|
||||
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
163
sioa/NetBeansProjects/JeuDeRole2/src/metier/Sorcier.java
Normal file
@ -0,0 +1,163 @@
|
||||
package metier;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JOptionPane;
|
||||
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
|
||||
|
||||
/**
|
||||
* Classe Sorier, hérite de la classe Personnage
|
||||
* @author Dominique_2
|
||||
* @version 20210318
|
||||
*/
|
||||
public class Sorcier extends Personnage {
|
||||
|
||||
private String baguette;
|
||||
private ArrayList<Enigme> lesEnigmes;
|
||||
|
||||
/**
|
||||
* Valorisation des variables membres
|
||||
* @param nom nom du sorcier
|
||||
* @param img nom de l'image représentant le sorcier
|
||||
* @param energie valeur énergétique du sorcier
|
||||
* @param dureeVie durée de vie du sorcier
|
||||
* @param baguette baguette du sorcier
|
||||
* @param e inutile désormais
|
||||
*/
|
||||
public Sorcier(String nom, String img, int energie, int dureeVie, String baguette, String e) {
|
||||
super(nom, img, energie, dureeVie);
|
||||
this.lesEnigmes = new ArrayList<>();
|
||||
this.baguette = baguette;
|
||||
}
|
||||
|
||||
/**
|
||||
* Valorisation des variables membres
|
||||
* @param nom nom du sorcier
|
||||
* @param img nom de l'image représentant le sorcier
|
||||
* @param energie valeur énergétique du sorcier
|
||||
* @param dureeVie durée de vie du sorcier
|
||||
* @param baguette baguette du sorcier
|
||||
*/
|
||||
public Sorcier(String nom, String img, int energie, int dureeVie, String baguette) {
|
||||
super(nom, img, energie, dureeVie);
|
||||
this.lesEnigmes = new ArrayList<>();
|
||||
this.baguette = baguette;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = super.hashCode() + (73 * hash + Objects.hashCode(this.baguette));
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comparaison de l'objet courant avec l'objet passé en paramètre
|
||||
* @param obj objet à comparer avec l'objet courant
|
||||
* @return true : les 2 objets sont identiques, false sinon
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Sorcier other = (Sorcier) obj;
|
||||
if (!Objects.equals(this.baguette, other.baguette)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.lesEnigmes, other.lesEnigmes)) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permet d'obtenir les valeurs des attributs de l'objet courant
|
||||
* @return liste des attributs avec leurs valeurs
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "\n\tSorcier{" + "baguette=" + baguette + ", nb enigmes = " + getLesEnigmes().size() +'}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of baguette *
|
||||
* @return the value of baguette
|
||||
*/
|
||||
public String getBaguette() {
|
||||
return baguette;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of baguette *
|
||||
* @param baguette new value of baguette
|
||||
*/
|
||||
public void setBaguette(String baguette) {
|
||||
this.baguette = baguette;
|
||||
}
|
||||
|
||||
public ArrayList<Enigme> getEnigme() {
|
||||
return getLesEnigmes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rencontre avec un autre personnage
|
||||
* @param unPerso personnage à saluer
|
||||
*/
|
||||
public void saluer(Personnage unPerso) {
|
||||
String titre = this.getNom() + " salue " + unPerso.getNom();
|
||||
String message = "Bonjour " + unPerso.getNom() + ", \nje t'ai jeté un sort, tu es désormais sous ma dépendance!";
|
||||
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajout de l'énigme passée en paramètre dans la collection les Enigmes
|
||||
* @param e Enigme
|
||||
*/
|
||||
public void ajouterEnigme(Enigme e) {
|
||||
getLesEnigmes().add(e);
|
||||
}
|
||||
|
||||
public void rencontrer(Personnage p) {
|
||||
int indiceEnigme = Jeu.genererNbAleatoire(0, getLesEnigmes().size()-1);
|
||||
String titre = this.getNom() + " rencontre " + p.getNom();
|
||||
String reponse = JOptionPane.showInputDialog(
|
||||
null,
|
||||
getLesEnigmes().get(indiceEnigme).getQuestion(),
|
||||
titre + " : énigme",
|
||||
QUESTION_MESSAGE);
|
||||
String resultat="";
|
||||
int type;
|
||||
if (getLesEnigmes().get(indiceEnigme).getReponse().equals(reponse)) {
|
||||
resultat = "Bonne réponse, tu peux passer ton chemin!";
|
||||
type = JOptionPane.INFORMATION_MESSAGE;
|
||||
p.varierDureeVie(1);
|
||||
} else {
|
||||
resultat = "Mauvaise réponse, "
|
||||
+ "\nattention à toi " + p.getNom() +", "
|
||||
+ "\nta vie est en danger!";
|
||||
type = JOptionPane.WARNING_MESSAGE;
|
||||
p.varierDureeVie(-2);
|
||||
}
|
||||
varierEnergie(-1);
|
||||
Icon iMagie = new javax.swing.ImageIcon(getClass().getResource("/img/magie.jpg"));
|
||||
JOptionPane.showMessageDialog(null, resultat, titre + " : résultat",type, iMagie);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lesEnigmes
|
||||
*/
|
||||
public ArrayList<Enigme> getLesEnigmes() {
|
||||
return lesEnigmes;
|
||||
}
|
||||
}
|
153
sioa/NetBeansProjects/JeuDeRole2/src/metier/Voleur.java
Normal file
@ -0,0 +1,153 @@
|
||||
package metier;
|
||||
|
||||
import java.util.Objects;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JOptionPane;
|
||||
import static javax.swing.JOptionPane.DEFAULT_OPTION;
|
||||
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dominique_2
|
||||
*/
|
||||
public class Voleur extends Personnage{
|
||||
|
||||
private String outil;
|
||||
String [] outils = {"Pierre", "Feuille", "Ciseaux"};
|
||||
|
||||
/**
|
||||
* Valorisation des variables membres
|
||||
* @param nom nom du guerrier
|
||||
* @param img nom de l'image représentant le guerrier
|
||||
* @param energie valeur énergétique du guerrier
|
||||
* @param dureeVie durée de vie du guerrier
|
||||
* @param outil outil du guerrier
|
||||
*/
|
||||
public Voleur(String nom, String img, int energie, int dureeVie, String outil) {
|
||||
super(nom, img, energie, dureeVie);
|
||||
this.outil = outil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = super.hashCode() + (29 * hash + Objects.hashCode(this.outil));
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comparaison de l'objet courant avec l'objet passé en paramètre
|
||||
* @param obj objet à comparer avec l'objet courant
|
||||
* @return true : les 2 objets sont identiques, false sinon
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Voleur other = (Voleur) obj;
|
||||
if (!Objects.equals(this.outil, other.outil)) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permet d'obtenir les valeurs des attributs de l'objet courant
|
||||
* @return liste des attributs avec leurs valeurs
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "\n\tVoleur{" + "outil=" + outil + '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of outil *
|
||||
* @return the value of outil
|
||||
*/
|
||||
public String getOutil() {
|
||||
return outil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of outil *
|
||||
* @param outil new value of outil
|
||||
*/
|
||||
public void setOutil(String outil) {
|
||||
this.outil = outil;
|
||||
}
|
||||
|
||||
public void rencontrer(Personnage p) {
|
||||
// int indiceOutil = Jeu.genererNbAleatoire(0, outils.length -1);
|
||||
Icon iPFC = new javax.swing.ImageIcon(getClass().getResource("/img/pierreFeuilleCiseaux.jpg"));
|
||||
// String reponse = (String) JOptionPane.showInputDialog(
|
||||
// null,
|
||||
// "Pierre, feuille, ciseaux ? ",
|
||||
// "Quel est ton choix ?" + p.getNom(),
|
||||
// QUESTION_MESSAGE, iPFC,
|
||||
// outils,"");
|
||||
int nbJeu = 0;
|
||||
String mess = "Que choisis-tu \n" + p.getNom() + " ?";
|
||||
String titre = this.getNom() + " rencontre " + p.getNom();
|
||||
int rep=-1, indiceOutil=-1;
|
||||
while (rep == indiceOutil) {
|
||||
if (nbJeu > 0) {
|
||||
mess = "Égalité, rejoue vite!";
|
||||
}
|
||||
indiceOutil = Jeu.genererNbAleatoire(0, outils.length -1);
|
||||
rep = JOptionPane.showOptionDialog(
|
||||
null,
|
||||
mess,
|
||||
titre,
|
||||
DEFAULT_OPTION,
|
||||
QUESTION_MESSAGE,
|
||||
iPFC,
|
||||
outils,
|
||||
0);
|
||||
nbJeu++;
|
||||
}
|
||||
boolean gagne = true; // Position du personnage rencontré
|
||||
String explication = "";
|
||||
switch (indiceOutil) {
|
||||
case 0 : // Cas Pierre
|
||||
if (rep == 2) { // Cas Ciseaux
|
||||
gagne = false; // La pierre aiguise les ciseaux
|
||||
explication = "La pierre aiguise les ciseaux";
|
||||
}
|
||||
break;
|
||||
case 1 : // Cas Feuille
|
||||
if (rep == 0) { // Cas Pierre
|
||||
gagne = false; // La feuille bat la pierre en l'enveloppant
|
||||
explication = "La feuille enveloppe la pierre"; }
|
||||
break;
|
||||
case 2 : // Cas Ciseaux
|
||||
if (rep == 1) { // Cas Feuille
|
||||
gagne = false; // Les ciseaux coupent la feuille
|
||||
explication = "Les ciseaux coupent la feuille";
|
||||
}
|
||||
}
|
||||
mess = "J'ai choisi " + outils[indiceOutil] + " et toi " + outils[rep] + "\n" + explication + "\n\n";
|
||||
mess += gagne ?
|
||||
"Aujourd'hui tu as gagné "+p.getNom()+",\n mais qu'en sera-t-il demain ?" :
|
||||
"Ah, ah, ah ! Perdu pour toi "+p.getNom()+".\nAu plaisir de te revoir...";
|
||||
JOptionPane.showMessageDialog(null, mess, titre + " : résultat",0, iPFC);
|
||||
|
||||
if (!gagne) {
|
||||
p.varierDureeVie(-1);
|
||||
p.varierEnergie(-1);
|
||||
} else {
|
||||
p.varierEnergie(1);
|
||||
varierEnergie(-1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
73
sioa/NetBeansProjects/JeuDeRoleBTS/build.xml
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="JeuDeRoleBTS" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project JeuDeRoleBTS.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="JeuDeRoleBTS-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
3
sioa/NetBeansProjects/JeuDeRoleBTS/manifest.mf
Normal file
@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
1770
sioa/NetBeansProjects/JeuDeRoleBTS/nbproject/build-impl.xml
Normal file
@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=1b075167
|
||||
build.xml.script.CRC32=0f9ae6ee
|
||||
build.xml.stylesheet.CRC32=f85dc8f2@1.95.0.48
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=1b075167
|
||||
nbproject/build-impl.xml.script.CRC32=270e6e47
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=f89f7d21@1.95.0.48
|
@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=/home/clement.bouillot/.netbeans/12.0/build.properties
|
@ -0,0 +1,95 @@
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
build.generated.sources.dir=${build.dir}/generated-sources
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.modulepath=\
|
||||
${run.modulepath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
debug.test.modulepath=\
|
||||
${run.test.modulepath}
|
||||
# Files in build.classes.dir which should be excluded from distribution jar
|
||||
dist.archive.excludes=
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/JeuDeRoleBTS.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
dist.jlink.dir=${dist.dir}/jlink
|
||||
dist.jlink.output=${dist.jlink.dir}/JeuDeRoleBTS
|
||||
excludes=
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.external.vm=true
|
||||
javac.modulepath=
|
||||
javac.processormodulepath=
|
||||
javac.processorpath=\
|
||||
${javac.classpath}
|
||||
javac.source=11
|
||||
javac.target=11
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javac.test.modulepath=\
|
||||
${javac.modulepath}
|
||||
javac.test.processorpath=\
|
||||
${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.html5=false
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
# The jlink additional root modules to resolve
|
||||
jlink.additionalmodules=
|
||||
# The jlink additional command line parameters
|
||||
jlink.additionalparam=
|
||||
jlink.launcher=true
|
||||
jlink.launcher.name=JeuDeRoleBTS
|
||||
main.class=jeuderolebts.JeuDeRoleBTS
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
mkdist.disabled=false
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project.
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.modulepath=\
|
||||
${javac.modulepath}
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
run.test.modulepath=\
|
||||
${javac.test.modulepath}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
15
sioa/NetBeansProjects/JeuDeRoleBTS/nbproject/project.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>JeuDeRoleBTS</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package jeuderolebts;
|
||||
|
||||
import métier.Perso;
|
||||
import métier.Sorcier;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clement.bouillot
|
||||
*/
|
||||
public class JeuDeRoleBTS {
|
||||
|
||||
|
||||
|
||||
}
|
163
sioa/NetBeansProjects/JeuDeRoleBTS/src/métier/Perso.java
Normal file
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package métier;
|
||||
|
||||
import java.util.Objects;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clement.bouillot
|
||||
*/
|
||||
public class Perso {
|
||||
|
||||
// Variables membres
|
||||
private String nom;
|
||||
private int energie;
|
||||
private int dureeVie;
|
||||
/**
|
||||
* Valorisation des variables membres
|
||||
* @param nom nom du personnage
|
||||
* @param energie valeur énergétique
|
||||
* @param dureeVie durée de vie, en année
|
||||
*/
|
||||
public Perso(String nom, int energie, int dureeVie) {
|
||||
this.nom = nom;
|
||||
this.energie = energie;
|
||||
this.dureeVie = dureeVie;
|
||||
}
|
||||
/**
|
||||
* Permet d'obtenir les valeurs des attributs de l'objet courant
|
||||
* @return liste des attributs avec leurs valeurs
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Personnage{" + "nom=" + nom + ", energie=" + energie + ", dureeVie=" + dureeVie + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 47 * hash + Objects.hashCode(this.nom);
|
||||
hash = 47 * hash + this.energie;
|
||||
hash = 47 * hash + this.dureeVie;
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comparaison de l'objet courant avec l'objet passé en paramètre
|
||||
* @param obj objet à comparer avec l'objet courant
|
||||
* @return true : les 2 objets sont identiques, false sinon
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Perso other = (Perso) obj;
|
||||
if (this.energie != other.energie) {
|
||||
return false;
|
||||
}
|
||||
if (this.dureeVie != other.dureeVie) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.nom, other.nom)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of energie *
|
||||
* @return the value of energie
|
||||
*/
|
||||
public int getEnergie() {
|
||||
return energie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of energie *
|
||||
* @param energie new value of energie
|
||||
*/
|
||||
public void setEnergie(int energie) {
|
||||
this.energie = energie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of dureeVie *
|
||||
* @return the value of dureeVie
|
||||
*/
|
||||
public int getDureeVie() {
|
||||
return dureeVie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of dureeVie *
|
||||
* @param dureeVie new value of dureeVie
|
||||
*/
|
||||
public void setDureeVie(int dureeVie) {
|
||||
this.dureeVie = dureeVie;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of nom *
|
||||
* @return the value of nom
|
||||
*/
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of nom *
|
||||
* @param nom new value of nom
|
||||
*/
|
||||
public void setNom(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ajout du nombre passé en paramètre à l'énergie
|
||||
* Si le résultat de l'ajout est négatif, il est forcé à 0
|
||||
* @param nb ; nombre à ajouter (positif ou négatif)
|
||||
*/
|
||||
public void varierEnergie(int nb){
|
||||
energie = energie+nb > 0 ? energie+nb : 0;
|
||||
}
|
||||
/**
|
||||
* Ajout de la fonction combat
|
||||
*
|
||||
* @param unPerso
|
||||
*/
|
||||
public void combattre(Perso unPerso) {
|
||||
if(unPerso.getEnergie()==0){
|
||||
String titre = this.getNom() + " veut combattre " + unPerso.getNom();
|
||||
String message = "Aide moi..."+ getNom() +" Je n'ai plus d'énérgie" ;
|
||||
JOptionPane.showMessageDialog(null, message, titre, JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ajout du nombre passé en paramètre à la durée de vie
|
||||
* Si le résultat de l'ajout est négatif, il est forcé à 0
|
||||
* @param nb ; nombre à ajouter (positif ou négatif)
|
||||
*/
|
||||
public void varierDureeVie(int nb){
|
||||
dureeVie = dureeVie+nb > 0 ? dureeVie+nb : 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
23
sioa/NetBeansProjects/JeuDeRoleBTS/src/métier/Sorcier.java
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package métier;
|
||||
|
||||
import métier.Perso
|
||||
/**
|
||||
*
|
||||
* @author clement.bouillot
|
||||
*/
|
||||
public class Sorcier {
|
||||
|
||||
/*Utilisationde jocker en cas de Durée de vie à 0
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
73
sioa/NetBeansProjects/LaPoste/build.xml
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="LaPoste" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project LaPoste.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="LaPoste-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|