当前位置: 首页>>代码示例>>Java>>正文


Java Save类代码示例

本文整理汇总了Java中ethanjones.cubes.world.save.Save的典型用法代码示例。如果您正苦于以下问题:Java Save类的具体用法?Java Save怎么用?Java Save使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Save类属于ethanjones.cubes.world.save包,在下文中一共展示了Save类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ServerSetupMenu

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
public ServerSetupMenu(final Save save) {
  super();
  title = new Label(Localization.get("menu.server.title"), skin.get("title", Label.LabelStyle.class));
  saveLabel = new Label(Localization.get("menu.server.save", save.name), skin);
  saveLabel.setAlignment(Align.center);
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.server.port", Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)));
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  start = new TextButton(Localization.get("menu.server.start"), skin);
  back = MenuTools.getBackButton(this);

  start.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      int p = port.getText().isEmpty() ? Settings.getIntegerSettingValue(Settings.NETWORKING_PORT) : Integer.parseInt(port.getText());
      Adapter.setMenu(new ServerRunningMenu(save, p));
    }
  });

  stage.addActor(title);
  stage.addActor(saveLabel);
  stage.addActor(port);
  stage.addActor(start);
  stage.addActor(back);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:26,代码来源:ServerSetupMenu.java

示例2: generateCave

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
private Cave generateCave(final AreaReference a) {
	int offsetX = smoothWorld.pseudorandomInt(a.areaX, a.areaZ, Area.SIZE_BLOCKS - 1);
	int offsetZ = smoothWorld.pseudorandomInt(a.areaZ, a.areaX, Area.SIZE_BLOCKS - 1);

	int x = a.minBlockX() + offsetX;
	int z = a.minBlockZ() + offsetZ;

	CaveGenerator caveGenerator = new CaveGenerator(x, z, smoothWorld);
	final Cave cave = caveGenerator.generate();
	final Save save = Cubes.getServer().world.save;
	Executor.executeNotSided(new Runnable() {
		@Override
		public void run() {
			save.writeCave(a, cave);
		}
	});
	return cave;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:19,代码来源:CaveManager.java

示例3: createSave

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
public static Save createSave(String name, String generatorID, Gamemode gamemode, String seedString) {
  if (name != null) name = name.trim();
  if (name == null || name.isEmpty()) name = "world-" + Integer.toHexString(MathUtils.random.nextInt());
  FileHandle folder = getSavesFolder();
  FileHandle handle = folder.child(name);
  handle.mkdirs();
  Compatibility.get().nomedia(handle);
  Save s = new Save(name, handle);

  SaveOptions options = new SaveOptions();
  options.setWorldSeed(seedString);
  options.worldType = generatorID;
  options.worldGamemode = gamemode;
  s.setSaveOptions(options);

  return s;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:18,代码来源:ClientSaveManager.java

示例4: SingleplayerSaveDeleteMenu

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
public SingleplayerSaveDeleteMenu(final Save save) {
	title = new Label(Localization.get("menu.singleplayer.delete.title"),
			skin.get("title", Label.LabelStyle.class));
	text = new Label(Localization.get("menu.singleplayer.delete.text", save.name), skin);
	delete = new TextButton(Localization.get("menu.singleplayer.delete.delete", save.name), skin);
	back = MenuTools.getBackButton(this);

	text.setAlignment(Align.center);

	delete.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			ClientSaveManager.deleteSave(save);
			Menu prev = MenuManager.getPrevious(SingleplayerSaveDeleteMenu.this);
			if (!(prev instanceof SingleplayerSavesMenu))
				return;
			((SingleplayerSavesMenu) prev).updateSavesList();
			Adapter.setMenu(prev);
		}
	});

	stage.addActor(title);
	stage.addActor(text);
	stage.addActor(delete);
	stage.addActor(back);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:27,代码来源:SingleplayerSaveDeleteMenu.java

