Skip to content

Commit

Permalink
rename class and add provide javaDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
ar0ne committed Jun 29, 2018
1 parent 64fe6dd commit 5c64a5b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,24 @@


/**
* @TODO: rename?, add more methods for different screens and cases?
* Generates new games manifest according to input data.
*/
public class NewGameSetupHelper {
public class GameManifestProvider {

private static final Logger logger = LoggerFactory.getLogger(NewGameSetupHelper.class);
private static final Logger logger = LoggerFactory.getLogger(GameManifestProvider.class);

private NewGameSetupHelper() {
private GameManifestProvider() {
}

public static GameManifest buildNewGameSetup(final UniverseWrapper universeWrapper, final ModuleManager moduleManager, final Config config) {
/**
* Generates game manifest with default settings (world generator, list of modules).
*
* @param universeWrapper contains the universe level properties
* @param moduleManager resolves modules
* @param config provides default module selection, world generator
* @return game manifest with default settings
*/
public static GameManifest createDefaultGameManifest(final UniverseWrapper universeWrapper, final ModuleManager moduleManager, final Config config) {
GameManifest gameManifest = new GameManifest();
if (StringUtils.isNotBlank(universeWrapper.getGameName())) {
gameManifest.setTitle(universeWrapper.getGameName());
Expand Down Expand Up @@ -74,7 +82,6 @@ public static GameManifest buildNewGameSetup(final UniverseWrapper universeWrapp
WorldInfo worldInfo = new WorldInfo(TerasologyConstants.MAIN_WORLD, seed,
(long) (WorldTime.DAY_LENGTH * timeOffset), uri);


gameManifest.addWorld(worldInfo);
return gameManifest;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public String get() {
if (gameName.getText().isEmpty()) {
getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("Error", "Game name cannot be empty");
} else {
GameManifest gameManifest = NewGameSetupHelper.buildNewGameSetup(universeWrapper, moduleManager, config);
GameManifest gameManifest = GameManifestProvider.createDefaultGameManifest(universeWrapper, moduleManager, config);
if (gameManifest != null) {
gameEngine.changeState(new StateLoading(gameManifest, (isLoadingAsServer()) ? NetworkMode.DEDICATED_SERVER : NetworkMode.NONE));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import org.terasology.rendering.nui.itemRendering.AbstractItemRenderer;
import org.terasology.rendering.nui.layers.mainMenu.ConfirmPopup;
import org.terasology.rendering.nui.layers.mainMenu.MessagePopup;
import org.terasology.rendering.nui.layers.mainMenu.NewGameSetupHelper;
import org.terasology.rendering.nui.layers.mainMenu.GameManifestProvider;
import org.terasology.rendering.nui.layers.mainMenu.UniverseSetupScreen;
import org.terasology.rendering.nui.layers.mainMenu.UniverseWrapper;
import org.terasology.rendering.nui.layers.mainMenu.WaitPopup;
Expand Down Expand Up @@ -443,7 +443,7 @@ public String get() {
if (StringUtils.isBlank(seed.getText())) {
getManager().createScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("Error", "Game seed cannot be empty!");
} else {
GameManifest gameManifest = NewGameSetupHelper.buildNewGameSetup(universeWrapper, moduleManager, config);
GameManifest gameManifest = GameManifestProvider.createDefaultGameManifest(universeWrapper, moduleManager, config);
if (gameManifest != null) {
gameEngine.changeState(new StateLoading(gameManifest, (universeWrapper.getLoadingAsServer()) ? NetworkMode.DEDICATED_SERVER : NetworkMode.NONE));
} else {
Expand Down

0 comments on commit 5c64a5b

Please sign in to comment.