<commit_before>package ethanjones.cubes.graphics.menus;

import ethanjones.cubes.core.localization.Localization;
import ethanjones.cubes.core.platform.Adapter;
import ethanjones.cubes.graphics.menu.Menu;
import ethanjones.cubes.graphics.menu.MenuTools;
import ethanjones.cubes.world.client.ClientSaveManager;
import ethanjones.cubes.world.save.Save;

import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.List;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;

public class SingleplayerSavesMenu extends Menu {

  Label title;
  ScrollPane scrollPane;
  List<Save> listLabel;
  TextButton back;
  TextButton delete;
  TextButton create;
  TextButton server;
  TextButton play;

  public SingleplayerSavesMenu() {
    title = new Label(Localization.get("menu.singleplayer.title"), skin.get("title", Label.LabelStyle.class));
    listLabel = new List<Save>(skin);

    scrollPane = new ScrollPane(listLabel, skin);
    scrollPane.setScrollingDisabled(true, false);

    back = MenuTools.getBackButton(this);

    updateSavesList();

    delete = new TextButton(Localization.get("menu.singleplayer.delete"), skin);
    delete.addListener(new ChangeListener() {
      @Override
      public void changed(ChangeEvent event, Actor actor) {
        Save save = listLabel.getSelected();
        if (save == null) return;
        Adapter.setMenu(new SingleplayerSaveDeleteMenu(save));
      }
    });

    create = new TextButton(Localization.get("menu.singleplayer.create"), skin);
    create.addListener(new ChangeListener() {
      @Override
      public void changed(ChangeEvent event, Actor actor) {
        Adapter.setMenu(new SingleplayerSaveCreateMenu());
      }
    });

    server = new TextButton(Localization.get("menu.singleplayer.server_only"), skin);
    server.addListener(new ChangeListener() {
      @Override<commit_msg>Double click on save in saves menu to play<commit_after>package ethanjones.cubes.graphics.menus;

import ethanjones.cubes.core.localization.Localization;
import ethanjones.cubes.core.platform.Adapter;
import ethanjones.cubes.graphics.menu.Menu;
import ethanjones.cubes.graphics.menu.MenuTools;
import ethanjones.cubes.world.client.ClientSaveManager;
import ethanjones.cubes.world.save.Save;

import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.List;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;

public class SingleplayerSavesMenu extends Menu {

  Label title;
  ScrollPane scrollPane;
  List<Save> listLabel;
  TextButton back;
  TextButton delete;
  TextButton create;
  TextButton server;
  TextButton play;

  public SingleplayerSavesMenu() {
    title = new Label(Localization.get("menu.singleplayer.title"), skin.get("title", Label.LabelStyle.class));
    listLabel = new List<Save>(skin);
    listLabel.addListener(new ActorGestureListener() {
      @Override
      public void tap(InputEvent event, float x, float y, int count, int button) {
        if (count == 2) play.toggle();
      }
    });

    scrollPane = new ScrollPane(listLabel, skin);
    scrollPane.setScrollingDisabled(true, false);

    back = MenuTools.getBackButton(this);

    updateSavesList();

    delete = new TextButton(Localization.get("menu.singleplayer.delete"), skin);
    delete.addListener(new ChangeListener() {
      @Override
      public void changed(ChangeEvent event, Actor actor) {
        Save save = listLabel.getSelected();
        if (save == null) return;
        Adapter.setMenu(new SingleplayerSaveDeleteMenu(save));
      }
    });

    create = new TextButton(Localization.get("menu.singleplayer.create"), skin);
    create.addListener(new ChangeListener() {
      @Override
      public void changed(ChangeEvent event, Actor actor) {
        Adapter.setMenu(new SingleplayerSaveCreateMenu());
      }
    });

    server = new TextButton(Localization.get("menu.singleplayer.server_only"), skin);
    server.addListener(new ChangeListener() {
      @Override
{'fraction_non_alphanumeric': 0.11166365280289331, 'fraction_numerical': 0.0033905967450271247, 'mean_word_length': 4.331325301204819, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7250137', 'n_tokens_mistral': 1407, 'n_tokens_neox': 1360, 'n_words': 250}