Search in sources :

Example 1 with AutoConfig

use of org.terasology.engine.config.flexible.AutoConfig in project Terasology by MovingBlocks.

the class AutoConfigScreen method initialise.

@Override
public void initialise() {
    mainContainer = find("mainContainer", ColumnLayout.class);
    assert mainContainer != null;
    for (AutoConfig config : configManager.getLoadedConfigs()) {
        Binding<AutoConfig> configBinding = new DefaultBinding<>(config);
        Optional<UIWidget> widget = typeWidgetLibrary.getWidget(configBinding, AutoConfig.class);
        if (widget.isPresent()) {
            mainContainer.addWidget(widget.get());
        } else {
            logger.warn("Cannot create widget for config: {}", config.getId());
        }
    }
    WidgetUtil.trySubscribe(this, "close", button -> triggerBackAnimation());
}
Also used : DefaultBinding(org.terasology.nui.databinding.DefaultBinding) ColumnLayout(org.terasology.nui.layouts.ColumnLayout) AutoConfig(org.terasology.engine.config.flexible.AutoConfig) UIWidget(org.terasology.nui.UIWidget)

Aggregations

AutoConfig (org.terasology.engine.config.flexible.AutoConfig)1 UIWidget (org.terasology.nui.UIWidget)1 DefaultBinding (org.terasology.nui.databinding.DefaultBinding)1 ColumnLayout (org.terasology.nui.layouts.ColumnLayout)1