Search in sources :

Example 1 with MapSize

use of com.faforever.client.map.MapSize in project downlords-faf-client by FAForever.

the class CreateGameController method setSelectedMap.

private void setSelectedMap(MapBean newValue) {
    JavaFxUtil.assertApplicationThread();
    if (newValue == null) {
        mapNameLabel.setText("");
        return;
    }
    preferencesService.getPreferences().setLastMap(newValue.getFolderName());
    preferencesService.storeInBackground();
    Image largePreview = mapService.loadPreview(newValue.getFolderName(), PreviewSize.LARGE);
    mapPreviewPane.setBackground(new Background(new BackgroundImage(largePreview, NO_REPEAT, NO_REPEAT, CENTER, new BackgroundSize(BackgroundSize.AUTO, BackgroundSize.AUTO, false, false, true, false))));
    MapSize mapSize = newValue.getSize();
    mapSizeLabel.setText(i18n.get("mapPreview.size", mapSize.getWidthInPixels(), mapSize.getHeightInPixels()));
    mapNameLabel.setText(newValue.getDisplayName());
    mapPlayersLabel.setText(i18n.number(newValue.getPlayers()));
    mapDescriptionLabel.setText(Optional.ofNullable(newValue.getDescription()).map(Strings::emptyToNull).map(FaStrings::removeLocalizationTag).orElseGet(() -> i18n.get("map.noDescriptionAvailable")));
    versionLabel.setText(newValue.getVersion().toString());
}
Also used : FaStrings(com.faforever.client.fa.FaStrings) BackgroundImage(javafx.scene.layout.BackgroundImage) BackgroundSize(javafx.scene.layout.BackgroundSize) Background(javafx.scene.layout.Background) MapSize(com.faforever.client.map.MapSize) BackgroundImage(javafx.scene.layout.BackgroundImage) Image(javafx.scene.image.Image)

Aggregations

FaStrings (com.faforever.client.fa.FaStrings)1 MapSize (com.faforever.client.map.MapSize)1 Image (javafx.scene.image.Image)1 Background (javafx.scene.layout.Background)1 BackgroundImage (javafx.scene.layout.BackgroundImage)1 BackgroundSize (javafx.scene.layout.BackgroundSize)1