Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset button tweaks #174

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading