コード例 #1
0
 private float encodeTraitGroup(
     SheetGraphics graphics,
     FavorableTraitContent content,
     IIdentifiedTraitTypeGroup group,
     Position position,
     float width) {
   float height = 0;
   float groupLabelWidth =
       IVoidStateFormatConstants.LINE_HEIGHT + IVoidStateFormatConstants.TEXT_PADDING;
   float traitX = position.x + groupLabelWidth;
   ITraitType[] traitTypes = group.getAllGroupTypes();
   float groupLabelX = position.x + 4;
   float markerX = groupLabelX + IVoidStateFormatConstants.TEXT_PADDING;
   for (int index = 0; index < traitTypes.length; index++) {
     ITraitType traitType = traitTypes[index];
     float yPosition = position.y - (index + 1) * traitEncoder.getTraitHeight();
     if (content.getMarkedTraitTypes().contains(traitType)) {
       encodeMarker(graphics, new Position(markerX, yPosition + 1));
     }
     IGenericTraitCollection traitCollection = content.getTraitCollection();
     IFavorableGenericTrait trait = traitCollection.getFavorableTrait(traitType);
     String label = content.getTraitLabel(traitType);
     if (content.shouldShowExcellencies()) {
       boolean[] excellencyLearned = content.hasExcellenciesLearned(traitType);
       height +=
           encodeFavorableTrait(
               graphics,
               content,
               label,
               trait,
               excellencyLearned,
               new Position(traitX, yPosition),
               width - groupLabelWidth);
     } else {
       height +=
           encodeFavorableTrait(
               graphics,
               content,
               label,
               trait,
               new Position(traitX, yPosition),
               width - groupLabelWidth);
     }
   }
   Position groupLabelPosition = new Position(groupLabelX, position.y - height / 2f);
   addGroupLabel(graphics, content, group, groupLabelPosition);
   return height;
 }