use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.
the class RenderTaskListGeneratorTest method testReducePersistingStateChangesEcho.
@Test
public void testReducePersistingStateChangesEcho() {
RenderTaskListGenerator renderTaskListGenerator = new RenderTaskListGenerator();
List<Node> orderedNodes = Lists.newArrayList();
Node alphaNode = new AlphaNode();
alphaNode.setUri(new SimpleUri("engine:alphaNode"));
orderedNodes.add(alphaNode);
Node bravoNode = new BravoNode();
bravoNode.setUri(new SimpleUri("engine:bravoNode"));
orderedNodes.add(bravoNode);
Node echoNode = new EchoNode();
echoNode.setUri(new SimpleUri("engine:echoNode"));
orderedNodes.add(echoNode);
Node charlieNode = new CharlieNode();
charlieNode.setUri(new SimpleUri("engine:charlieNode"));
orderedNodes.add(charlieNode);
Node deltaNode = new DeltaNode();
deltaNode.setUri(new SimpleUri("engine:deltaNode"));
orderedNodes.add(deltaNode);
List<RenderPipelineTask> taskList = renderTaskListGenerator.generateFrom(orderedNodes);
assertEquals("----- engine:alphaNode (AlphaNode)", taskList.get(0).toString().trim());
assertEquals("SetName: foo", taskList.get(1).toString().trim());
assertEquals("engine:alphaNode (AlphaNode)", taskList.get(2).toString().trim());
assertEquals("----- engine:bravoNode (BravoNode)", taskList.get(3).toString().trim());
assertEquals("engine:bravoNode (BravoNode)", taskList.get(4).toString().trim());
assertEquals("----- engine:echoNode (EchoNode)", taskList.get(5).toString().trim());
assertEquals("SetName: bar", taskList.get(6).toString().trim());
assertEquals("engine:echoNode (EchoNode)", taskList.get(7).toString().trim());
assertEquals("----- engine:charlieNode (CharlieNode)", taskList.get(8).toString().trim());
assertEquals("SetName: foo", taskList.get(9).toString().trim());
assertEquals("engine:charlieNode (CharlieNode)", taskList.get(10).toString().trim());
assertEquals("----- engine:deltaNode (DeltaNode)", taskList.get(11).toString().trim());
assertEquals("SetName: delta", taskList.get(12).toString().trim());
assertEquals("engine:deltaNode (DeltaNode)", taskList.get(13).toString().trim());
assertEquals("SetName: bar", taskList.get(14).toString().trim());
}
use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.
the class RenderTaskListGeneratorTest method testSimpleReducePersistingStateChanges.
@Test
public void testSimpleReducePersistingStateChanges() {
RenderTaskListGenerator renderTaskListGenerator = new RenderTaskListGenerator();
List<Node> orderedNodes = Lists.newArrayList();
Node alphaNode = new AlphaNode();
alphaNode.setUri(new SimpleUri("engine:alphaNode"));
orderedNodes.add(alphaNode);
Node bravoNode = new BravoNode();
bravoNode.setUri(new SimpleUri("engine:bravoNode"));
orderedNodes.add(bravoNode);
Node charlieNode = new CharlieNode();
charlieNode.setUri(new SimpleUri("engine:charlieNode"));
orderedNodes.add(charlieNode);
List<RenderPipelineTask> taskList = renderTaskListGenerator.generateFrom(orderedNodes);
// Strictly speaking we don't need
assertEquals("----- engine:alphaNode (AlphaNode)", taskList.get(0).toString().trim());
// trimming MarkerTask.toString(),
assertEquals("SetName: foo", taskList.get(1).toString().trim());
// resulting in "----- <NodeName>"
assertEquals("engine:alphaNode (AlphaNode)", taskList.get(2).toString().trim());
// We just do it to avoid attracting
assertEquals("----- engine:bravoNode (BravoNode)", taskList.get(3).toString().trim());
// too much attention to it.
assertEquals("engine:bravoNode (BravoNode)", taskList.get(4).toString().trim());
assertEquals("----- engine:charlieNode (CharlieNode)", taskList.get(5).toString().trim());
assertEquals("engine:charlieNode (CharlieNode)", taskList.get(6).toString().trim());
assertEquals("SetName: bar", taskList.get(7).toString().trim());
}
use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.
the class CoreCommands method setLanguage.
/**
* Change the UI language
* @param langTag String containing language code to change
* @return String containing language or if not recognized error message
*/
@Command(shortDescription = "Changes the UI language")
public String setLanguage(@CommandParam("language-tag") String langTag) {
Locale locale = Locale.forLanguageTag(langTag);
TranslationProject proj = translationSystem.getProject(new SimpleUri("engine:menu"));
// Try if language exists
if (proj.getAvailableLocales().contains(locale)) {
config.getSystem().setLocale(locale);
nuiManager.invalidate();
String nat = translationSystem.translate("${engine:menu#this-language-native}", locale);
String eng = translationSystem.translate("${engine:menu#this-language-English}", locale);
return String.format("Language set to %s (%s)", nat, eng);
} else {
return "Unrecognized locale! Try one of: " + proj.getAvailableLocales();
}
}
use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.
the class LocalPlayerSystem method stopAutoMove.
/**
* Auto move is disabled when the associated key is pressed again.
* This cancels the simulated repeated key stroke for the forward input button.
*/
private void stopAutoMove() {
List<Input> inputs = bindsManager.getBindsConfig().getBinds(new SimpleUri("engine:forwards"));
Input forwardKey = getValidKey(inputs);
if (forwardKey != null) {
inputSystem.cancelSimulatedKeyStroke(forwardKey);
isAutoMove = false;
}
}
use of org.terasology.engine.SimpleUri in project Terasology by MovingBlocks.
the class PojoEventSystemTests method testChildEventReceivedByUnfilteredHandler.
@Test
public void testChildEventReceivedByUnfilteredHandler() {
entity.addComponent(new IntegerComponent());
TestEventHandler handler = new TestEventHandler();
eventSystem.registerEvent(new SimpleUri("test:childEvent"), TestChildEvent.class);
eventSystem.registerEventHandler(handler);
TestChildEvent event = new TestChildEvent();
eventSystem.send(entity, event);
assertEquals(1, handler.unfilteredEvents.size());
}
Aggregations