world/biome type options in world creation
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
183a8ce901
commit
1672119cb3
@ -1405,6 +1405,7 @@ HillsGen visuals work
|
|||||||
(04/01/2025)
|
(04/01/2025)
|
||||||
Falling min frames to activate increased
|
Falling min frames to activate increased
|
||||||
Reorganizing world creation ui file
|
Reorganizing world creation ui file
|
||||||
|
UI panel work
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package electrosphere.client.ui.menu.mainmenu.worldgen;
|
package electrosphere.client.ui.menu.mainmenu.worldgen;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import electrosphere.auth.AuthenticationManager;
|
import electrosphere.auth.AuthenticationManager;
|
||||||
import electrosphere.client.ui.menu.WindowUtils;
|
import electrosphere.client.ui.menu.WindowUtils;
|
||||||
@ -8,11 +10,14 @@ import electrosphere.client.ui.menu.mainmenu.MenuGeneratorsTitleMenu;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.loadingthreads.LoadingThread;
|
import electrosphere.engine.loadingthreads.LoadingThread;
|
||||||
import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;
|
import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;
|
||||||
|
import electrosphere.engine.signal.Signal.SignalType;
|
||||||
import electrosphere.entity.scene.SceneGenerator;
|
import electrosphere.entity.scene.SceneGenerator;
|
||||||
import electrosphere.renderer.ui.elements.Button;
|
import electrosphere.renderer.ui.elements.Button;
|
||||||
import electrosphere.renderer.ui.elements.Div;
|
import electrosphere.renderer.ui.elements.Div;
|
||||||
import electrosphere.renderer.ui.elements.FormElement;
|
import electrosphere.renderer.ui.elements.FormElement;
|
||||||
import electrosphere.renderer.ui.elements.Label;
|
import electrosphere.renderer.ui.elements.Label;
|
||||||
|
import electrosphere.renderer.ui.elements.Panel;
|
||||||
|
import electrosphere.renderer.ui.elements.StringCarousel;
|
||||||
import electrosphere.renderer.ui.elements.TextInput;
|
import electrosphere.renderer.ui.elements.TextInput;
|
||||||
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaAlignment;
|
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaAlignment;
|
||||||
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaJustification;
|
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaJustification;
|
||||||
@ -21,6 +26,8 @@ import electrosphere.renderer.ui.events.NavigationEvent;
|
|||||||
import electrosphere.server.saves.SaveUtils;
|
import electrosphere.server.saves.SaveUtils;
|
||||||
|
|
||||||
public class MenuWorldSelect {
|
public class MenuWorldSelect {
|
||||||
|
|
||||||
|
private static WorldGenUIParams params;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the world selection menu content
|
* Creates the world selection menu content
|
||||||
@ -68,6 +75,7 @@ public class MenuWorldSelect {
|
|||||||
createButtonContainer.setMarginLeft(50);
|
createButtonContainer.setMarginLeft(50);
|
||||||
//button (create)
|
//button (create)
|
||||||
createButtonContainer.addChild(Button.createButton("Create World", () -> {
|
createButtonContainer.addChild(Button.createButton("Create World", () -> {
|
||||||
|
params = new WorldGenUIParams();
|
||||||
WindowUtils.replaceMainMenuContents(MenuWorldSelect.createWorldCreationMenu());
|
WindowUtils.replaceMainMenuContents(MenuWorldSelect.createWorldCreationMenu());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -119,6 +127,14 @@ public class MenuWorldSelect {
|
|||||||
worldSeedInput.setText(System.currentTimeMillis() + "");
|
worldSeedInput.setText(System.currentTimeMillis() + "");
|
||||||
worldSeedInputContainer.addChild(worldSeedInput);
|
worldSeedInputContainer.addChild(worldSeedInput);
|
||||||
|
|
||||||
|
Div worldTypeMenuButtonContainer = Div.createRow();
|
||||||
|
{
|
||||||
|
Button worldTypeButton = Button.createButton("World Type", () -> {
|
||||||
|
WindowUtils.replaceMainMenuContents(MenuWorldSelect.createWorldTypeDefinitionMenu());
|
||||||
|
});
|
||||||
|
worldTypeMenuButtonContainer.addChild(worldTypeButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//button (create)
|
//button (create)
|
||||||
Div createButtonContainer = Div.createCol();
|
Div createButtonContainer = Div.createCol();
|
||||||
@ -136,6 +152,91 @@ public class MenuWorldSelect {
|
|||||||
Div mainLayout = Div.createCol(
|
Div mainLayout = Div.createCol(
|
||||||
worldNameInputContainer,
|
worldNameInputContainer,
|
||||||
worldSeedInputContainer,
|
worldSeedInputContainer,
|
||||||
|
worldTypeMenuButtonContainer,
|
||||||
|
createButtonContainer
|
||||||
|
);
|
||||||
|
mainLayout.setMarginTop(300);
|
||||||
|
mainLayout.setAlignItems(YogaAlignment.Center);
|
||||||
|
rVal.addChild(mainLayout);
|
||||||
|
|
||||||
|
return rVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* World type definition menu
|
||||||
|
* @return The world type definition menu element
|
||||||
|
*/
|
||||||
|
public static Element createWorldTypeDefinitionMenu(){
|
||||||
|
FormElement rVal = new FormElement();
|
||||||
|
|
||||||
|
//set nav callback
|
||||||
|
WindowUtils.setMainMenuBackoutCallback((NavigationEvent event) -> {
|
||||||
|
WindowUtils.replaceMainMenuContents(MenuWorldSelect.createWorldCreationMenu());
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
//select world type
|
||||||
|
Div worldTypeCarousel = Div.createRow();
|
||||||
|
{
|
||||||
|
Panel panel = Panel.createPanel();
|
||||||
|
panel.setWidth(500);
|
||||||
|
panel.setJustifyContent(YogaJustification.Between);
|
||||||
|
worldTypeCarousel.addChild(panel);
|
||||||
|
|
||||||
|
Label label = Label.createLabel("Type: ");
|
||||||
|
panel.addChild(label);
|
||||||
|
List<String> options = Arrays.asList(new String[]{
|
||||||
|
"Default",
|
||||||
|
"Homogenous",
|
||||||
|
});
|
||||||
|
|
||||||
|
StringCarousel typeCarousel = StringCarousel.create(options, (event) -> {
|
||||||
|
int index = options.indexOf(event.getAsString());
|
||||||
|
params.worldType = index;
|
||||||
|
WindowUtils.replaceMainMenuContents(MenuWorldSelect.createWorldTypeDefinitionMenu());
|
||||||
|
});
|
||||||
|
typeCarousel.setOption(params.worldType);
|
||||||
|
panel.addChild(typeCarousel);
|
||||||
|
}
|
||||||
|
|
||||||
|
//select biome type (for homogenous worlds)
|
||||||
|
Div biomeTypeCarousel = Div.createRow();
|
||||||
|
if(params.worldType == 1){
|
||||||
|
Panel panel = Panel.createPanel();
|
||||||
|
panel.setWidth(500);
|
||||||
|
panel.setJustifyContent(YogaJustification.Between);
|
||||||
|
biomeTypeCarousel.addChild(panel);
|
||||||
|
|
||||||
|
Label label = Label.createLabel("Biome: ");
|
||||||
|
panel.addChild(label);
|
||||||
|
|
||||||
|
|
||||||
|
List<String> biomes = Globals.gameConfigCurrent.getBiomeMap().getSurfaceBiomes().stream().map((biome) -> {
|
||||||
|
return biome.getDisplayName();
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
StringCarousel typeCarousel = StringCarousel.create(biomes, (event) -> {
|
||||||
|
int index = biomes.indexOf(event.getAsString());
|
||||||
|
params.biomeType = index;
|
||||||
|
Globals.signalSystem.post(SignalType.YOGA_APPLY,rVal);
|
||||||
|
});
|
||||||
|
typeCarousel.setOption(params.biomeType);
|
||||||
|
panel.addChild(typeCarousel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//button (create)
|
||||||
|
Div createButtonContainer = Div.createCol();
|
||||||
|
createButtonContainer.setMarginTop(20);
|
||||||
|
createButtonContainer.addChild(Button.createButton("Return", () -> {
|
||||||
|
WindowUtils.replaceMainMenuContents(MenuWorldSelect.createWorldCreationMenu());
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
//layout content
|
||||||
|
Div mainLayout = Div.createCol(
|
||||||
|
worldTypeCarousel,
|
||||||
|
biomeTypeCarousel,
|
||||||
createButtonContainer
|
createButtonContainer
|
||||||
);
|
);
|
||||||
mainLayout.setMarginTop(300);
|
mainLayout.setMarginTop(300);
|
||||||
@ -166,4 +267,9 @@ public class MenuWorldSelect {
|
|||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class WorldGenUIParams {
|
||||||
|
int worldType = 0;
|
||||||
|
int biomeType = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,6 +110,15 @@ public class StringCarousel extends StandardContainerElement implements Drawable
|
|||||||
currentOption = options.size() - 1;
|
currentOption = options.size() - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOption(int index){
|
||||||
|
this.currentOption = index;
|
||||||
|
this.setText(this.options.get(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentOption(){
|
||||||
|
return this.currentOption;
|
||||||
|
}
|
||||||
|
|
||||||
void generateLetters(){
|
void generateLetters(){
|
||||||
for(Element el : getChildren()){
|
for(Element el : getChildren()){
|
||||||
@ -138,6 +147,7 @@ public class StringCarousel extends StandardContainerElement implements Drawable
|
|||||||
if(focused){
|
if(focused){
|
||||||
setColor(new Vector3f(1,0,0));
|
setColor(new Vector3f(1,0,0));
|
||||||
}
|
}
|
||||||
|
Globals.signalSystem.post(SignalType.YOGA_APPLY, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(Vector3f color){
|
public void setColor(Vector3f color){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user