mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
cleanup
This commit is contained in:
@@ -118,12 +118,7 @@ public class SettingsScene extends UIScene {
|
||||
|
||||
private void addSettingField(String name, int value, ChangeListener change) {
|
||||
TextField text = Controls.newTextField(String.valueOf(value));
|
||||
text.setTextFieldFilter(new TextField.TextFieldFilter() {
|
||||
@Override
|
||||
public boolean acceptChar(TextField textField, char c) {
|
||||
return Character.isDigit(c);
|
||||
}
|
||||
});
|
||||
text.setTextFieldFilter((textField, c) -> Character.isDigit(c));
|
||||
text.addListener(change);
|
||||
addLabel(name);
|
||||
settingGroup.add(text).align(Align.right);
|
||||
@@ -145,21 +140,16 @@ public class SettingsScene extends UIScene {
|
||||
Preference = new ForgePreferences();
|
||||
}
|
||||
|
||||
SelectBox plane = Controls.newComboBox(Config.instance().getAllAdventures(), Config.instance().getSettingData().plane, new Function<Object, Void>() {
|
||||
@Override
|
||||
public Void apply(Object o) {
|
||||
SelectBox plane = Controls.newComboBox(Config.instance().getAllAdventures(), Config.instance().getSettingData().plane, o -> {
|
||||
Config.instance().getSettingData().plane = (String) o;
|
||||
Config.instance().saveSettings();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
addLabel(Forge.getLocalizer().getMessage("lblWorld"));
|
||||
settingGroup.add(plane).align(Align.right).pad(2);
|
||||
|
||||
if (!GuiBase.isAndroid()) {
|
||||
SelectBox videomode = Controls.newComboBox(new String[]{"720p", "768p", "900p", "1080p"}, Config.instance().getSettingData().videomode, new Function<Object, Void>() {
|
||||
@Override
|
||||
public Void apply(Object o) {
|
||||
SelectBox videomode = Controls.newComboBox(new String[]{"720p", "768p", "900p", "1080p"}, Config.instance().getSettingData().videomode, o -> {
|
||||
String mode = (String) o;
|
||||
if (mode == null)
|
||||
mode = "720p";
|
||||
@@ -184,64 +174,51 @@ public class SettingsScene extends UIScene {
|
||||
FModel.getPreferences().save();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
addLabel(Forge.getLocalizer().getMessage("lblVideoMode"));
|
||||
settingGroup.add(videomode).align(Align.right).pad(2);
|
||||
}
|
||||
if (Forge.isLandscapeMode()) {
|
||||
//different adjustment to landscape
|
||||
SelectBox rewardCardAdjLandscape = Controls.newComboBox(new Float[]{0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 1f, 1.05f, 1.1f, 1.15f, 1.2f, 1.25f, 1.3f, 1.35f, 1.4f, 1.45f, 1.5f, 1.55f, 1.6f}, Config.instance().getSettingData().rewardCardAdjLandscape, new Function<Object, Void>() {
|
||||
@Override
|
||||
public Void apply(Object o) {
|
||||
SelectBox rewardCardAdjLandscape = Controls.newComboBox(new Float[]{0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 1f, 1.05f, 1.1f, 1.15f, 1.2f, 1.25f, 1.3f, 1.35f, 1.4f, 1.45f, 1.5f, 1.55f, 1.6f}, Config.instance().getSettingData().rewardCardAdjLandscape, o -> {
|
||||
Float val = (Float) o;
|
||||
if (val == null || val == 0f)
|
||||
val = 1f;
|
||||
Config.instance().getSettingData().rewardCardAdjLandscape = val;
|
||||
Config.instance().saveSettings();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
addLabel("Reward/Shop Card Display Ratio");
|
||||
settingGroup.add(rewardCardAdjLandscape).align(Align.right).pad(2);
|
||||
SelectBox tooltipAdjLandscape = Controls.newComboBox(new Float[]{0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 1f, 1.05f, 1.1f, 1.15f, 1.2f, 1.25f, 1.3f, 1.35f, 1.4f, 1.45f, 1.5f, 1.55f, 1.6f}, Config.instance().getSettingData().cardTooltipAdjLandscape, new Function<Object, Void>() {
|
||||
@Override
|
||||
public Void apply(Object o) {
|
||||
SelectBox tooltipAdjLandscape = Controls.newComboBox(new Float[]{0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 1f, 1.05f, 1.1f, 1.15f, 1.2f, 1.25f, 1.3f, 1.35f, 1.4f, 1.45f, 1.5f, 1.55f, 1.6f}, Config.instance().getSettingData().cardTooltipAdjLandscape, o -> {
|
||||
Float val = (Float) o;
|
||||
if (val == null || val == 0f)
|
||||
val = 1f;
|
||||
Config.instance().getSettingData().cardTooltipAdjLandscape = val;
|
||||
Config.instance().saveSettings();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
addLabel("Reward/Shop Card Tooltip Ratio");
|
||||
settingGroup.add(tooltipAdjLandscape).align(Align.right).pad(2);
|
||||
} else {
|
||||
//portrait adjustment
|
||||
SelectBox rewardCardAdj = Controls.newComboBox(new Float[]{0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.8f, 1.9f, 2f}, Config.instance().getSettingData().rewardCardAdj, new Function<Object, Void>() {
|
||||
@Override
|
||||
public Void apply(Object o) {
|
||||
SelectBox rewardCardAdj = Controls.newComboBox(new Float[]{0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.8f, 1.9f, 2f}, Config.instance().getSettingData().rewardCardAdj, o -> {
|
||||
Float val = (Float) o;
|
||||
if (val == null || val == 0f)
|
||||
val = 1f;
|
||||
Config.instance().getSettingData().rewardCardAdj = val;
|
||||
Config.instance().saveSettings();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
addLabel("Reward/Shop Card Display Ratio");
|
||||
settingGroup.add(rewardCardAdj).align(Align.right).pad(2);
|
||||
SelectBox tooltipAdj = Controls.newComboBox(new Float[]{0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.8f, 1.9f, 2f}, Config.instance().getSettingData().cardTooltipAdj, new Function<Object, Void>() {
|
||||
@Override
|
||||
public Void apply(Object o) {
|
||||
SelectBox tooltipAdj = Controls.newComboBox(new Float[]{0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.8f, 1.9f, 2f}, Config.instance().getSettingData().cardTooltipAdj, o -> {
|
||||
Float val = (Float) o;
|
||||
if (val == null || val == 0f)
|
||||
val = 1f;
|
||||
Config.instance().getSettingData().cardTooltipAdj = val;
|
||||
Config.instance().saveSettings();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
addLabel("Reward/Shop Card Tooltip Ratio");
|
||||
settingGroup.add(tooltipAdj).align(Align.right).pad(2);
|
||||
@@ -290,12 +267,7 @@ public class SettingsScene extends UIScene {
|
||||
settingGroup.row();
|
||||
back = ui.findActor("return");
|
||||
back.getLabel().setText(Forge.getLocalizer().getMessage("lblBack"));
|
||||
ui.onButtonPress("return", new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SettingsScene.this.back();
|
||||
}
|
||||
});
|
||||
ui.onButtonPress("return", () -> SettingsScene.this.back());
|
||||
|
||||
ScrollPane scrollPane = ui.findActor("settings");
|
||||
scrollPane.setActor(settingGroup);
|
||||
|
||||
Reference in New Issue
Block a user