Filled map list, added more blocks
This commit is contained in:
@@ -16,7 +16,7 @@ import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
import io.anuke.ucore.scene.utils.Elements;
|
||||
|
||||
public class LevelDialog extends FloatingDialog{
|
||||
private Map selectedMap = Map.delta;
|
||||
private Map selectedMap = Map.maze;
|
||||
private TextureRegion region = new TextureRegion();
|
||||
|
||||
public LevelDialog(){
|
||||
|
||||
@@ -8,6 +8,8 @@ import com.badlogic.gdx.Gdx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.ucore.scene.builders.build;
|
||||
import io.anuke.ucore.scene.builders.imagebutton;
|
||||
import io.anuke.ucore.scene.ui.ConfirmDialog;
|
||||
import io.anuke.ucore.scene.ui.layout.Cell;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
@@ -17,58 +19,85 @@ public class MenuDialog extends FloatingDialog{
|
||||
private LoadDialog load = new LoadDialog();
|
||||
public boolean wasPaused = false;
|
||||
|
||||
public MenuDialog(){
|
||||
public MenuDialog() {
|
||||
super("Paused");
|
||||
setup();
|
||||
}
|
||||
|
||||
|
||||
void setup(){
|
||||
content().defaults().width(220).height(50).units(Unit.dp);
|
||||
|
||||
content().addButton("Back", ()->{
|
||||
hide();
|
||||
if(!wasPaused)
|
||||
GameState.set(State.playing);
|
||||
});
|
||||
|
||||
shown(()->{
|
||||
shown(() -> {
|
||||
wasPaused = GameState.is(State.paused);
|
||||
GameState.set(State.paused);
|
||||
});
|
||||
|
||||
content().row();
|
||||
content().addButton("Settings", ()->{
|
||||
ui.showPrefs();
|
||||
});
|
||||
|
||||
if(!Vars.android){
|
||||
content().row();
|
||||
content().addButton("Controls", ()->{
|
||||
ui.showControls();
|
||||
});
|
||||
}
|
||||
|
||||
if(Gdx.app.getType() != ApplicationType.WebGL){
|
||||
content().row();
|
||||
content().addButton("Save Game", ()->{
|
||||
save.show();
|
||||
});
|
||||
|
||||
content().row();
|
||||
content().addButton("Load Game", ()->{
|
||||
load.show();
|
||||
});
|
||||
}
|
||||
|
||||
content().row();
|
||||
content().addButton("Back to menu", ()->{
|
||||
new ConfirmDialog("Confirm", "Are you sure you want to quit?", ()->{
|
||||
content().defaults().width(220).height(50).units(Unit.dp);
|
||||
|
||||
content().addButton("Back", () -> {
|
||||
hide();
|
||||
GameState.set(State.menu);
|
||||
}){{
|
||||
for(Cell<?> cell : getButtonTable().getCells())
|
||||
cell.pad(3).size(180, 44).units(Unit.dp);
|
||||
}}.show();
|
||||
});
|
||||
if(!wasPaused)
|
||||
GameState.set(State.playing);
|
||||
});
|
||||
|
||||
content().row();
|
||||
content().addButton("Settings", () -> {
|
||||
ui.showPrefs();
|
||||
});
|
||||
|
||||
if(Gdx.app.getType() != ApplicationType.WebGL){
|
||||
content().row();
|
||||
content().addButton("Save Game", () -> {
|
||||
save.show();
|
||||
});
|
||||
|
||||
content().row();
|
||||
content().addButton("Load Game", () -> {
|
||||
load.show();
|
||||
});
|
||||
}
|
||||
|
||||
content().row();
|
||||
content().addButton("Quit", () -> {
|
||||
new ConfirmDialog("Confirm", "Are you sure you want to quit?", () -> {
|
||||
hide();
|
||||
GameState.set(State.menu);
|
||||
}){
|
||||
{
|
||||
for(Cell<?> cell : getButtonTable().getCells())
|
||||
cell.pad(3).size(180, 44).units(Unit.dp);
|
||||
}
|
||||
}.show();
|
||||
});
|
||||
|
||||
}else{
|
||||
build.begin(content());
|
||||
|
||||
content().defaults().size(120f).pad(5).units(Unit.dp);
|
||||
float isize = Unit.dp.inPixels(14f*4);
|
||||
|
||||
new imagebutton("icon-play-2", isize, () -> {
|
||||
hide();
|
||||
if(!wasPaused)
|
||||
GameState.set(State.playing);
|
||||
}).text("Back").padTop(4f);
|
||||
|
||||
new imagebutton("icon-tools", isize, () -> ui.showPrefs()).text("Settings").padTop(4f);
|
||||
|
||||
new imagebutton("icon-save", isize, ()-> save.show()).text("Save").padTop(4f);
|
||||
|
||||
new imagebutton("icon-load", isize, () -> load.show()).text("Load").padTop(4f);
|
||||
|
||||
new imagebutton("icon-quit", isize, () -> {
|
||||
new ConfirmDialog("Confirm", "Are you sure you want to quit?", () -> {
|
||||
hide();
|
||||
GameState.set(State.menu);
|
||||
}){{
|
||||
for(Cell<?> cell : getButtonTable().getCells())
|
||||
cell.pad(3).size(180, 44).units(Unit.dp);
|
||||
}}.show();
|
||||
}).text("Quit").padTop(4f);
|
||||
|
||||
build.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,9 +52,7 @@ public class MenuFragment implements Fragment{
|
||||
|
||||
new imagebutton("icon-play-2", isize, () -> ui.showLevels()).text("Play").padTop(4f);
|
||||
|
||||
new imagebutton("icon-tutorial", isize, ()->{
|
||||
control.playMap(Map.tutorial);
|
||||
}).text("Tutorial").padTop(4f);
|
||||
new imagebutton("icon-tutorial", isize, ()-> control.playMap(Map.tutorial)).text("Tutorial").padTop(4f);
|
||||
|
||||
new imagebutton("icon-load", isize, () -> ui.showLoadGame()).text("Load").padTop(4f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user