Level selection improvements

This commit is contained in:
Anuken
2018-07-01 17:58:19 -04:00
parent 95d01f0ef5
commit deadcd5339
9 changed files with 790 additions and 765 deletions

View File

@@ -27,7 +27,7 @@ allprojects {
gdxVersion = '1.9.8' gdxVersion = '1.9.8'
roboVMVersion = '2.3.0' roboVMVersion = '2.3.0'
aiVersion = '1.8.1' aiVersion = '1.8.1'
uCoreVersion = '2a244b3d35' uCoreVersion = '6d1ef60c46'
getVersionString = { getVersionString = {
String buildVersion = getBuildVersion() String buildVersion = getBuildVersion()

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

View File

@@ -167,6 +167,7 @@ text.unknown=Unknown
text.custom=Custom text.custom=Custom
text.builtin=Built-In text.builtin=Built-In
text.map.delete.confirm=Are you sure you want to delete this map? This action cannot be undone! text.map.delete.confirm=Are you sure you want to delete this map? This action cannot be undone!
text.map.random=[accent]Random Map
text.editor.slope=\\ text.editor.slope=\\
text.editor.openin=Open In Editor text.editor.openin=Open In Editor
text.editor.oregen=Ore Generation text.editor.oregen=Ore Generation

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 133 KiB

View File

@@ -65,10 +65,11 @@ io.anuke.ucore.scene.ui.ImageButton$ImageButtonStyle: {
static-down: {up: button-down }, static-down: {up: button-down },
toggle: {checked: button-down, down: button-down, up: button, imageDisabledColor: lightgray, imageUpColor: white }, toggle: {checked: button-down, down: button-down, up: button, imageDisabledColor: lightgray, imageUpColor: white },
togglemap: {down: button-map-down, up: button-map }, togglemap: {down: button-map-down, up: button-map },
select: {checked: button-select, up: clear } select: {checked: button-select, up: clear },
clear: {down: clear-down, up: clear, over: clear-over},
}, },
io.anuke.ucore.scene.ui.ScrollPane$ScrollPaneStyle: { io.anuke.ucore.scene.ui.ScrollPane$ScrollPaneStyle: {
default: {background: border, vScroll: scroll, vScrollKnob: scroll-knob-vertical}, default: {background: border, vScroll: scroll, vScrollKnob: scroll-knob-vertical-black},
horizontal: {background: border, vScroll: scroll, vScrollKnob: scroll-knob-vertical, hScroll: scroll-horizontal, hScrollKnob: scroll-knob-horizontal}, horizontal: {background: border, vScroll: scroll, vScrollKnob: scroll-knob-vertical, hScroll: scroll-horizontal, hScrollKnob: scroll-knob-horizontal},
volume: {background: button-map, vScroll: scroll, vScrollKnob: scroll-knob-vertical}, volume: {background: button-map, vScroll: scroll, vScrollKnob: scroll-knob-vertical},
clear: {vScroll: scroll, vScrollKnob: scroll-knob-vertical}, clear: {vScroll: scroll, vScrollKnob: scroll-knob-vertical},

View File

@@ -1,16 +1,20 @@
package io.anuke.mindustry.ui.dialogs; package io.anuke.mindustry.ui.dialogs;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Align;
import io.anuke.mindustry.game.Difficulty; import io.anuke.mindustry.game.Difficulty;
import io.anuke.mindustry.game.GameMode; import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.io.Map; import io.anuke.mindustry.io.Map;
import io.anuke.mindustry.ui.BorderImage;
import io.anuke.ucore.core.Settings; import io.anuke.ucore.core.Settings;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.scene.event.Touchable; import io.anuke.ucore.scene.event.Touchable;
import io.anuke.ucore.scene.ui.*; import io.anuke.ucore.scene.ui.ButtonGroup;
import io.anuke.ucore.scene.ui.layout.Stack; import io.anuke.ucore.scene.ui.ImageButton;
import io.anuke.ucore.scene.ui.ScrollPane;
import io.anuke.ucore.scene.ui.TextButton;
import io.anuke.ucore.scene.ui.layout.Table; import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.scene.utils.Cursors; import io.anuke.ucore.scene.utils.Cursors;
import io.anuke.ucore.scene.utils.Elements; import io.anuke.ucore.scene.utils.Elements;
@@ -31,7 +35,8 @@ public class LevelDialog extends FloatingDialog{
content().clear(); content().clear();
Table maps = new Table(); Table maps = new Table();
ScrollPane pane = new ScrollPane(maps); maps.marginRight(14);
ScrollPane pane = new ScrollPane(maps, "clear-black");
pane.setFadeScrollBars(false); pane.setFadeScrollBars(false);
int maxwidth = 4; int maxwidth = 4;
@@ -80,6 +85,8 @@ public class LevelDialog extends FloatingDialog{
content().add(sdif); content().add(sdif);
content().row(); content().row();
float images = 146f;
int i = 0; int i = 0;
for(Map map : world.maps().all()){ for(Map map : world.maps().all()){
@@ -87,38 +94,29 @@ public class LevelDialog extends FloatingDialog{
maps.row(); maps.row();
} }
Table inset = new Table("pane-button"); ImageButton image = new ImageButton(new TextureRegion(map.texture), "clear");
inset.add("[accent]" + Bundles.get("map."+map.name+".name", map.name)).pad(3f); image.margin(5);
inset.row(); image.getImageCell().size(images);
inset.label((() -> Bundles.format("text.level.highscore", Settings.getInt("hiscore" + map.name, 0)))).pad(3f); image.top();
inset.pack();
float images = 154f;
Stack stack = new Stack();
Image back = new Image("white");
back.setColor(Color.valueOf("646464"));
ImageButton image = new ImageButton(new TextureRegion(map.texture), "togglemap");
image.row(); image.row();
image.add(inset).width(images+6); image.add("[accent]" + Bundles.get("map."+map.name+".name", map.name)).pad(3f).growX().wrap().get().setAlignment(Align.center, Align.center);
image.row();
image.label((() -> Bundles.format("text.level.highscore", Settings.getInt("hiscore" + map.name, 0)))).pad(3f);
BorderImage border = new BorderImage(map.texture, 3f);
image.replaceImage(border);
image.clicked(() -> { image.clicked(() -> {
hide(); hide();
control.playMap(map); control.playMap(map);
}); });
image.getImageCell().size(images);
stack.add(back); maps.add(image).width(170).fillY().top().pad(4f);
stack.add(image);
maps.add(stack).width(170).top().pad(4f);
i ++; i ++;
} }
maps.addImageButton("icon-editor", 16*4, () -> { ImageButton genb = maps.addImageButton("icon-editor", "clear", 16*3, () -> {
hide(); hide();
ui.loadfrag.show(); ui.loadfrag.show();
@@ -131,7 +129,16 @@ public class LevelDialog extends FloatingDialog{
Gdx.app.postRunnable(ui.loadfrag::hide); Gdx.app.postRunnable(ui.loadfrag::hide);
}); });
}); });
}).size(170, 154f + 73).pad(4f); }).width(170).fillY().pad(4f).get();
genb.top();
genb.margin(5);
genb.clearChildren();
genb.add(new BorderImage(Draw.region("icon-generated"), 3f)).size(images);
genb.row();
genb.add("$text.map.random").growX().wrap().pad(3f).get().setAlignment(Align.center, Align.center);
genb.row();
genb.add("<generated>").pad(3f);
content().add(pane).uniformX(); content().add(pane).uniformX();
} }

