コード例 #1
0
  @Override
  public final void saveAmount(int energy, int food, int smithore, int crystite) {
    if (record == null) {
      populateRecord();
    }

    record.setEnergy(energy);
    record.setFood(food);
    record.setSmithore(smithore);
    record.setCrystite(crystite);

    persist();
  }
コード例 #2
0
  @Override
  public final void savePrice(
      int energyPrice, int foodPrice, int smithorePrice, int crystitePrice) {
    if (record == null) {
      populateRecord();
    }

    record.setEnergyPrice(energyPrice);
    record.setFoodPrice(foodPrice);
    record.setSmithorePrice(smithorePrice);
    record.setCrystitePrice(crystitePrice);

    persist();
  }
コード例 #3
0
  @Override
  public final void setMuleCount(int muleCount) {
    if (record == null) {
      populateRecord();
    }

    record.setMuleCount(muleCount);

    persist();
  }
コード例 #4
0
  private void populateRecord() {
    Session session = sessionFactory.openSession();

    String hqlString =
        String.format(
            "FROM StoreRecord SR WHERE SR.gameSaveMeta.id = %d",
            gameSaveMetaHolder.getGameSaveMeta().getId());
    Query query = session.createQuery(hqlString);

    List<data.concretesources.StoreRecord> list = query.list();
    if (list == null || list.size() < 1) {
      record = new data.concretesources.StoreRecord();

      record.setGameSaveMeta(gameSaveMetaHolder.getGameSaveMeta());

    } else {
      record = list.get(0);
    }
    session.close();
  }
コード例 #5
0
  @Override
  public final int getFood() {
    populateRecord();

    return record.getFood();
  }
コード例 #6
0
  @Override
  public final int getMuleCount() {
    populateRecord();

    return record.getMuleCount();
  }
コード例 #7
0
  @Override
  public final int getCrystitePrice() {
    populateRecord();

    return record.getCrystitePrice();
  }
コード例 #8
0
  @Override
  public final int getSmithorePrice() {
    populateRecord();

    return record.getSmithorePrice();
  }
コード例 #9
0
  @Override
  public final int getEnergyPrice() {
    populateRecord();

    return record.getEnergyPrice();
  }