Esempio n. 1
0
 /* mouse events */
 public void mousePressed(MouseEvent e) {
   int x = e.getX();
   int y = e.getY();
   /* left click */
   if (e.getButton() == MouseEvent.BUTTON1) {
     if (x >= posX && x < posX + Constant.BATTLEFIELD_WIDTH) {
       if (y >= posY) {
         if (y < posY + Constant.BATTLEFIELD_HEIGHT) {
           battle_field.doPress((x - posX), (y - posY));
           return;
         } else if (y < posY + Constant.BATTLEFIELD_HEIGHT + Constant.CARDPANEL_HEIGHT) {
           card_panel.doDrag(x - posX, y - (posY + Constant.BATTLEFIELD_HEIGHT));
           return;
         }
       }
     }
     /* right click */
   } else if (e.getButton() == MouseEvent.BUTTON3) {
     if (x >= posX && x < posX + Constant.BATTLEFIELD_WIDTH) {
       if (y >= posY) {
         if (y < posY + Constant.BATTLEFIELD_HEIGHT) {
           Skill skill = arena.player.useSkill(skill_id, x - posX, y - posY);
           if (skill != null) {
             arena.addSkill(skill);
           }
           return;
         } else if (y < posY + Constant.BATTLEFIELD_HEIGHT + Constant.CARDPANEL_HEIGHT) {
           card_panel.changeDetail(x - posX, y - (posY + Constant.BATTLEFIELD_HEIGHT));
           return;
         }
       }
     }
   }
 }