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(); }
public static void quit() { mbg.queryQuit(); }