Skip to content

Commit

Permalink
Merge pull request #174 from raeleus/Reset-Button-Tweaks
Browse files Browse the repository at this point in the history
Reset button tweaks
  • Loading branch information
tommyettinger authored Jul 1, 2024
2 parents 518e6d8 + 29b2ccd commit a73c373
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/java/gdx/liftoff/ui/dialogs/ConfirmResetUserData.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*;
import static gdx.liftoff.Main.*;
import static gdx.liftoff.ui.dialogs.FullscreenCompleteDialog.*;
import static gdx.liftoff.ui.dialogs.FullscreenDialog.*;

public class ConfirmResetUserData extends PopTable {
Expand Down Expand Up @@ -48,13 +49,18 @@ private void resetConfirmed() {
hide();
resetUserData();

if (fullscreenDialog == null) {
if (fullscreenDialog != null) {
Action action = sequence(alpha(0), Actions.run(() -> fullscreenDialog.populate()), fadeIn(.2f));
fullscreenDialog.addAction(action);
} else if (fullscreenCompleteDialog != null) {
fullscreenCompleteDialog.hide();
FullscreenDialog.show();
} else if (root.getCurrentTable() == root.completeTable) {
root.transitionTable(root.landingTable,true);
} else {
root.getCurrentTable().populate();
root.getCurrentTable().setColor(1, 1, 1, 0);
Gdx.app.postRunnable(() -> root.fadeInTable());
} else {
Action action = sequence(alpha(0), Actions.run(() -> fullscreenDialog.populate()), fadeIn(.2f));
fullscreenDialog.addAction(action);
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/gdx/liftoff/ui/dialogs/FullscreenCompleteDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Scaling;
import com.ray3k.stripe.CollapsibleGroup;
import com.ray3k.stripe.CollapsibleGroup.CollapseType;
Expand Down Expand Up @@ -56,6 +58,14 @@ private void createPanels(Table contentTable, boolean showGeneration) {
//generating panel is displayed first and is alternated with the complete panel upon completion of the animation
GeneratingPanel generatingPanel = new GeneratingPanel(true);

//reset button
Button button = new Button(skin, "reload");
contentTable.add(button).expandX().right();
addTooltip(button, Align.left, prop.getProperty("reset"));
addHandListener(button);
onChange(button, ConfirmResetUserData::showDialog);

contentTable.row();
Table table = new Table();
contentTable.stack(generatingPanel, table).grow();

Expand Down

0 comments on commit a73c373

Please sign in to comment.