View File

@@ -33,7 +33,7 @@ public class MenuFragment implements Fragment{
add(new MenuButton("icon-editor", "$text.editor", () -> ui.loadAnd(ui.editor::show))); add(new MenuButton("icon-editor", "$text.editor", () -> ui.loadAnd(ui.editor::show)));
add(new MenuButton("icon-menu", "$text.maps", ui.maps::show)); add(new MenuButton("icon-map", "$text.maps", ui.maps::show));
row(); row();
@@ -64,8 +64,10 @@ public class MenuFragment implements Fragment{
new imagebutton("icon-play-2", isize, ui.levels::show).text("$text.play").padTop(4f); new imagebutton("icon-play-2", isize, ui.levels::show).text("$text.play").padTop(4f);
new imagebutton("icon-tutorial", isize, () -> ui.showInfo("The tutorial is currently not yet implemented.")) //new imagebutton("icon-tutorial", isize, () -> ui.showInfo("The tutorial is currently not yet implemented."))
.text("$text.tutorial").padTop(4f); // .text("$text.tutorial").padTop(4f);
new imagebutton("icon-map", isize, ui.maps::show).text("$text.maps").padTop(4f);
new imagebutton("icon-load", isize, ui.load::show).text("$text.load").padTop(4f); new imagebutton("icon-load", isize, ui.load::show).text("$text.load").padTop(4f);