Esempio n. 1
0
  private static void updateBoard() {
    for (int ii = 0; ii < numOfPlayers; ii++) {
      SimpleResList list = new SimpleResList(boards[ii].getResourceList());
      list.subtract(resList[ii]);
      for (int i = 1; i < 8; i++) {
        for (int j = 0; j < list.numAt(i); j++) wonder[ii].addResource(i);
      }
      resList[ii] = boards[ii].getResourceList();

      // ArrayList<SimpleResList> or = new
      // ArrayList<SimpleResList>(boards[ii].getOrList());
      // if(orList[ii] != null)
      // or.removeAll(orList[ii]);
      ArrayList<SimpleResList> or = boards[ii].getOrList();
      for (int i = orListNum[ii]; i < or.size(); i++) {
        // JOptionPane.showMessageDialog(null, or.get(i));
        SimpleResList oneOrList = or.get(i);
        int kind;
        if (oneOrList.numAt(1) == 1 && oneOrList.numAt(4) == 1 && oneOrList.numAt(2) == 0) kind = 8;
        else if (oneOrList.numAt(1) == 1 && oneOrList.numAt(3) == 1 && oneOrList.numAt(2) == 0)
          kind = 9;
        else if (oneOrList.numAt(1) == 1 && oneOrList.numAt(2) == 1 && oneOrList.numAt(3) == 0)
          kind = 10;
        else if (oneOrList.numAt(3) == 1 && oneOrList.numAt(4) == 1 && oneOrList.numAt(2) == 0)
          kind = 11;
        else if (oneOrList.numAt(2) == 1 && oneOrList.numAt(4) == 1 && oneOrList.numAt(3) == 0)
          kind = 12;
        else if (oneOrList.numAt(2) == 1 && oneOrList.numAt(3) == 1 && oneOrList.numAt(1) == 0)
          kind = 13;
        else if (oneOrList.numAt(5) == 1 && oneOrList.numAt(6) == 1 && oneOrList.numAt(7) == 1)
          kind = 14;
        else if (oneOrList.numAt(1) == 1
            && oneOrList.numAt(2) == 1
            && oneOrList.numAt(3) == 1
            && oneOrList.numAt(4) == 1) kind = 15;
        else continue;
        wonder[ii].addResource(kind);
        orListNum[ii]++;
      }
      // SimpleResList or = new SimpleResList(sl)
      // if(ii == 0)
      // JOptionPane.showMessageDialog(null,
      // boards[ii].getTotalCoins()+":" + coins[ii]);
      wonder[ii].addGoldSign(boards[ii].getTotalCoins() - coins[ii]);
      coins[ii] = boards[ii].getTotalCoins();

      if (boards[ii].getStagesCompleted() > wonder[ii].getHasbuild()) {
        wonder[ii].stageCompleted(age);
      }

      // wonder[ii].toFront();// Must be wrong, but must be here!
      MainBackGround.order();
    }
    cardBoard.toFront();
    playerBoard.toFront();
  }
Esempio n. 2
0
 /**
  * Adjusts the visualization to reflect the fisheye state of the node. If the node is in fisheye
  * state, its label will be reduced to the first letter.
  *
  * @param visual The visual of this {@link NodeContentPart}.
  * @param attrs The attributes map that stores the fisheye state of this {@link NodeContentPart}.
  * @param str The label of this {@link NodeContentPart}.
  * @return The adjusted label for this {@link NodeContentPart}.
  */
 protected String refreshFisheye(Group visual, Map<String, Object> attrs, String str) {
   // limit label to first letter when in fisheye mode (and not hovered)
   Object fisheye = attrs.get(ZestProperties.NODE_FISHEYE);
   if (fisheye instanceof Boolean && (Boolean) fisheye) {
     // register mouse event listeners
     visual.addEventHandler(MouseEvent.ANY, mouseHandler);
     if (!visual.isHover()) {
       // limit label to first letter
       // TODO: hide image, hide children/graph icon
       str = str.substring(0, 1);
       restoreZOrder();
     } else {
       if (originalBounds == null) {
         originalBounds = visual.localToScene(visual.getLayoutBounds());
       }
       // TODO: show image, show children/graph icon
       // highlight this node by moving it to the front
       List<IVisualPart<Node, ? extends Node>> children = getParent().getChildren();
       originalIndex = children.indexOf(this); // restore later
       getParent().reorderChild(this, children.size() - 1);
       visual.toFront();
     }
   } else {
     // TODO: show image, show children/graph icon
     restoreZOrder();
     visual.removeEventHandler(MouseEvent.ANY, mouseHandler);
   }
   return str;
 }