"...scala/de/tobias/playpad/server/plugin/PluginRawGet.scala" did not exist on "0e5d0ded50693c036c7bed12efb778794269aff4"
Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package de.bricked.ui;
import java.io.IOException;
import java.util.Locale;
import java.util.ResourceBundle;
import de.bricked.game.Game;
import de.bricked.game.settings.GameSize;
import de.bricked.ui.cells.ComboBoxLanguageCell;
import de.bricked.ui.cells.ComboBoxResolutionCell;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.Slider;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import javafx.util.Callback;
import logger.LogLevel;
import logger.Logger;
public class SettingsController
{
@FXML private AnchorPane mainPane;
@FXML private Label labelLevelPack;
@FXML private Button buttonBack;
@FXML private Button buttonSave;
@FXML private ComboBox<GameSize> comboBoxResolution;
@FXML private ComboBox<LanguageType> comboBoxLanguage;
@FXML private CheckBox checkBoxSound;
@FXML private Slider sliderVolume;
public Stage stage;
public Image icon = new Image("de/bricked/resources/icon.png");
public final ResourceBundle bundle = ResourceBundle.getBundle("de/bricked/main/", Locale.GERMANY);
public Controller controller;
public Game game;
public void init(Stage stage, Controller controller, Game game)
{
this.stage = stage;
this.controller = controller;
this.game = game;
comboBoxResolution.setCellFactory(new Callback<ListView<GameSize>, ListCell<GameSize>>()
{
@Override
public ListCell<GameSize> call(ListView<GameSize> param)
{
return new ComboBoxResolutionCell();
}
});
comboBoxResolution.setButtonCell(new ComboBoxResolutionCell());
comboBoxResolution.getItems().addAll(GameSize.values());
comboBoxLanguage.setCellFactory(new Callback<ListView<LanguageType>, ListCell<LanguageType>>()
{
@Override
public ListCell<LanguageType> call(ListView<LanguageType> param)
{
return new ComboBoxLanguageCell();
}
});
comboBoxLanguage.setButtonCell(new ComboBoxLanguageCell());
comboBoxLanguage.getItems().addAll(LanguageType.values());
checkBoxSound.selectedProperty().addListener(new ChangeListener<Boolean>()
{
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue)
{
if(newValue == true)
{
sliderVolume.setDisable(false);
}
else
{
sliderVolume.setDisable(true);
}
}
});
//preselect
comboBoxResolution.setValue(game.getSettings().getGameSize());
comboBoxLanguage.setValue(game.getSettings().getLanguage());
if(game.getSettings().isMuted())
{
checkBoxSound.setSelected(false);
sliderVolume.setDisable(true);
}
else
{
checkBoxSound.setSelected(true);
sliderVolume.setDisable(false);
}
sliderVolume.setValue(game.getSettings().getVolume() * 100);
mainPane.setStyle("-fx-base: " + bundle.getString("color.background") + ";");
}
public void save()
{
game.getSettings().setGameSize(comboBoxResolution.getValue());
game.getSettings().setLanguage(comboBoxLanguage.getValue());
game.getSettings().setMuted(!checkBoxSound.isSelected());
game.getSettings().setVolume(sliderVolume.getValue() / 100.0);
game.getSettings().save();
game.refreshSoundHandler();
stage.close();
controller.stage.show();
//TODO load correct language file
}
public void back()
{
stage.close();
controller.stage.show();
}
public void showCommandLine()
{
try
{
controller.getCommandLine().showCommandLine("Debug Console", 400, 250, 400, 200, -1, -1, true);
}
catch(IOException e)
{
// TODO: errorhandling
Logger.log(LogLevel.ERROR, Logger.exceptionToString(e));
}
}
}