mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Added a quit match option. FFA game gets no more killed if host left mage or quitted match.
This commit is contained in:
parent
ec9bb538ed
commit
7b260c960b
15 changed files with 178 additions and 54 deletions
|
|
@ -75,22 +75,38 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
JMenuItem menuItem;
|
||||
|
||||
Pmenu = new JPopupMenu();
|
||||
menuItem = new JMenuItem("Concede");
|
||||
|
||||
menuItem = new JMenuItem("Concede game");
|
||||
Pmenu.add(menuItem);
|
||||
|
||||
// Concede
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to concede?", "Confirm concede", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to concede the game?", "Confirm concede game", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
MageFrame.getSession().concedeGame(gameId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
menuItem = new JMenuItem("Quit match");
|
||||
Pmenu.add(menuItem);
|
||||
|
||||
// Quit match
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to quit the match?", "Confirm quit match", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
MageFrame.getSession().quitMatch(gameId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
menuItem = new JMenuItem("Cancel");
|
||||
Pmenu.add(menuItem);
|
||||
|
||||
battlefieldPanel.getMainPanel().addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent Me) {
|
||||
if (Me.isPopupTrigger() && playingMode) {
|
||||
Pmenu.show(Me.getComponent(), Me.getX(), Me.getY());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue