fix list item options not saving

This commit is contained in:
yugecin 2016-11-13 00:43:29 +01:00
parent 7ae70c7c16
commit e853abcd9f
2 changed files with 4 additions and 3 deletions

View File

@ -146,6 +146,7 @@ public class OptionsOverlay {
@Override @Override
public void update(Observable o, Object arg) { public void update(Observable o, Object arg) {
option.clickListItem((int) arg); option.clickListItem((int) arg);
overlay.saveOption(option);
} }
}); });
list.show(); list.show();
@ -183,7 +184,7 @@ public class OptionsOverlay {
public boolean mouseReleased(int button, int x, int y) { public boolean mouseReleased(int button, int x, int y) {
if (selectedOption != null) { if (selectedOption != null) {
overlay.saveOption(selectedOption, selectedOption.write()); overlay.saveOption(selectedOption);
} }
selectedOption = null; selectedOption = null;
if (list.isVisible()) { if (list.isVisible()) {

View File

@ -163,11 +163,11 @@ public class SBOverlay {
this.gameObjects = gameObjects; this.gameObjects = gameObjects;
} }
public void saveOption(Options.GameOption option, String value) { public void saveOption(Options.GameOption option) {
if (optionsMap[index] == null) { if (optionsMap[index] == null) {
optionsMap[index] = new HashMap<>(); optionsMap[index] = new HashMap<>();
} }
optionsMap[index].put(option, value); optionsMap[index].put(option, option.write());
} }
public boolean mousePressed(int button, int x, int y) { public boolean mousePressed(int button, int x, int y) {