use of pcgen.core.UnitSet in project pcgen by PCGen.
the class GameModeFileLoader method getDefaultUnitSet.
private static synchronized UnitSet getDefaultUnitSet() {
if (DEFAULT_UNIT_SET == null) {
// create default Unit Set in case none is specified in the game mode
DEFAULT_UNIT_SET = new UnitSet();
DEFAULT_UNIT_SET.setName(Constants.STANDARD_UNITSET_NAME);
DEFAULT_UNIT_SET.setInternal(true);
DEFAULT_UNIT_SET.setHeightUnit(Constants.STANDARD_UNITSET_HEIGHT_UNIT);
DEFAULT_UNIT_SET.setHeightFactor(Constants.STANDARD_UNITSET_HEIGHT_FACTOR);
DEFAULT_UNIT_SET.setHeightDisplayPattern(Constants.STANDARD_UNITSET_HEIGHT_DISPLAY_PATTERN);
DEFAULT_UNIT_SET.setDistanceUnit(Constants.STANDARD_UNITSET_DISTANCE_UNIT);
DEFAULT_UNIT_SET.setDistanceFactor(Constants.STANDARD_UNITSET_DISTANCE_FACTOR);
DEFAULT_UNIT_SET.setDistanceDisplayPattern(Constants.STANDARD_UNITSET_DISTANCE_DISPLAY_PATTERN);
DEFAULT_UNIT_SET.setWeightUnit(Constants.STANDARD_UNITSET_WEIGHT_UNIT);
DEFAULT_UNIT_SET.setWeightFactor(Constants.STANDARD_UNITSET_WEIGHT_FACTOR);
DEFAULT_UNIT_SET.setWeightDisplayPattern(Constants.STANDARD_UNITSET_WEIGHT_DISPLAY_PATTERN);
}
return DEFAULT_UNIT_SET;
}
use of pcgen.core.UnitSet in project pcgen by PCGen.
the class GameModeFileLoader method addDefaultUnitSet.
public static void addDefaultUnitSet(GameMode gameMode) {
LoadContext context = gameMode.getModeContext();
UnitSet us = context.getReferenceContext().silentlyGetConstructedCDOMObject(UnitSet.class, Constants.STANDARD_UNITSET_NAME);
if (us == null) {
gameMode.getModeContext().getReferenceContext().importObject(getDefaultUnitSet());
}
}
use of pcgen.core.UnitSet in project pcgen by PCGen.
the class VisionTokenTest method setUp.
/*
* @see TestCase#setUp()
*/
@Override
protected void setUp() throws Exception {
super.setUp();
final GenericLoader<PCTemplate> loader = new GenericLoader<>(PCTemplate.class);
final LoadContext context = Globals.getContext();
CampaignSourceEntry source;
try {
source = new CampaignSourceEntry(new Campaign(), new URI("file:/" + getClass().getName() + ".java"));
} catch (URISyntaxException e) {
throw new UnreachableError(e);
}
loader.parseLine(context, null, "Darkvision VISION:Darkvision (60')", source);
darkvisionT = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCTemplate.class, "Darkvision");
loader.parseLine(context, null, "Low-light VISION:Low-light", source);
lowlightT = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCTemplate.class, "Low-light");
loader.parseLine(context, null, "Astral VISION:Astral (130')", source);
astralT = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCTemplate.class, "Astral");
assertTrue(context.getReferenceContext().resolveReferences(null));
metricUS = new UnitSet();
metricUS.setName("Metric");
metricUS.setDistanceUnit("m");
metricUS.setDistanceFactor(new BigDecimal(0.3));
metricUS.setDistanceDisplayPattern(new DecimalFormat("#.##"));
SettingsHandler.getGame().getModeContext().getReferenceContext().importObject(metricUS);
}
Aggregations