dernière modifs
This commit is contained in:
parent
21744392ca
commit
b0f9825d94
@ -14,12 +14,14 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import modeles.Salle;
|
||||
|
||||
/**
|
||||
* @author nicolas
|
||||
*
|
||||
*/
|
||||
public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
||||
|
||||
public char nb;
|
||||
public JeuSalle() {
|
||||
setTitle("Labyrinthe");
|
||||
setSize(1200,600);
|
||||
@ -50,10 +52,15 @@ public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
||||
*/
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
System.out.println("keyPressed");
|
||||
int code=e.getKeyCode();
|
||||
String key =e.getKeyText(code);
|
||||
System.out.println(key);
|
||||
//System.out.println("keyPressed");
|
||||
int codeint =e.getKeyCode();
|
||||
|
||||
//int codeint=Character.getNumericValue(e.getKeyText(code));
|
||||
//System.out.println(codeint);
|
||||
//String key =e.getKeyText(code);
|
||||
//System.out.println(key);
|
||||
|
||||
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
@ -70,6 +77,9 @@ public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
nb = e.getKeyChar();
|
||||
System.out.println(nb);
|
||||
//System.out.println(nb);
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
@ -81,5 +91,12 @@ public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
||||
|
||||
|
||||
}
|
||||
public char toucheint() {
|
||||
System.out.println("sortie"+nb);
|
||||
return nb;
|
||||
}
|
||||
public void cacher(JPanel panel) {
|
||||
panel.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,6 +42,8 @@ import org.eclipse.swt.SWT;
|
||||
public class jeu extends JFrame implements ActionListener {
|
||||
JButton continuer =new JButton("Continuer");
|
||||
JButton nouvelle = new JButton("Nouvelle Partie");
|
||||
public JeuSalle salle;
|
||||
public JPanel panel;
|
||||
public jeu() throws IOException {
|
||||
super();
|
||||
build();
|
||||
@ -89,26 +91,45 @@ public class jeu extends JFrame implements ActionListener {
|
||||
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||
*/
|
||||
@Override
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
Object source=arg0.getSource();
|
||||
choix(source);
|
||||
if(source==nouvelle) {
|
||||
//JPanel panel = new JPanel();
|
||||
Menu menu = new Menu();
|
||||
Labyrinthe lab=menu.nouvellePartie();
|
||||
JeuSalle salle = new JeuSalle();
|
||||
Marche marche= (Marche) lab.listePorte.get(0).getSalle1();
|
||||
salle.ecrire(marche.creerObjetsAVendre(lab));
|
||||
panel =salle.ecrire(marche.creerObjetsAVendre(lab));
|
||||
repaint();
|
||||
//Bug
|
||||
//Personnage perso = menu.menuSelection(lab);
|
||||
//System.out.println();
|
||||
salle.ecrire(menu.textePerso(lab));
|
||||
panel =salle.ecrire(menu.textePerso(lab));
|
||||
//salle.cacher(panel);
|
||||
//menu.menuSelection(lab);
|
||||
|
||||
}
|
||||
if(source==continuer) {
|
||||
Menu menu = new Menu();
|
||||
Labyrinthe lab = menu.continuer();
|
||||
}
|
||||
}
|
||||
|
||||
public Labyrinthe choix(Object source) {
|
||||
if(source==nouvelle) {
|
||||
Menu menu = new Menu();
|
||||
Labyrinthe lab=menu.nouvellePartie();
|
||||
return lab;
|
||||
}
|
||||
if(source==nouvelle) {
|
||||
Menu menu = new Menu();
|
||||
Labyrinthe lab = menu.continuer();
|
||||
return lab;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ public class main {
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public jeu fenetre;
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
SwingUtilities.invokeLater(new Runnable(){
|
||||
|
@ -68,7 +68,7 @@ public class Menu {
|
||||
}
|
||||
}
|
||||
|
||||
public Personnage menuSelection(Labyrinthe lab) {
|
||||
public Personnage menuSelection(Labyrinthe lab, JeuSalle salle) {
|
||||
System.out.println("Bonjour Etranger, je suis le narrateur de votre histoire. Comment dois-je vous appeler ? ");
|
||||
int i = 0;
|
||||
for (Personnage per : lab.listePersonnage) {
|
||||
@ -77,7 +77,8 @@ public class Menu {
|
||||
|
||||
Personnage pers;
|
||||
try{
|
||||
pers =lab.listePersonnage.get(Clavier.entrerClavierInt());
|
||||
pers =lab.listePersonnage.get(salle.nb);
|
||||
|
||||
}
|
||||
catch(Exception e) {
|
||||
System.out.println("Le personnage dont vous me parlez n'existe pas.");
|
||||
|
Loading…
Reference in New Issue
Block a user