singleplayer menu layout work
This commit is contained in:
parent
2c967a2141
commit
176bdb1d5a
@ -1178,6 +1178,7 @@ Implement multi-biome sampling for surface heightmap
|
||||
Nearest biome sampling for content generation
|
||||
Fix recursive delete not actually recursing
|
||||
Add floor voxel type
|
||||
Singleplayer menu layout work
|
||||
|
||||
|
||||
# TODO
|
||||
|
||||
BIN
saves/TEST1/central.db
Normal file
BIN
saves/TEST1/central.db
Normal file
Binary file not shown.
1
saves/TEST1/chunk.map
Normal file
1
saves/TEST1/chunk.map
Normal file
@ -0,0 +1 @@
|
||||
{}
|
||||
1
saves/TEST1/save.json
Normal file
1
saves/TEST1/save.json
Normal file
@ -0,0 +1 @@
|
||||
{"versionString":"0.0.1","timeCreated":"1732918806407","name":"TEST1"}
|
||||
1
saves/TEST1/scene.json
Normal file
1
saves/TEST1/scene.json
Normal file
@ -0,0 +1 @@
|
||||
{"entities":[],"scriptPaths":[],"realmDescriptor":{"type":"procedural","griddedRealmSize":1024000,"baseVoxel":1},"createSaveInstance":true,"loadAllCells":false}
|
||||
BIN
saves/TEST1/terrain.dat
Normal file
BIN
saves/TEST1/terrain.dat
Normal file
Binary file not shown.
1
saves/TEST1/terrain.json
Normal file
1
saves/TEST1/terrain.json
Normal file
@ -0,0 +1 @@
|
||||
{"dynamicInterpolationRatio":1000,"interpolationRandomDampener":1.0,"discreteArrayDimension":2560,"realMountainThreshold":150000.0,"realOceanThreshold":50000.0,"seed":0,"macroDataScale":32}
|
||||
1
saves/TEST1/world.json
Normal file
1
saves/TEST1/world.json
Normal file
@ -0,0 +1 @@
|
||||
{"type":"LEVEL","worldMinPoint":{"x":0.0,"y":0.0,"z":0.0},"worldMaxPoint":{"x":32000.0,"y":32000.0,"z":32000.0},"worldSizeDiscrete":2000,"worldSizeDiscreteVertical":2000,"dynamicInterpolationRatio":1,"randomDampener":1.0,"isArena":false}
|
||||
@ -17,6 +17,8 @@ import electrosphere.renderer.ui.elements.FormElement;
|
||||
import electrosphere.renderer.ui.elements.Label;
|
||||
import electrosphere.renderer.ui.elements.TextInput;
|
||||
import electrosphere.renderer.ui.elementtypes.Element;
|
||||
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaAlignment;
|
||||
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaJustification;
|
||||
import electrosphere.server.saves.SaveUtils;
|
||||
|
||||
/**
|
||||
@ -24,20 +26,31 @@ import electrosphere.server.saves.SaveUtils;
|
||||
*/
|
||||
public class MenuGenerators {
|
||||
|
||||
//Used when we're displaying loading window to make main menu invisible
|
||||
/**
|
||||
* Creates the empty content to display when loading main menu
|
||||
* @return The empty content
|
||||
*/
|
||||
public static Element createEmptyMainMenu(){
|
||||
Div rVal = Div.createDiv();
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the world selection menu content
|
||||
* @return The menu content
|
||||
*/
|
||||
public static Element createWorldSelectMenu(){
|
||||
FormElement rVal = new FormElement();
|
||||
|
||||
//create save button column
|
||||
Div saveButtonContainer = Div.createCol();
|
||||
saveButtonContainer.setMarginRight(50);
|
||||
List<String> saveNames = SaveUtils.getSaves();
|
||||
for(String saveName : saveNames){
|
||||
if(!saveName.startsWith(".")){
|
||||
|
||||
//button (select save)
|
||||
rVal.addChild(Button.createButton(saveName.toUpperCase(), () -> {
|
||||
Div spacer = Div.createDiv();
|
||||
spacer.addChild(Button.createButton(saveName.toUpperCase(), () -> {
|
||||
if(SaveUtils.saveHasWorldFile(saveName.toLowerCase())){
|
||||
//need to log client in
|
||||
Globals.clientUsername = "username";
|
||||
@ -53,35 +66,70 @@ public class MenuGenerators {
|
||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createSaveCreationMenu());
|
||||
}
|
||||
}));
|
||||
spacer.setMarginBottom(30);
|
||||
|
||||
//button (select save)
|
||||
saveButtonContainer.addChild(spacer);
|
||||
}
|
||||
}
|
||||
|
||||
Div createButtonContainer = Div.createCol();
|
||||
createButtonContainer.setMarginLeft(50);
|
||||
//button (create)
|
||||
rVal.addChild(Button.createButton("Create World", () -> {
|
||||
createButtonContainer.addChild(Button.createButton("Create World", () -> {
|
||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldCreationMenu());
|
||||
}));
|
||||
|
||||
|
||||
//layout
|
||||
Div mainLayout = Div.createRow(
|
||||
saveButtonContainer,
|
||||
createButtonContainer
|
||||
);
|
||||
mainLayout.setMarginTop(100);
|
||||
mainLayout.setJustifyContent(YogaJustification.Center);
|
||||
rVal.addChild(mainLayout);
|
||||
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* World creation menu
|
||||
* @return The world creation menu element
|
||||
*/
|
||||
public static Element createWorldCreationMenu(){
|
||||
FormElement rVal = new FormElement();
|
||||
|
||||
//text entry (address)
|
||||
Div worldNameInputContainer = Div.createRow();
|
||||
worldNameInputContainer.setMarginBottom(20);
|
||||
TextInput worldNameInput = TextInput.createTextInput();
|
||||
worldNameInput.setMinWidth(100);
|
||||
worldNameInput.setMaxWidthPercent(50);
|
||||
worldNameInput.setText("World name");
|
||||
rVal.addChild(worldNameInput);
|
||||
worldNameInputContainer.addChild(worldNameInput);
|
||||
|
||||
|
||||
//button (create)
|
||||
rVal.addChild(Button.createButton("Create", () -> {
|
||||
Div createButtonContainer = Div.createCol();
|
||||
createButtonContainer.setMarginTop(20);
|
||||
createButtonContainer.addChild(Button.createButton("Create", () -> {
|
||||
String saveName = worldNameInput.getText();
|
||||
//create save dir
|
||||
SaveUtils.createOrOverwriteSave(saveName, SceneGenerator.createProceduralSceneFile(saveName));
|
||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldSelectMenu());
|
||||
}));
|
||||
|
||||
|
||||
//layout content
|
||||
Div mainLayout = Div.createCol(
|
||||
worldNameInputContainer,
|
||||
createButtonContainer
|
||||
);
|
||||
mainLayout.setMarginTop(300);
|
||||
mainLayout.setAlignItems(YogaAlignment.Center);
|
||||
rVal.addChild(mainLayout);
|
||||
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ public class SaveUtils {
|
||||
}
|
||||
}
|
||||
//create main save files
|
||||
createSave(saveName, sceneFile);
|
||||
SaveUtils.createSave(saveName, sceneFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user