v0.7.3: tied more logic into the window restoring functionality
This commit is contained in:
parent
7ca293bcc5
commit
ad2e3d7350
|
@ -245,6 +245,19 @@ public class ShatteredPixelDungeon extends Game {
|
||||||
switchScene( c, callback );
|
switchScene( c, callback );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void seamlessResetScene(SceneChangeCallback callback) {
|
||||||
|
if (scene() instanceof PixelScene){
|
||||||
|
((PixelScene) scene()).saveWindows();
|
||||||
|
switchNoFade((Class<? extends PixelScene>) sceneClass, callback );
|
||||||
|
} else {
|
||||||
|
resetScene();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void seamlessResetScene(){
|
||||||
|
seamlessResetScene(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void switchScene() {
|
protected void switchScene() {
|
||||||
super.switchScene();
|
super.switchScene();
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class WndLangs extends Window {
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
Messages.setup(langs.get(langIndex));
|
Messages.setup(langs.get(langIndex));
|
||||||
ShatteredPixelDungeon.switchNoFade(TitleScene.class, new Game.SceneChangeCallback() {
|
ShatteredPixelDungeon.seamlessResetScene(new Game.SceneChangeCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeCreate() {
|
public void beforeCreate() {
|
||||||
SPDSettings.language(langs.get(langIndex));
|
SPDSettings.language(langs.get(langIndex));
|
||||||
|
@ -77,7 +77,7 @@ public class WndLangs extends Window {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void afterCreate() {
|
public void afterCreate() {
|
||||||
Game.scene().add(new WndLangs());
|
//do nothing
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,17 +114,7 @@ public class WndSettings extends WndTabbed {
|
||||||
protected void onChange() {
|
protected void onChange() {
|
||||||
if (getSelectedValue() != SPDSettings.scale()) {
|
if (getSelectedValue() != SPDSettings.scale()) {
|
||||||
SPDSettings.scale(getSelectedValue());
|
SPDSettings.scale(getSelectedValue());
|
||||||
ShatteredPixelDungeon.switchNoFade((Class<? extends PixelScene>) ShatteredPixelDungeon.scene().getClass(), new Game.SceneChangeCallback() {
|
ShatteredPixelDungeon.seamlessResetScene();
|
||||||
@Override
|
|
||||||
public void beforeCreate() {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterCreate() {
|
|
||||||
Game.scene().add(new WndSettings());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -293,7 +283,7 @@ public class WndSettings extends WndTabbed {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
ShatteredPixelDungeon.switchNoFade((Class<? extends PixelScene>) ShatteredPixelDungeon.scene().getClass(), new Game.SceneChangeCallback() {
|
ShatteredPixelDungeon.seamlessResetScene(new Game.SceneChangeCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeCreate() {
|
public void beforeCreate() {
|
||||||
SPDSettings.systemFont(checked());
|
SPDSettings.systemFont(checked());
|
||||||
|
@ -301,7 +291,7 @@ public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterCreate() {
|
public void afterCreate() {
|
||||||
Game.scene().add(new WndSettings());
|
//do nothing
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user