Added all export/import menus, fixed bad icons for editor blocks

This commit is contained in:
Anuken
2018-05-22 23:56:29 -04:00
parent b20f026c7b
commit c920fa6740
17 changed files with 621 additions and 413 deletions

View File

@@ -1,9 +1,12 @@
package io.anuke.mindustry.ui.dialogs;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.utils.Align;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.ucore.core.Core;
import io.anuke.ucore.scene.ui.Dialog;
import io.anuke.ucore.scene.ui.ScrollPane;
public class FloatingDialog extends Dialog{
@@ -14,13 +17,25 @@ public class FloatingDialog extends Dialog{
getTitleTable().row();
getTitleTable().addImage("white", Palette.accent)
.growX().height(3f).pad(4f);
boolean[] done = {false};
shown(() -> Gdx.app.postRunnable(() ->
forEach(child -> {
if (done[0]) return;
if (child instanceof ScrollPane) {
Core.scene.setScrollFocus(child);
done[0] = true;
}
})));
}
@Override
public void addCloseButton(){
buttons().addImageTextButton("$text.back", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
keyDown(key->{
keyDown(key -> {
if(key == Keys.ESCAPE || key == Keys.BACK)
hide();
});

View File

@@ -5,9 +5,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.game.Difficulty;
import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.io.Map;
import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.scene.event.Touchable;
import io.anuke.ucore.scene.ui.*;
import io.anuke.ucore.scene.ui.layout.Stack;
@@ -26,15 +24,12 @@ public class LevelDialog extends FloatingDialog{
getTitleTable().getCell(title()).growX().center();
getTitleTable().center();
addCloseButton();
setup();
}
public void reload(){
content().clear();
setup();
shown(this::setup);
}
void setup(){
content().clear();
Table maps = new Table();
pane = new ScrollPane(maps);
pane.setFadeScrollBars(false);
@@ -126,13 +121,6 @@ public class LevelDialog extends FloatingDialog{
}
content().add(pane).uniformX();
shown(()->{
//this is necessary for some reason?
Timers.run(2f, ()->{
Core.scene.setScrollFocus(pane);
});
});
}
private void displayGameModeHelp() {