コード例 #1
0
 public void incrementBonus(final AptitudeBonusView bonus) {
   if (!bonus.canBeIncreased()) {
     return;
   }
   this.m_inventory.addLevel(bonus.getId(), (short) 1);
   this.m_inventory.removePointsFor(bonus.getId(), (short) 1);
   this.m_modifications.adjustOrPutValue(bonus.getId(), (short) 1, (short) 1);
   bonus.fireLevelChanged();
   final AptitudeBonusCategoryView category =
       this.m_categoriesById.get(
           AptitudeCategoryModelManager.INSTANCE.getBonusCategoryId(bonus.getId()));
   category.fireAvailablePointsChanged();
 }
コード例 #2
0
 public void decrementBonus(final AptitudeBonusView bonus) {
   if (!bonus.canBeDecreased()) {
     return;
   }
   final int categoryId = AptitudeCategoryModelManager.INSTANCE.getBonusCategoryId(bonus.getId());
   this.m_inventory.addLevel(bonus.getId(), (short) (-1));
   this.m_inventory.incPointFor(categoryId);
   final short previousValue = this.m_modifications.get(bonus.getId());
   if (previousValue == 1) {
     this.m_modifications.remove(bonus.getId());
   } else {
     this.m_modifications.put(bonus.getId(), (short) (previousValue - 1));
   }
   bonus.fireLevelChanged();
   final AptitudeBonusCategoryView category = this.m_categoriesById.get(categoryId);
   category.fireAvailablePointsChanged();
 }