hide options with failing showcondition

This commit is contained in:
yugecin 2016-12-04 13:49:35 +01:00
parent e2453db9d5
commit 27be84e99a

View File

@ -113,6 +113,7 @@ public class OptionsMenu extends BasicGameState {
}),
DANCE ("Dance", new GameOption[] {
GameOption.DANCE_MOVER,
GameOption.DANCE_QUAD_BEZ_AGRESSIVE,
GameOption.DANCE_MOVER_DIRECTION,
GameOption.DANCE_SLIDER_MOVER_TYPE,
GameOption.DANCE_SPINNER,
@ -277,9 +278,12 @@ public class OptionsMenu extends BasicGameState {
if (selectedOption != null) {
hoverOption = selectedOption;
}
for (int i = 0; i < currentTab.options.length; i++) {
for (int i = 0, j = 0; i < currentTab.options.length; i++) {
GameOption option = currentTab.options[i];
drawOption(option, i, hoverOption == option);
if (!option.showCondition()) {
continue;
}
drawOption(option, j++, hoverOption == option);
}
// option tabs
@ -602,6 +606,14 @@ public class OptionsMenu extends BasicGameState {
if (index >= currentTab.options.length)
return null;
int i = index;
while (i >= 0) {
if (!currentTab.options[i--].showCondition()) {
if (++index >= currentTab.options.length) {
return null;
}
}
}
return currentTab.options[index];
}
}