示例5: ServerRunningMenu

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
public ServerRunningMenu(Save save, int port) {
  super(Localization.get("menu.general.loading"), Localization.get("menu.server.stop"));
  this.save = save;
  this.port = port;

  addButtonListener(new EventListener() {
    @Override
    public boolean handle(Event event) {
      if (!(event instanceof ChangeListener.ChangeEvent)) return false;
      try {
        Adapter.gotoMainMenu();
      } catch (StopLoopException ignored) {
      }
      return true;
    }
  });
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:18,代码来源:ServerRunningMenu.java

示例6: getSave

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
private static Save getSave(CubesCmdLineOptions.ServerCmdLineOptions options) {
	FileHandle worldFolder = Compatibility.get().getBaseFolder().child("world");
	if (options.worldFolder != null)
		worldFolder = Gdx.files.absolute(options.worldFolder);
	Save save = new Save("world", worldFolder);
	if (save.readSaveOptions() == null) {
		SaveOptions saveOptions = save.getSaveOptions();
		if (options.worldSeedString != null)
			saveOptions.setWorldSeed(options.worldSeedString);
		if (options.worldGenerator != null)
			saveOptions.worldType = options.worldGenerator;
		if (options.worldGamemode != null)
			saveOptions.worldGamemode = options.worldGamemode;
	}
	return save;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:17,代码来源:DedicatedServer.java

示例7: generateCave

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
private Cave generateCave(final AreaReference a) {
  int offsetX = smoothWorld.pseudorandomInt(a.areaX, a.areaZ, Area.SIZE_BLOCKS - 1);
  int offsetZ = smoothWorld.pseudorandomInt(a.areaZ, a.areaX, Area.SIZE_BLOCKS - 1);

  int x = a.minBlockX() + offsetX;
  int z = a.minBlockZ() + offsetZ;

  CaveGenerator caveGenerator = new CaveGenerator(x, z, smoothWorld);
  final Cave cave = caveGenerator.generate();
  final Save save = Cubes.getServer().world.save;
  Executor.executeNotSided(new Runnable() {
    @Override
    public void run() {
      save.writeCave(a, cave);
    }
  });
  return cave;
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:19,代码来源:CaveManager.java

示例8: SingleplayerSaveDeleteMenu

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
public SingleplayerSaveDeleteMenu(final Save save) {
  title = new Label(Localization.get("menu.singleplayer.delete.title"), skin.get("title", Label.LabelStyle.class));
  text = new Label(Localization.get("menu.singleplayer.delete.text", save.name), skin);
  delete = new TextButton(Localization.get("menu.singleplayer.delete.delete", save.name), skin);
  back = MenuTools.getBackButton(this);

  text.setAlignment(Align.center);

  delete.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      ClientSaveManager.deleteSave(save);
      Menu prev = MenuManager.getPrevious(SingleplayerSaveDeleteMenu.this);
      if (!(prev instanceof SingleplayerSavesMenu)) return;
      ((SingleplayerSavesMenu) prev).updateSavesList();
      Adapter.setMenu(prev);
    }
  });

  stage.addActor(title);
  stage.addActor(text);
  stage.addActor(delete);
  stage.addActor(back);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:25,代码来源:SingleplayerSaveDeleteMenu.java

示例9: getSaves

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
public static Save[] getSaves() {
  FileHandle clientSavesFolder = getSavesFolder();
  if (!clientSavesFolder.isDirectory()) return new Save[0];
  FileHandle[] list = clientSavesFolder.list();
  Save[] saves = new Save[list.length];
  for (int i = 0; i < list.length; i++) {
    saves[i] = new Save(list[i].name(), list[i]);
  }
  return saves;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:11,代码来源:ClientSaveManager.java

示例10: createTemporarySave

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
public static Save createTemporarySave(String generatorID, Gamemode gamemode, String seedString) {
  Save s = new Save("Temporary", null, true);
  
  SaveOptions options = new SaveOptions();
  options.setWorldSeed(seedString);
  options.worldType = generatorID;
  options.worldGamemode = gamemode;
  s.setSaveOptions(options);
  
  return s;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:12,代码来源:ClientSaveManager.java

示例11: deleteSave

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
public static void deleteSave(Save save) {
  if (save.fileHandle.deleteDirectory()) {
    Log.info("Deleted save " + save.name);
  } else {
    Log.warning("Failed to delete save " + save.name);
  }
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:8,代码来源:ClientSaveManager.java

示例12: WorldServer

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
public WorldServer(Save save) {
	super(save);
	if (save == null)
		throw new IllegalArgumentException("Null save on server");

	if (this.save.fileHandle != null)
		Log.info("Save '" + this.save.name + "' in '" + this.save.fileHandle.file().getAbsolutePath() + "'");
	else
		Log.info("Save '" + this.save.name + "'");
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:11,代码来源:WorldServer.java

示例13: WorldSaveTask

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
public WorldSaveTask(Save save, AreaMap areas) {
	this.save = save;
	areas.lock.readLock();
	for (Area area : areas) {
		this.saveQueue.add(area);
	}
	areas.lock.readUnlock();
	this.length = saveQueue.size();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:10,代码来源:WorldSaveTask.java

示例14: World

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
public World(Save save) {
	this.save = save;
	this.terrainGenerator = save == null ? null : GeneratorManager.getTerrainGenerator(save.getSaveOptions());
	this.time = save == null ? 0 : save.getSaveOptions().worldTime;
	map = new AreaMap(this);
	entities = new Entities(this);
	lua = LuaMapping.mapping(new LuaMappingWorld(this));
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:9,代码来源:World.java

示例15: ServerSetupMenu

import ethanjones.cubes.world.save.Save; //导入依赖的package包/类
public ServerSetupMenu(final Save save) {
	super();
	title = new Label(Localization.get("menu.server.title"), skin.get("title", Label.LabelStyle.class));
	saveLabel = new Label(Localization.get("menu.server.save", save.name), skin);
	saveLabel.setAlignment(Align.center);
	port = new TextField("", skin);
	port.setMessageText(
			Localization.get("menu.server.port", Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)));
	port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
	start = new TextButton(Localization.get("menu.server.start"), skin);
	back = MenuTools.getBackButton(this);

	start.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			int p = port.getText().isEmpty() ? Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)
					: Integer.parseInt(port.getText());
			Adapter.setMenu(new ServerRunningMenu(save, p));
		}
	});

	stage.addActor(title);
	stage.addActor(saveLabel);
	stage.addActor(port);
	stage.addActor(start);
	stage.addActor(back);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:28,代码来源:ServerSetupMenu.java


注:本文中的ethanjones.cubes.world.save.Save类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。