Update JokerPanel.java
This commit is contained in:
parent
cc8df22352
commit
5e18d3ba44
1 changed files with 17 additions and 10 deletions
|
|
@ -5,6 +5,7 @@ import java.awt.event.MouseEvent;
|
|||
import java.awt.event.MouseListener;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import game.Game;
|
||||
import game.map.Castle;
|
||||
|
|
@ -56,7 +57,7 @@ public class JokerPanel extends JPanel implements MouseListener{
|
|||
jokers[index] = j;
|
||||
}
|
||||
|
||||
public void playJoker(JokerTypes joker) {
|
||||
public void playJoker(int index) {
|
||||
if(game.getRound() < 2)
|
||||
return;
|
||||
|
||||
|
|
@ -99,21 +100,27 @@ public class JokerPanel extends JPanel implements MouseListener{
|
|||
}
|
||||
|
||||
public void paintJokers(Graphics g) {
|
||||
System.out.println("X: " + e.getX() + " Y: " + e.getY());
|
||||
if(e.getX() <= 41 && jokers[0] == JokerTypes.ADD_TROOPS) {
|
||||
playJoker(0);
|
||||
} else
|
||||
playJoker(1);
|
||||
if(jokers == null)
|
||||
return;
|
||||
|
||||
|
||||
|
||||
for(int i = 0; i < jokers.length; i++) {
|
||||
System.out.print("i: " + i + jokers[i] + " ");
|
||||
g.drawImage(resources.getJokers()[jokers[i].ordinal()], 9 + 32 * i + 10 * i, 5, 32, 32, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
playJoker(JokerTypes.ADD_TROOPS);
|
||||
for(JokerTypes j : jokers) {
|
||||
System.out.println(j.ordinal());
|
||||
}
|
||||
System.out.println("X: " + e.getX() + " Y: " + e.getY());
|
||||
if(e.getX() <= 41 && jokers[0] == JokerTypes.ADD_TROOPS) {
|
||||
playJoker(0);
|
||||
} else
|
||||
playJoker(1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue