Example #1
0
    @Override
    protected void layout() {

      super.layout();

      shield.x = x;
      shield.y = y + (height - shield.height) / 2;

      position.x = align(shield.x + (shield.width - position.width()) / 2);
      position.y = align(shield.y + (shield.height - position.height()) / 2 + 1);

      if (flare != null) {
        flare.point(shield.center());
      }

      classIcon.x = align(x + width - classIcon.width);
      classIcon.y = shield.y;

      level.x = align(classIcon.x + (classIcon.width - level.width()) / 2);
      level.y = align(classIcon.y + (classIcon.height - level.height()) / 2 + 1);

      steps.x = align(x + width - steps.width - classIcon.width);
      steps.y = shield.y;

      depth.x = align(steps.x + (steps.width - depth.width()) / 2);
      depth.y = align(steps.y + (steps.height - depth.height()) / 2 + 1);

      desc.x = shield.x + shield.width + GAP;
      desc.maxWidth = (int) (steps.x - desc.x);
      desc.measure();
      desc.y = align(shield.y + (shield.height - desc.height()) / 2 + 1);
    }
Example #2
0
    public Record(int pos, boolean latest, Rankings.Record rec) {
      super();

      this.rec = rec;

      if (latest) {
        flare = new Flare(6, 24);
        flare.angularSpeed = 90;
        flare.color(rec.win ? FLARE_WIN : FLARE_LOSE);
        addToBack(flare);
      }

      if (pos != Rankings.TABLE_SIZE - 1) {
        position.text(Integer.toString(pos + 1));
      } else position.text(" ");
      position.measure();

      desc.text(rec.info);

      desc.measure();

      int odd = pos % 2;

      if (rec.win) {
        shield.view(ItemSpriteSheet.AMULET, null);
        position.hardlight(TEXT_WIN[odd]);
        desc.hardlight(TEXT_WIN[odd]);
        depth.hardlight(TEXT_WIN[odd]);
        level.hardlight(TEXT_WIN[odd]);
      } else {
        position.hardlight(TEXT_LOSE[odd]);
        desc.hardlight(TEXT_LOSE[odd]);
        depth.hardlight(TEXT_LOSE[odd]);
        level.hardlight(TEXT_LOSE[odd]);

        if (rec.depth != 0) {
          depth.text(Integer.toString(rec.depth));
          depth.measure();
          steps.copy(Icons.DEPTH_LG.get());

          add(steps);
          add(depth);
        }
      }

      if (rec.herolevel != 0) {
        level.text(Integer.toString(rec.herolevel));
        level.measure();
        add(level);
      }

      classIcon.copy(Icons.get(rec.heroClass));
    }