use of net.catacombsnatch.game.scene.ReusableAction in project Catacomb-Snatch by Catacomb-Snatch.
the class OptionsScene method init.
public void init(final OptionGroup group) {
if (group != null)
for (String k : group.getKeys()) {
final String key = group.getCurrentPath() + k;
final Object o = group.get(key);
if (o instanceof OptionGroup) {
addTextButton(Language.get("option." + key), 0, 0).addAction(new ReusableAction() {
@Override
public boolean use(float delta) {
OptionsScene scene = SceneManager.switchTo(OptionsScene.class);
scene.init((OptionGroup) o);
return true;
}
});
} else if (o instanceof Boolean) {
final boolean b = (Boolean) o;
final DefaultOptions option = DefaultOptions.getOption(key);
final TextButton button = addTextButton(Language.get("option." + key + (b ? ".disable" : ".enable")), 0, 0);
button.addAction(new ReusableAction() {
private boolean down = b;
@Override
public boolean use(float delta) {
down = !down;
if (option != null)
option.set(down);
else
group.set(key, down);
button.setText(Language.get("option." + key + (down ? ".disable" : ".enable")));
return true;
}
});
}
// TODO add missing types
}
super.init();
}
Aggregations