more context for level creator menu
This commit is contained in:
parent
b0d1a52311
commit
257c5f3a87
@ -4,11 +4,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import electrosphere.client.ui.components.InputMacros;
|
import electrosphere.client.ui.components.InputMacros;
|
||||||
import electrosphere.client.ui.components.VoxelSelectionPanel;
|
import electrosphere.client.ui.components.VoxelSelectionPanel;
|
||||||
|
import electrosphere.client.ui.menu.WindowStrings;
|
||||||
import electrosphere.client.ui.menu.WindowUtils;
|
import electrosphere.client.ui.menu.WindowUtils;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.assetmanager.AssetDataStrings;
|
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||||
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.SceneFile;
|
import electrosphere.entity.scene.SceneFile;
|
||||||
import electrosphere.game.data.voxel.VoxelType;
|
import electrosphere.game.data.voxel.VoxelType;
|
||||||
import electrosphere.renderer.ui.elements.Button;
|
import electrosphere.renderer.ui.elements.Button;
|
||||||
@ -32,6 +34,11 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
*/
|
*/
|
||||||
static final int DEFAULT_GRID_SIZE = 2;
|
static final int DEFAULT_GRID_SIZE = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum selectable size for the grid
|
||||||
|
*/
|
||||||
|
static final int MAX_SELECTABLE_SIZE = 128;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the top level menu for the level editor
|
* Creates the top level menu for the level editor
|
||||||
* @return The actual element containing the menu
|
* @return The actual element containing the menu
|
||||||
@ -187,12 +194,24 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
//
|
//
|
||||||
Div griddedRealmControls = Div.createCol();
|
Div griddedRealmControls = Div.createCol();
|
||||||
{
|
{
|
||||||
|
Label gridSizeLabel = Label.createLabel("" + DEFAULT_GRID_SIZE);
|
||||||
|
|
||||||
|
//add actual slider
|
||||||
griddedRealmControls.addChild(
|
griddedRealmControls.addChild(
|
||||||
InputMacros.createSliderInput("Realm Size", (ValueChangeEvent event) -> {
|
InputMacros.createSliderInput("Realm Size", (ValueChangeEvent event) -> {
|
||||||
float value = event.getAsFloat() * GriddedDataCellManager.MAX_GRID_SIZE;
|
float value = event.getAsFloat() * MenuGeneratorsLevelEditor.MAX_SELECTABLE_SIZE;
|
||||||
sceneFile.getRealmDescriptor().setGriddedRealmSize((int)value);
|
sceneFile.getRealmDescriptor().setGriddedRealmSize((int)value);
|
||||||
|
Globals.signalSystem.post(SignalType.UI_MODIFICATION,() -> {
|
||||||
|
gridSizeLabel.setText("" + (int)value);
|
||||||
|
Globals.signalSystem.post(SignalType.YOGA_APPLY, Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN));
|
||||||
|
});
|
||||||
}, DEFAULT_GRID_SIZE / (float)GriddedDataCellManager.MAX_GRID_SIZE)
|
}, DEFAULT_GRID_SIZE / (float)GriddedDataCellManager.MAX_GRID_SIZE)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//add size label
|
||||||
|
griddedRealmControls.addChild(gridSizeLabel);
|
||||||
|
|
||||||
|
//add voxel type selection
|
||||||
sceneFile.getRealmDescriptor().setGriddedRealmSize(DEFAULT_GRID_SIZE);
|
sceneFile.getRealmDescriptor().setGriddedRealmSize(DEFAULT_GRID_SIZE);
|
||||||
griddedRealmControls.addChild(VoxelSelectionPanel.createVoxelTypeSelectionPanel((VoxelType type) -> {
|
griddedRealmControls.addChild(VoxelSelectionPanel.createVoxelTypeSelectionPanel((VoxelType type) -> {
|
||||||
sceneFile.getRealmDescriptor().setBaseVoxel(type.getId());
|
sceneFile.getRealmDescriptor().setBaseVoxel(type.getId());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user