コード例 #1
0
  public void update() {
    // System.out.println("UPDATING VIEW FOR UPDATE " + Engine.getCurrentTopUpdateID());
    refreshPlayers();
    refreshPlayerLifeTotals();
    refreshPlayerPhases();
    refreshHandsVisible();
    StateChangeManager changeManager = game.getCurrentStateChangeManager();
    HashSet<CardMovement> movements = changeManager.getCardMovement();
    for (CardMovement movement : movements) {
      CardZone beginningZone = movement.getBeginningZone();
      CardZone endZone = movement.getEndZone();
      Card card = movement.getCardMoved();

      // System.out.println(card.getName());
      CardPanel cardPanel = getCardPanelForCard(card);
      CardZonePanel beginZonePanel = getCardZonePanelForCardZone(beginningZone);
      CardZonePanel endZonePanel = getCardZonePanelForCardZone(endZone);
      if (cardPanel == null && beginZonePanel == null && endZonePanel == null) {
        // System.out.println("what is goin on");
        // do nothing
      } else if (beginZonePanel == null && endZonePanel == null) {
        // System.out.println("something went completely wrong, but...");
      } else if (cardPanel == null && endZonePanel == null) {
        // System.out.println("went from a zone we know of to zone we don't, but the card wasn't
        // showing in the zone we know before. actually kind of impossible, but too late for us to
        // do anything");
      } else if (cardPanel == null && beginZonePanel == null) {
        // System.out.println("came to a zone we know from an unknown zone!!!! looks like meat's
        // back on the menu, boys!!!!!");
        // came to a zone we know from an unknown zone!!!! looks like meat's back on the menu,
        // boys!!!!!
        endZonePanel.addCardPanel(new CardPanel(card));
      } else if (cardPanel == null) {
        // System.out.println("well, it should have been showing before, but I guess better late
        // than never!");
        endZonePanel.addCardPanel(new CardPanel(card));
      } else if (beginZonePanel == null) {
        // System.out.println("this also shouldn't have happened, very weird.");
        endZonePanel.addCardPanel(cardPanel);
      } else if (endZonePanel == null) {
        // System.out.println("hey there");
        // the card is exiting the realm of displayed cardzones. Bon voyage!
        beginZonePanel.removeCardPanel(cardPanel);
      } else {
        // we're displaying every piece involved in this move!!!!! nice!!!
        beginZonePanel.removeCardPanel(cardPanel);
        endZonePanel.addCardPanel(cardPanel);
      }
    }
    refreshCardPanels();
    // ayayay java needs me to repaint otherwise it waits forever
    repaint();
  }
コード例 #2
0
ファイル: GameTest.java プロジェクト: s6308/ProjectMPR1
 @Test
 public void testSetPlatform() {
   Test.setPlatform("platform3");
   assertEquals(Test.getPlatform(), "platform3");
 }
コード例 #3
0
ファイル: GameTest.java プロジェクト: s6308/ProjectMPR1
 @Test
 public void testGetPlatform() {
   assertSame(Test.getPlatform(), "platform1");
 }
コード例 #4
0
ファイル: GameTest.java プロジェクト: s6308/ProjectMPR1
 @Test
 public void testSetTitle() {
   Test.setTitle("game3");
   assertTrue(Test.getTitle().equals("game3"));
 }
コード例 #5
0
ファイル: GameTest.java プロジェクト: s6308/ProjectMPR1
 @Test
 public void testGetTitle() {
   assertSame(Test.getTitle(), "game1");
 }
コード例 #6
0
ファイル: GameTest.java プロジェクト: s6308/ProjectMPR1
 @Test
 public void testGame() {
   assertTrue(Test.getTitle().equals("game1"));
   assertEquals(Test.getPlatform(), "platform1");
 }