Merge branch 'master' of https://github.com/Anuken/Mindustry into 4.0
This commit is contained in:
@@ -57,7 +57,7 @@ public class Vars{
|
||||
public static float fontscale = Math.max(Unit.dp.scl(1f)/2f, 0.5f);
|
||||
//camera zoom displayed on startup
|
||||
public static final int baseCameraScale = Math.round(Unit.dp.scl(4));
|
||||
//how much the zoom changes every zoom button press
|
||||
//how much the zoom changes every zoom button press (unused?)
|
||||
public static final int zoomScale = Math.round(Unit.dp.scl(1));
|
||||
//if true, player speed will be increased, massive amounts of resources will be given on start, and other debug options will be available
|
||||
public static boolean debug = false;
|
||||
|
||||
@@ -35,6 +35,8 @@ import io.anuke.ucore.function.Callable;
|
||||
import io.anuke.ucore.graphics.*;
|
||||
import io.anuke.ucore.modules.RendererModule;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
import io.anuke.ucore.scene.utils.Cursors;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Tmp;
|
||||
|
||||
@@ -69,6 +71,12 @@ public class Renderer extends RendererModule{
|
||||
}
|
||||
});
|
||||
|
||||
Cursors.cursorScaling = 3;
|
||||
Cursors.outlineColor = Color.valueOf("444444");
|
||||
Cursors.arrow = Cursors.loadCursor("cursor");
|
||||
Cursors.hand = Cursors.loadCursor("hand");
|
||||
Cursors.ibeam = Cursors.loadCursor("ibar");
|
||||
|
||||
clearColor = Hue.lightness(0.4f);
|
||||
clearColor.a = 1f;
|
||||
|
||||
@@ -426,7 +434,8 @@ public class Renderer extends RendererModule{
|
||||
if((input.recipe != null && state.inventory.hasItems(input.recipe.requirements) && (!ui.hasMouse() || android)
|
||||
&& control.input().drawPlace())){
|
||||
|
||||
input.placeMode.draw(control.input().getBlockX(), control.input().getBlockY(), control.input().getBlockEndX(), control.input().getBlockEndY());
|
||||
input.placeMode.draw(control.input().getBlockX(), control.input().getBlockY(),
|
||||
control.input().getBlockEndX(), control.input().getBlockEndY());
|
||||
|
||||
Lines.stroke(1f);
|
||||
Draw.color(Color.SCARLET);
|
||||
@@ -442,9 +451,15 @@ public class Renderer extends RendererModule{
|
||||
if(input.breakMode == PlaceMode.holdDelete)
|
||||
input.breakMode.draw(tilex, tiley, 0, 0);
|
||||
|
||||
}else if(input.breakMode.delete && control.input().drawPlace() && input.recipe == null){
|
||||
input.breakMode.draw(control.input().getBlockX(), control.input().getBlockY(),
|
||||
control.input().getBlockEndX(), control.input().getBlockEndY());
|
||||
}else if(input.breakMode.delete && control.input().drawPlace()
|
||||
&& (input.recipe == null || !state.inventory.hasItems(input.recipe.requirements))
|
||||
&& (input.placeMode.delete || input.breakMode.both || !android)){
|
||||
|
||||
if(input.breakMode == PlaceMode.holdDelete)
|
||||
input.breakMode.draw(tilex, tiley, 0, 0);
|
||||
else
|
||||
input.breakMode.draw(control.input().getBlockX(), control.input().getBlockY(),
|
||||
control.input().getBlockEndX(), control.input().getBlockEndY());
|
||||
}
|
||||
|
||||
if(ui.toolfrag.confirming){
|
||||
|
||||
@@ -18,6 +18,10 @@ public enum GameMode{
|
||||
public boolean infiniteResources;
|
||||
public boolean disableWaveTimer;
|
||||
|
||||
public String description(){
|
||||
return Bundles.get("mode."+name()+".description");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return Bundles.get("mode."+name()+".name");
|
||||
|
||||
@@ -20,9 +20,9 @@ public class AndroidInput extends InputHandler{
|
||||
public float lmousex, lmousey;
|
||||
public float mousex, mousey;
|
||||
public boolean brokeBlock = false;
|
||||
public boolean placing = false;
|
||||
|
||||
private boolean enableHold = false;
|
||||
private boolean placing = false;
|
||||
private float warmup;
|
||||
private float warmupDelay = 20;
|
||||
|
||||
@@ -48,6 +48,7 @@ public class AndroidInput extends InputHandler{
|
||||
}else if(pointer == 0 && !breakMode.pan && breaking() && drawPlace()){
|
||||
breakMode.released(getBlockX(), getBlockY(), getBlockEndX(), getBlockEndY());
|
||||
}
|
||||
|
||||
placing = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class GestureHandler extends GestureAdapter{
|
||||
if(control.showCursor() && !Inputs.keyDown("select")) return false;
|
||||
|
||||
if(!control.showCursor() && !(control.input().recipe != null
|
||||
&& state.inventory.hasItems(control.input().recipe.requirements) && control.input().placeMode.lockCamera) &&
|
||||
&& control.input().placeMode.lockCamera) &&
|
||||
!(control.input().recipe == null && control.input().breakMode.lockCamera)){
|
||||
float dx = deltaX*Core.camera.zoom/Core.cameraScale, dy = deltaY*Core.camera.zoom/Core.cameraScale;
|
||||
player.x -= dx;
|
||||
|
||||
@@ -164,7 +164,6 @@ public enum PlaceMode{
|
||||
}
|
||||
|
||||
public void released(int tilex, int tiley, int endx, int endy){
|
||||
|
||||
process(tilex, tiley, endx, endy);
|
||||
tilex = this.tilex; tiley = this.tiley;
|
||||
endx = this.endx; endy = this.endy;
|
||||
|
||||
32
core/src/io/anuke/mindustry/ui/Links.java
Normal file
32
core/src/io/anuke/mindustry/ui/Links.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
public class Links {
|
||||
private static final LinkEntry[] links = {
|
||||
new LinkEntry("discord", "https://discord.gg/BKADYds", Color.valueOf("7289da")),
|
||||
new LinkEntry("trello", "https://trello.com/b/aE2tcUwF", Color.valueOf("026aa7")),
|
||||
new LinkEntry("wiki", "http://mindustry.wikia.com/wiki/Mindustry_Wiki", Color.valueOf("0f142f")),
|
||||
new LinkEntry("itch.io", "https://anuke.itch.io/mindustry", Color.valueOf("fa5c5c")),
|
||||
new LinkEntry("google-play", "https://play.google.com/store/apps/details?id=io.anuke.mindustry", Color.valueOf("689f38")),
|
||||
new LinkEntry("github", "https://github.com/Anuken/Mindustry/", Color.valueOf("24292e")),
|
||||
new LinkEntry("dev-builds", "https://github.com/Anuken/Mindustry/wiki", Color.valueOf("fafbfc")),
|
||||
};
|
||||
|
||||
public static LinkEntry[] getLinks(){
|
||||
return links;
|
||||
}
|
||||
|
||||
public static class LinkEntry{
|
||||
public final String name, description, link;
|
||||
public final Color color;
|
||||
|
||||
public LinkEntry(String name, String link, Color color) {
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.description = Bundles.getNotNull("text.link." + name +".description");
|
||||
this.link = link;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,37 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.function.Listenable;
|
||||
import io.anuke.ucore.scene.ui.Button;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
import io.anuke.ucore.scene.ui.TextButton;
|
||||
|
||||
public class MenuButton extends Button{
|
||||
private static boolean hasInvalid = false;
|
||||
private String text;
|
||||
private boolean added = false;
|
||||
|
||||
public MenuButton(String text, PressGroup group, Listenable clicked){
|
||||
super("menu");
|
||||
this.text = text;
|
||||
BitmapFont font = Core.skin.getFont("title");
|
||||
for(char c : Bundles.get(text.substring(1)).toCharArray()){
|
||||
if(!font.getData().hasGlyph(c)){
|
||||
hasInvalid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
clicked(clicked);
|
||||
group.add(this);
|
||||
public class MenuButton extends TextButton{
|
||||
|
||||
public MenuButton(String icon, String text, Listenable clicked){
|
||||
this(icon, text, null, clicked);
|
||||
}
|
||||
|
||||
public MenuButton(String icon, String text, String description, Listenable clicked){
|
||||
super("default");
|
||||
float s = 70f;
|
||||
|
||||
@Override
|
||||
public void layout() {
|
||||
super.layout();
|
||||
if(added)
|
||||
return;
|
||||
added = true;
|
||||
String style = "title";
|
||||
float scale = 4f;
|
||||
if(hasInvalid){
|
||||
style = "default";
|
||||
scale = Unit.dp.scl(1f);
|
||||
}
|
||||
add(text, style, scale).color(hasInvalid ? Color.DARK_GRAY : Color.WHITE);
|
||||
clicked(clicked);
|
||||
|
||||
if(hasInvalid){
|
||||
row();
|
||||
add(text, style, scale).padTop(Unit.dp.scl(-Core.font.getData().lineHeight * scale * 2f - 4f)).color(Color.WHITE);
|
||||
}
|
||||
clearChildren();
|
||||
|
||||
margin(0);
|
||||
|
||||
table(t -> {
|
||||
t.addImage(icon).size(14*3);
|
||||
t.update(() -> t.setBackground(getClickListener().isOver() || getClickListener().isVisualPressed() ? "button-over" : "button"));
|
||||
}).size(s - 5, s);
|
||||
|
||||
|
||||
table(t -> {
|
||||
t.add(text);
|
||||
if(description != null){
|
||||
t.row();
|
||||
t.add(description).color(Color.LIGHT_GRAY);
|
||||
}
|
||||
}).padLeft(5).growX();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,69 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.ui.Links;
|
||||
import io.anuke.mindustry.ui.Links.LinkEntry;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
public class AboutDialog extends FloatingDialog {
|
||||
|
||||
public AboutDialog(){
|
||||
super("$text.about.button");
|
||||
|
||||
addCloseButton();
|
||||
content().add("$text.about");
|
||||
|
||||
float h = 80f;
|
||||
float w = 600f;
|
||||
|
||||
Table in = new Table();
|
||||
ScrollPane pane = new ScrollPane(in, "clear");
|
||||
|
||||
for(LinkEntry link : Links.getLinks()){
|
||||
Table table = new Table("button");
|
||||
table.margin(0);
|
||||
table.table(img -> {
|
||||
img.addImage("white").height(h - 5).width(40f).color(link.color);
|
||||
img.row();
|
||||
img.addImage("white").height(5).width(40f).color(link.color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
|
||||
}).expandY();
|
||||
|
||||
table.table(i -> {
|
||||
i.background("button");
|
||||
i.addImage("icon-" + link.name).size(14*3f);
|
||||
}).size(h-5, h);
|
||||
|
||||
table.table(inset -> {
|
||||
inset.add("[accent]"+link.name.replace("-", " ")).growX().left();
|
||||
inset.row();
|
||||
inset.labelWrap(link.description).width(w - 100f).color(Color.LIGHT_GRAY).growX();
|
||||
}).padLeft(8);
|
||||
|
||||
table.addImageButton("icon-link", 14*3, () -> {
|
||||
if(!Gdx.net.openURI(link.link)){
|
||||
Vars.ui.showError("$text.linkfail");
|
||||
Gdx.app.getClipboard().setContents(link.link);
|
||||
}
|
||||
}).size(h-5, h);
|
||||
|
||||
in.add(table).size(w, h).padTop(5).row();
|
||||
}
|
||||
|
||||
shown(() -> Timers.run(1f, () -> Core.scene.setScrollFocus(pane)));
|
||||
|
||||
content().add(pane).growX();
|
||||
|
||||
buttons().addButton("$text.credits", this::showCredits).size(200f, 64f);
|
||||
}
|
||||
|
||||
private void showCredits(){
|
||||
FloatingDialog dialog = new FloatingDialog("$text.credits");
|
||||
dialog.addCloseButton();
|
||||
dialog.content().add("$text.about");
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,52 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Colors;
|
||||
import io.anuke.ucore.scene.ui.Dialog;
|
||||
|
||||
import static io.anuke.mindustry.Vars.discordURL;
|
||||
import static io.anuke.mindustry.Vars.ui;
|
||||
|
||||
public class DiscordDialog extends Dialog {
|
||||
|
||||
public DiscordDialog(){
|
||||
super("Discord", "dialog");
|
||||
super("", "dialog");
|
||||
|
||||
float h = 70f;
|
||||
|
||||
content().margin(12f);
|
||||
content().add("$text.discord");
|
||||
content().row();
|
||||
content().add("[orange]"+ discordURL);
|
||||
buttons().defaults().size(200f, 50);
|
||||
buttons().addButton("$text.openlink", () -> Gdx.net.openURI(discordURL));
|
||||
|
||||
Color color = Color.valueOf("7289da");
|
||||
|
||||
content().table(t -> {
|
||||
t.background("button").margin(0);
|
||||
|
||||
t.table(img -> {
|
||||
img.addImage("white").height(h - 5).width(40f).color(color);
|
||||
img.row();
|
||||
img.addImage("white").height(5).width(40f).color(color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
|
||||
}).expandY();
|
||||
|
||||
t.table(i -> {
|
||||
i.background("button");
|
||||
i.addImage("icon-discord").size(14 * 3);
|
||||
}).size(h).left();
|
||||
|
||||
t.add("$text.discord").color(Colors.get("accent")).growX().padLeft(10f);
|
||||
}).size(470f, h).pad(10f);
|
||||
|
||||
buttons().defaults().size(170f, 50);
|
||||
|
||||
buttons().addButton("$text.back", this::hide);
|
||||
buttons().addButton("$text.copylink", () ->{
|
||||
Gdx.app.getClipboard().setContents(discordURL);
|
||||
});
|
||||
buttons().addButton("$text.openlink", () ->{
|
||||
if(!Gdx.net.openURI(discordURL)){
|
||||
ui.showError("$text.linkfail");
|
||||
Gdx.app.getClipboard().setContents(discordURL);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class LevelDialog extends FloatingDialog{
|
||||
private Map selectedMap = world.maps().getMap(0);
|
||||
private TextureRegion region = new TextureRegion();
|
||||
private ScrollPane pane;
|
||||
|
||||
public LevelDialog(){
|
||||
@@ -56,6 +55,7 @@ public class LevelDialog extends FloatingDialog{
|
||||
group.add(b[0]);
|
||||
selmode.add(b[0]).size(130f, 54f);
|
||||
}
|
||||
selmode.addButton("?", this::displayGameModeHelp).size(50f, 54f).padLeft(18f);
|
||||
|
||||
content().add(selmode);
|
||||
content().row();
|
||||
@@ -171,4 +171,23 @@ public class LevelDialog extends FloatingDialog{
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void displayGameModeHelp() {
|
||||
FloatingDialog d = new FloatingDialog(Bundles.get("mode.text.help.title"));
|
||||
d.setFillParent(false);
|
||||
Table table = new Table();
|
||||
table.defaults().pad(1f);
|
||||
ScrollPane pane = new ScrollPane(table, "clear");
|
||||
pane.setFadeScrollBars(false);
|
||||
table.row();
|
||||
for(GameMode mode : GameMode.values()){
|
||||
table.labelWrap("[accent]" + mode.toString() + ":[] [lightgray]" + mode.description()).width(600f);
|
||||
table.row();
|
||||
}
|
||||
|
||||
d.content().add(pane);
|
||||
d.buttons().addButton("$text.ok", d::hide).size(110, 50).pad(10f);
|
||||
d.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ public class BackgroundFragment implements Fragment {
|
||||
TextureRegion back = Draw.region("background");
|
||||
float backscl = Math.max(Gdx.graphics.getWidth() / (float)back.getRegionWidth() * 1.5f, Unit.dp.scl(5f));
|
||||
|
||||
Draw.alpha(0.7f);
|
||||
Core.batch.draw(back, w/2 - back.getRegionWidth()*backscl/2 +240f, h/2 - back.getRegionHeight()*backscl/2 + 250f,
|
||||
Draw.alpha(0.5f);
|
||||
Core.batch.draw(back, w/2 - back.getRegionWidth()*backscl/2, h/2 - back.getRegionHeight()*backscl/2,
|
||||
back.getRegionWidth()*backscl, back.getRegionHeight()*backscl);
|
||||
|
||||
boolean portrait = Gdx.graphics.getWidth() < Gdx.graphics.getHeight();
|
||||
@@ -31,7 +31,7 @@ public class BackgroundFragment implements Fragment {
|
||||
float logoh = logo.getRegionHeight()*logoscl;
|
||||
|
||||
Draw.color();
|
||||
Core.batch.draw(logo, w/2 - logow/2, h - logoh + 15 + (portrait ? -Unit.dp.scl(30f) : 0f), logow, logoh);
|
||||
Core.batch.draw(logo, w/2 - logow/2, h - logoh + 15 - Unit.dp.scl(portrait ? 30f : 30), logow, logoh);
|
||||
}).visible(() -> state.is(State.menu)).grow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.io.Platform;
|
||||
import io.anuke.mindustry.io.Version;
|
||||
import io.anuke.mindustry.ui.MenuButton;
|
||||
import io.anuke.mindustry.ui.PressGroup;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.ucore.scene.builders.imagebutton;
|
||||
import io.anuke.ucore.scene.builders.label;
|
||||
import io.anuke.ucore.scene.builders.table;
|
||||
@@ -21,36 +20,38 @@ public class MenuFragment implements Fragment{
|
||||
|
||||
if(!android){
|
||||
new table(){{
|
||||
PressGroup group = new PressGroup();
|
||||
|
||||
float scale = 4f;
|
||||
defaults().size(140*scale, 21*scale).pad(-10f);
|
||||
|
||||
add(new MenuButton("$text.play", group, ui.levels::show));
|
||||
float w = 200f;
|
||||
float bw = w * 2f + 10f;
|
||||
|
||||
defaults().size(w, 70f).padTop(5).padRight(5);
|
||||
|
||||
add(new MenuButton("icon-play-2", "$text.play", MenuFragment.this::showPlaySelect)).width(bw).colspan(2);
|
||||
|
||||
row();
|
||||
|
||||
if(Platform.instance.canJoinGame()) {
|
||||
add(new MenuButton("$text.joingame", group, ui.join::show));
|
||||
row();
|
||||
}
|
||||
add(new MenuButton("icon-editor", "$text.editor", () -> {
|
||||
if(gwt){
|
||||
ui.showInfo("$text.editor.web");
|
||||
}else{
|
||||
ui.editor.show();
|
||||
}
|
||||
}));
|
||||
|
||||
add(new MenuButton("$text.tutorial", group, ()-> control.playMap(world.maps().getMap("tutorial"))));
|
||||
add(new MenuButton("icon-tools", "$text.settings", ui.settings::show));
|
||||
|
||||
row();
|
||||
|
||||
add(new MenuButton("$text.loadgame", group, ui.load::show));
|
||||
row();
|
||||
add(new MenuButton("icon-info", "$text.about.button", ui.about::show));
|
||||
|
||||
add(new MenuButton("icon-menu", "$text.changelog.title", ui.changelog::show));
|
||||
|
||||
if(!gwt){
|
||||
add(new MenuButton("$text.editor", group, ui.editor::show));
|
||||
row();
|
||||
}
|
||||
|
||||
add(new MenuButton("$text.settings", group, ui.settings::show));
|
||||
row();
|
||||
|
||||
if(!gwt){
|
||||
add(new MenuButton("$text.quit", group, Gdx.app::exit));
|
||||
add(new MenuButton("icon-exit", "$text.quit", Gdx.app::exit)).width(bw).colspan(2);
|
||||
}
|
||||
|
||||
get().margin(16);
|
||||
}}.end();
|
||||
|
||||
@@ -79,18 +80,14 @@ public class MenuFragment implements Fragment{
|
||||
}}.end();
|
||||
}
|
||||
}}.end();
|
||||
|
||||
//extra icons in top right
|
||||
new table(){{
|
||||
atop().aright();
|
||||
if(Platform.instance.hasDiscord()){
|
||||
new imagebutton("icon-discord", 30f, ui.discord::show).margin(14);
|
||||
}
|
||||
if(!Vars.android) {
|
||||
new imagebutton("icon-info", 30f, ui.about::show).margin(14);
|
||||
}
|
||||
new imagebutton("icon-menu", 30f, ui.changelog::show).margin(14);
|
||||
}}.end().visible(()->state.is(State.menu));
|
||||
|
||||
//discord icon in top right
|
||||
if(Platform.instance.hasDiscord()) {
|
||||
new table() {{
|
||||
abottom().atop().aright();
|
||||
get().addButton("", "discord", ui.discord::show);
|
||||
}}.end().visible(() -> state.is(State.menu));
|
||||
}
|
||||
|
||||
//version info
|
||||
new table(){{
|
||||
@@ -99,4 +96,41 @@ public class MenuFragment implements Fragment{
|
||||
new label("Mindustry " + Version.code + " " + Version.type + " / " + Version.buildName);
|
||||
}}.end();
|
||||
}
|
||||
|
||||
private void showPlaySelect(){
|
||||
float w = 200f;
|
||||
float bw = w * 2f + 10f;
|
||||
|
||||
FloatingDialog dialog = new FloatingDialog("$text.play");
|
||||
dialog.addCloseButton();
|
||||
dialog.content().defaults().height(70f).width(w).padRight(5f);
|
||||
|
||||
dialog.content().add(new MenuButton("icon-play-2", "$text.newgame", () -> {
|
||||
dialog.hide();
|
||||
ui.levels.show();
|
||||
})).width(bw).colspan(2);
|
||||
dialog.content().row();
|
||||
|
||||
dialog.content().add(new MenuButton("icon-add", "$text.joingame", () -> {
|
||||
if(Platform.instance.canJoinGame()){
|
||||
ui.join.show();
|
||||
dialog.hide();
|
||||
}else{
|
||||
ui.showInfo("$text.multiplayer.web");
|
||||
}
|
||||
}));
|
||||
dialog.content().add(new MenuButton("icon-tutorial", "$text.tutorial", ()-> {
|
||||
control.playMap(world.maps().getMap("tutorial"));
|
||||
dialog.hide();
|
||||
}));
|
||||
|
||||
dialog.content().row();
|
||||
|
||||
dialog.content().add(new MenuButton("icon-load", "$text.loadgame", () -> {
|
||||
ui.load.show();
|
||||
dialog.hide();
|
||||
})).width(bw).colspan(2);
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.input.AndroidInput;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.input.PlaceMode;
|
||||
import io.anuke.ucore.core.Core;
|
||||
@@ -128,7 +129,7 @@ public class PlacementFragment implements Fragment{
|
||||
|
||||
defaults().padBottom(-5.5f);
|
||||
|
||||
new imagebutton("icon-" + mode.name(), "toggle", 10 * 3, () -> {
|
||||
ImageButton button = new imagebutton("icon-" + mode.name(), "toggle", 10 * 3, () -> {
|
||||
control.input().resetCursor();
|
||||
input.breakMode = mode;
|
||||
input.lastBreakMode = mode;
|
||||
@@ -138,7 +139,15 @@ public class PlacementFragment implements Fragment{
|
||||
input.placeMode = input.lastPlaceMode;
|
||||
}
|
||||
modeText(Bundles.format("text.mode.break", mode.toString()));
|
||||
}).group(breakGroup).get().setName(mode.name());
|
||||
}).group(breakGroup).get();
|
||||
|
||||
button.setName(mode.name());
|
||||
button.released(() -> {
|
||||
//TODO hack
|
||||
if(mode == PlaceMode.areaDelete){
|
||||
((AndroidInput)input).placing = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}}.end().get();
|
||||
@@ -215,6 +224,7 @@ public class PlacementFragment implements Fragment{
|
||||
|
||||
if(!show){
|
||||
control.input().breakMode = PlaceMode.none;
|
||||
if(control.input().placeMode.delete) control.input().placeMode = PlaceMode.none;
|
||||
breaktable.actions(Actions.translateBy(-breaktable.getWidth() - 5, 0, dur, in), Actions.call(() -> shown = false));
|
||||
}else{
|
||||
shown = true;
|
||||
|
||||
Reference in New Issue
Block a user