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
|
Nearest biome sampling for content generation
|
||||||
Fix recursive delete not actually recursing
|
Fix recursive delete not actually recursing
|
||||||
Add floor voxel type
|
Add floor voxel type
|
||||||
|
Singleplayer menu layout work
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# 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.Label;
|
||||||
import electrosphere.renderer.ui.elements.TextInput;
|
import electrosphere.renderer.ui.elements.TextInput;
|
||||||
import electrosphere.renderer.ui.elementtypes.Element;
|
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;
|
import electrosphere.server.saves.SaveUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,20 +26,31 @@ import electrosphere.server.saves.SaveUtils;
|
|||||||
*/
|
*/
|
||||||
public class MenuGenerators {
|
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(){
|
public static Element createEmptyMainMenu(){
|
||||||
Div rVal = Div.createDiv();
|
Div rVal = Div.createDiv();
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the world selection menu content
|
||||||
|
* @return The menu content
|
||||||
|
*/
|
||||||
public static Element createWorldSelectMenu(){
|
public static Element createWorldSelectMenu(){
|
||||||
FormElement rVal = new FormElement();
|
FormElement rVal = new FormElement();
|
||||||
|
|
||||||
|
//create save button column
|
||||||
|
Div saveButtonContainer = Div.createCol();
|
||||||
|
saveButtonContainer.setMarginRight(50);
|
||||||
List<String> saveNames = SaveUtils.getSaves();
|
List<String> saveNames = SaveUtils.getSaves();
|
||||||
for(String saveName : saveNames){
|
for(String saveName : saveNames){
|
||||||
if(!saveName.startsWith(".")){
|
if(!saveName.startsWith(".")){
|
||||||
|
|
||||||
//button (select save)
|
Div spacer = Div.createDiv();
|
||||||
rVal.addChild(Button.createButton(saveName.toUpperCase(), () -> {
|
spacer.addChild(Button.createButton(saveName.toUpperCase(), () -> {
|
||||||
if(SaveUtils.saveHasWorldFile(saveName.toLowerCase())){
|
if(SaveUtils.saveHasWorldFile(saveName.toLowerCase())){
|
||||||
//need to log client in
|
//need to log client in
|
||||||
Globals.clientUsername = "username";
|
Globals.clientUsername = "username";
|
||||||
@ -53,35 +66,70 @@ public class MenuGenerators {
|
|||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createSaveCreationMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createSaveCreationMenu());
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
spacer.setMarginBottom(30);
|
||||||
|
|
||||||
|
//button (select save)
|
||||||
|
saveButtonContainer.addChild(spacer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Div createButtonContainer = Div.createCol();
|
||||||
|
createButtonContainer.setMarginLeft(50);
|
||||||
//button (create)
|
//button (create)
|
||||||
rVal.addChild(Button.createButton("Create World", () -> {
|
createButtonContainer.addChild(Button.createButton("Create World", () -> {
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldCreationMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldCreationMenu());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
//layout
|
||||||
|
Div mainLayout = Div.createRow(
|
||||||
|
saveButtonContainer,
|
||||||
|
createButtonContainer
|
||||||
|
);
|
||||||
|
mainLayout.setMarginTop(100);
|
||||||
|
mainLayout.setJustifyContent(YogaJustification.Center);
|
||||||
|
rVal.addChild(mainLayout);
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* World creation menu
|
||||||
|
* @return The world creation menu element
|
||||||
|
*/
|
||||||
public static Element createWorldCreationMenu(){
|
public static Element createWorldCreationMenu(){
|
||||||
FormElement rVal = new FormElement();
|
FormElement rVal = new FormElement();
|
||||||
|
|
||||||
//text entry (address)
|
//text entry (address)
|
||||||
|
Div worldNameInputContainer = Div.createRow();
|
||||||
|
worldNameInputContainer.setMarginBottom(20);
|
||||||
TextInput worldNameInput = TextInput.createTextInput();
|
TextInput worldNameInput = TextInput.createTextInput();
|
||||||
worldNameInput.setMinWidth(100);
|
worldNameInput.setMinWidth(100);
|
||||||
|
worldNameInput.setMaxWidthPercent(50);
|
||||||
worldNameInput.setText("World name");
|
worldNameInput.setText("World name");
|
||||||
rVal.addChild(worldNameInput);
|
worldNameInputContainer.addChild(worldNameInput);
|
||||||
|
|
||||||
|
|
||||||
//button (create)
|
//button (create)
|
||||||
rVal.addChild(Button.createButton("Create", () -> {
|
Div createButtonContainer = Div.createCol();
|
||||||
|
createButtonContainer.setMarginTop(20);
|
||||||
|
createButtonContainer.addChild(Button.createButton("Create", () -> {
|
||||||
String saveName = worldNameInput.getText();
|
String saveName = worldNameInput.getText();
|
||||||
//create save dir
|
//create save dir
|
||||||
SaveUtils.createOrOverwriteSave(saveName, SceneGenerator.createProceduralSceneFile(saveName));
|
SaveUtils.createOrOverwriteSave(saveName, SceneGenerator.createProceduralSceneFile(saveName));
|
||||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldSelectMenu());
|
WindowUtils.replaceMainMenuContents(MenuGenerators.createWorldSelectMenu());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
//layout content
|
||||||
|
Div mainLayout = Div.createCol(
|
||||||
|
worldNameInputContainer,
|
||||||
|
createButtonContainer
|
||||||
|
);
|
||||||
|
mainLayout.setMarginTop(300);
|
||||||
|
mainLayout.setAlignItems(YogaAlignment.Center);
|
||||||
|
rVal.addChild(mainLayout);
|
||||||
|
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class SaveUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//create main save files
|
//create main save files
|
||||||
createSave(saveName, sceneFile);
|
SaveUtils.createSave(saveName, sceneFile);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user