Search in sources :

Example 1 with LaunchPopup

use of org.terasology.engine.rendering.nui.layers.mainMenu.LaunchPopup in project Terasology by MovingBlocks.

the class StateMainMenu method pushLaunchPopup.

private void pushLaunchPopup() {
    Config config = context.get(Config.class);
    TelemetryConfig telemetryConfig = config.getTelemetryConfig();
    TranslationSystem translationSystem = context.get(TranslationSystem.class);
    TelemetryLogstashAppender appender = TelemetryUtils.fetchTelemetryLogstashAppender();
    if (!telemetryConfig.isLaunchPopupDisabled()) {
        String telemetryTitle = translationSystem.translate("${engine:menu#telemetry-launch-popup-title}");
        String telemetryMessage = translationSystem.translate("${engine:menu#telemetry-launch-popup-text}");
        LaunchPopup telemetryConfirmPopup = nuiManager.pushScreen(LaunchPopup.ASSET_URI, LaunchPopup.class);
        telemetryConfirmPopup.setMessage(telemetryTitle, telemetryMessage);
        telemetryConfirmPopup.setYesHandler(() -> {
            telemetryConfig.setTelemetryAndErrorReportingEnable(true);
            // Enable error reporting
            appender.start();
        });
        telemetryConfirmPopup.setNoHandler(() -> {
            telemetryConfig.setTelemetryAndErrorReportingEnable(false);
            // Disable error reporting
            appender.stop();
        });
        telemetryConfirmPopup.setOptionButtonText(translationSystem.translate("${engine:menu#telemetry-button}"));
        telemetryConfirmPopup.setOptionHandler(() -> {
            nuiManager.pushScreen(TelemetryScreen.ASSET_URI, TelemetryScreen.class);
        });
    }
}
Also used : TranslationSystem(org.terasology.engine.i18n.TranslationSystem) LaunchPopup(org.terasology.engine.rendering.nui.layers.mainMenu.LaunchPopup) Config(org.terasology.engine.config.Config) TelemetryConfig(org.terasology.engine.config.TelemetryConfig) TelemetryLogstashAppender(org.terasology.engine.telemetry.logstash.TelemetryLogstashAppender) TelemetryConfig(org.terasology.engine.config.TelemetryConfig)

Aggregations

Config (org.terasology.engine.config.Config)1 TelemetryConfig (org.terasology.engine.config.TelemetryConfig)1 TranslationSystem (org.terasology.engine.i18n.TranslationSystem)1 LaunchPopup (org.terasology.engine.rendering.nui.layers.mainMenu.LaunchPopup)1 TelemetryLogstashAppender (org.terasology.engine.telemetry.logstash.TelemetryLogstashAppender)1