I would expect a CompositeAppState to enable and disable the child appstates. The code below should do:
onEnable Appstate1
onEnable Appstate2
onDisable Appstate1
onDisable Appstate2
then hang indefinitely.
Instead I have
onEnable Appstate1
onEnable Appstate2
and only when I exit
onDisable Appstate1
onDisable Appstate2
Is this a bug or a misunderstanding on my part?
public class DoubleAppState extends CompositeAppState {
public DoubleAppState() {
super(
new AppState1(),
new AppState2());
}
protected void initialize(Application app) {
setEnabled(false);
}
}
class AppState1 extends BaseAppState {
@Override
protected void initialize(Application app) {
}
@Override
protected void cleanup(Application app) {
}
@Override
protected void onEnable() {
System.out.println("onEnable Appstate1");
}
@Override
protected void onDisable() {
System.out.println("onDisable Appstate1");
}
}
class AppState2 extends BaseAppState {
@Override
protected void initialize(Application app) {
}
@Override
protected void cleanup(Application app) {
}
@Override
protected void onEnable() {
System.out.println("onEnable Appstate2");
}
@Override
protected void onDisable() {
System.out.println("onDisable Appstate2");
}
}