示例#1
0
  public void updateGame(GameDTO game, List<Participant> players) {
    List<PlayerChampionSelectionDTO> champs = game.getPlayerChampionSelections();
    DefaultListModel model = new DefaultListModel();

    for (Participant id : players) {
      PlayerChampionSelectionDTO infoChamp = null;
      for (PlayerChampionSelectionDTO pc : champs) {
        if (pc.getSummonerInternalName().equals(id.getSummonerInternalName())) {
          infoChamp = pc;
          break;
        }
      }
      if (infoChamp == null) {
        ChampSelection champ = new ChampSelection(id.getSummonerName(), -1, -1, 0);
        model.addElement(champ);
      } else {
        ChampSelection champ = null;
        if (infoChamp.getChampionId() == 0) {
          champ = new ChampSelection(id.getSummonerName(), -1, -1, 0);
        } else {
          champ =
              new ChampSelection(
                  id.getSummonerName(),
                  infoChamp.getSpell1Id(),
                  infoChamp.getSpell2Id(),
                  infoChamp.getChampionId());
        }
        model.addElement(champ);
      }
    }
    list.setModel(model);
  }
示例#2
0
 public Boolean isChampionSelected(GameDTO game, Integer championId) {
   for (PlayerChampionSelectionDTO pl : game.getPlayerChampionSelections()) {
     if (pl.getChampionId().equals(championId)) {
       return Boolean.TRUE;
     }
   }
   return Boolean.FALSE;
 }