use of org.terasology.engine.rendering.nui.animation.SwipeMenuAnimationSystem in project Terasology by MovingBlocks.
the class ConsoleScreen method initialise.
@Override
public void initialise() {
setAnimationSystem(new SwipeMenuAnimationSystem(0.2f, Direction.TOP_TO_BOTTOM));
final ScrollableArea scrollArea = find("scrollArea", ScrollableArea.class);
scrollArea.moveToBottom();
commandLine = find("commandLine", UICommandEntry.class);
getManager().setFocus(commandLine);
commandLine.setTabCompletionEngine(new CyclingTabCompletionEngine(console, localPlayer));
commandLine.bindCommandHistory(new ReadOnlyBinding<List<String>>() {
@Override
public List<String> get() {
return console.getPreviousCommands();
}
});
commandLine.subscribe(widget -> {
String text = commandLine.getText();
if (StringUtils.isNotBlank(text)) {
console.execute(text, localPlayer.getClientEntity());
}
scrollArea.moveToBottom();
});
final UIText history = find("messageHistory", UIText.class);
history.bindText(new ReadOnlyBinding<String>() {
@Override
public String get() {
StringBuilder messageList = new StringBuilder();
for (Message message : console.getMessages()) {
messageList.append(FontColor.getColored(message.getMessage(), message.getType().getColor()));
if (message.hasNewLine()) {
messageList.append(Console.NEW_LINE);
}
}
return messageList.toString();
}
});
}
Aggregations