diff --git a/README.md b/README.md index b1bab5dcff..e762c564ce 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A pixelated sandbox tower defense game made using [LibGDX](https://libgdx.badlogicgames.com/). Winner of the [GDL Metal Monstrosity Jam](https://itch.io/jam/gdl---metal-monstrosity-jam). -_[Issue tracker](https://waffle.io/Anuken/Mindustry)_ +_[Issue tracker](https://waffle.io/Anuken/Mindustry)_ _[TODO list](TODO.md)_ _[Wiki](http://mindustry.wikia.com/wiki/Mindustry_Wiki)_ _[Discord](https://discord.gg/r8BkXNd)_ @@ -33,7 +33,7 @@ _Building:_ `./gradlew desktop:dist` --- Gradle may take up to several minutes to download files. Be patient.
-After building, the output .JAR file should be in the output JAR file should be in `/desktop/build/libs/desktop-1.0.jar.` +After building, the output .JAR file should be in the output JAR file should be in `/desktop/build/libs/desktop-release.jar.` ### Downloads diff --git a/android/src/io/anuke/mindustry/AndroidLauncher.java b/android/src/io/anuke/mindustry/AndroidLauncher.java index 06b3ec011a..b439264212 100644 --- a/android/src/io/anuke/mindustry/AndroidLauncher.java +++ b/android/src/io/anuke/mindustry/AndroidLauncher.java @@ -56,8 +56,8 @@ public class AndroidLauncher extends AndroidApplication{ } @Override - public void addDialog(TextField field){ - TextFieldDialogListener.add(field); + public void addDialog(TextField field, int length){ + TextFieldDialogListener.add(field, 0, length); } @Override diff --git a/core/src/io/anuke/mindustry/core/UI.java b/core/src/io/anuke/mindustry/core/UI.java index 3a3ad071ae..57a7882294 100644 --- a/core/src/io/anuke/mindustry/core/UI.java +++ b/core/src/io/anuke/mindustry/core/UI.java @@ -22,6 +22,7 @@ import io.anuke.ucore.scene.ui.TextField; import io.anuke.ucore.scene.ui.TextField.TextFieldFilter; import io.anuke.ucore.scene.ui.TooltipManager; import io.anuke.ucore.scene.ui.layout.Unit; +import io.anuke.ucore.util.Mathf; import static io.anuke.mindustry.Vars.control; import static io.anuke.ucore.scene.actions.Actions.*; @@ -68,11 +69,6 @@ public class UI extends SceneModule{ ) )); - skin.font().setUseIntegerPositions(false); - skin.font().getData().setScale(Vars.fontscale); - skin.font().getData().down += 4f; - skin.font().getData().lineHeight -= 2f; - TooltipManager.getInstance().animations = false; Settings.setErrorHandler(()-> Timers.run(1f, ()-> showError("[crimson]Failed to access local storage.\nSettings will not be saved."))); @@ -104,6 +100,12 @@ public class UI extends SceneModule{ @Override protected void loadSkin(){ skin = new Skin(Gdx.files.internal("ui/uiskin.json"), Core.atlas); + Mathf.each(font -> { + font.setUseIntegerPositions(false); + font.getData().setScale(Vars.fontscale); + font.getData().down += Unit.dp.scl(4f); + font.getData().lineHeight -= Unit.dp.scl(2f); + }, skin.font(), skin.getFont("default-font-chat")); } @Override diff --git a/core/src/io/anuke/mindustry/input/InputHandler.java b/core/src/io/anuke/mindustry/input/InputHandler.java index aa8715f585..a8529a7781 100644 --- a/core/src/io/anuke/mindustry/input/InputHandler.java +++ b/core/src/io/anuke/mindustry/input/InputHandler.java @@ -6,6 +6,7 @@ import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.Vars; +import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.graphics.Fx; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.resource.ItemStack; @@ -27,6 +28,7 @@ import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Tmp; import static io.anuke.mindustry.Vars.*; +import static io.anuke.mindustry.Vars.player; public abstract class InputHandler extends InputAdapter{ public float breaktime = 0; @@ -106,9 +108,11 @@ public abstract class InputHandler extends InputAdapter{ return false; } } - - if(!Vars.android && Tmp.r2.overlaps(player.hitbox.getRect(player.x, player.y))){ - return false; + + for(Player player : Vars.control.playerGroup.all()){ + if(!player.isAndroid && Tmp.r2.overlaps(player.hitbox.getRect(player.x, player.y))){ + return false; + } } Tile tile = world.tile(x, y); diff --git a/core/src/io/anuke/mindustry/io/PlatformFunction.java b/core/src/io/anuke/mindustry/io/PlatformFunction.java index 4062ac1517..e7e08555f1 100644 --- a/core/src/io/anuke/mindustry/io/PlatformFunction.java +++ b/core/src/io/anuke/mindustry/io/PlatformFunction.java @@ -8,7 +8,10 @@ public abstract class PlatformFunction{ public String format(Date date){return "invalid";} public String format(int number){return "invalid";} public void openLink(String link){} - public void addDialog(TextField field){} + public void addDialog(TextField field){ + addDialog(field, 16); + } + public void addDialog(TextField field, int maxLength){} public void updateRPC(){} public void onGameExit(){} public void openDonations(){} diff --git a/core/src/io/anuke/mindustry/ui/dialogs/AboutDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/AboutDialog.java index de7bf255fb..0888da52ff 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/AboutDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/AboutDialog.java @@ -5,7 +5,7 @@ import static io.anuke.mindustry.Vars.aboutText; public class AboutDialog extends FloatingDialog { public AboutDialog(){ - super("$text.about"); + super("$text.about.button"); addCloseButton(); diff --git a/core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java b/core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java index 08ea4faf33..b07cc5853c 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java @@ -50,6 +50,7 @@ public class FileChooser extends FloatingDialog { Table content = new Table(); filefield = new TextField(); + filefield.setOnlyFontChars(false); if(!open) Mindustry.platforms.addDialog(filefield); filefield.setDisabled(open); diff --git a/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java b/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java index aa5f15cede..1912818f56 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java @@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.GlyphLayout; import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Array; +import io.anuke.mindustry.Mindustry; import io.anuke.mindustry.Vars; import io.anuke.mindustry.core.GameState; import io.anuke.mindustry.core.GameState.State; @@ -19,6 +20,7 @@ import io.anuke.ucore.scene.ui.Label; import io.anuke.ucore.scene.ui.Label.LabelStyle; import io.anuke.ucore.scene.ui.TextField; import io.anuke.ucore.scene.ui.layout.Table; +import io.anuke.ucore.scene.ui.layout.Unit; import static io.anuke.ucore.core.Core.scene; import static io.anuke.ucore.core.Core.skin; @@ -29,16 +31,15 @@ public class ChatFragment extends Table implements Fragment{ private final static int maxLength = 150; private Array messages = new Array<>(); private float fadetime; - private float lastfadetime; private boolean chatOpen = false; private TextField chatfield; private Label fieldlabel = new Label(">"); private BitmapFont font; private GlyphLayout layout = new GlyphLayout(); - private float offsetx = 4, offsety = 4, fontoffsetx = 2, chatspace = 50; - private float textWidth = 600; + private float offsetx = Unit.dp.scl(4), offsety = Unit.dp.scl(4), fontoffsetx = Unit.dp.scl(2), chatspace = Unit.dp.scl(50); + private float textWidth = Unit.dp.scl(600); private Color shadowColor = new Color(0, 0, 0, 0.4f); - private float textspacing = 10; + private float textspacing = Unit.dp.scl(10); public ChatFragment(){ super(); @@ -73,6 +74,8 @@ public class ChatFragment extends Table implements Fragment{ chatfield.getStyle().background = skin.getDrawable("chatfield"); chatfield.getStyle().fontColor = Color.WHITE; chatfield.getStyle().font = skin.getFont("default-font-chat"); + chatfield.setStyle(chatfield.getStyle()); + Mindustry.platforms.addDialog(chatfield, maxLength); bottom().left().marginBottom(offsety).marginLeft(offsetx*2).add(fieldlabel).padBottom(4f); @@ -87,8 +90,9 @@ public class ChatFragment extends Table implements Fragment{ if(chatOpen) batch.draw(skin.getRegion("white"), offsetx, chatfield.getY(), Gdx.graphics.getWidth()-offsetx*2, chatfield.getHeight()-1); - font.getData().down = -21.5f; - font.getData().lineHeight = 22f; + //font.getData().down = Unit.dp.scl(-21.5f); + //font.getData().lineHeight = 22f; + //chatfield.getStyle().font.getData().setScale(Vars.fontscale); super.draw(batch, alpha); @@ -114,7 +118,7 @@ public class ChatFragment extends Table implements Fragment{ batch.setColor(0, 0, 0, shadowColor.a*(fadetime-i)); } - batch.draw(skin.getRegion("white"), offsetx, theight-layout.height+1-4, textWidth, layout.height+textspacing); + batch.draw(skin.getRegion("white"), offsetx, theight-layout.height+1-4, textWidth + Unit.dp.scl(4f), layout.height+textspacing); batch.setColor(shadowColor); font.getCache().draw(batch); @@ -141,7 +145,6 @@ public class ChatFragment extends Table implements Fragment{ if(!chatOpen && (scene.getKeyboardFocus() == null || !scene.getKeyboardFocus().getParent().isVisible())){ scene.setKeyboardFocus(chatfield); chatOpen = !chatOpen; - lastfadetime = fadetime; fadetime = messagesShown + 1; }else if(chatOpen){ scene.setKeyboardFocus(null); @@ -170,7 +173,7 @@ public class ChatFragment extends Table implements Fragment{ public ChatMessage(String message, String sender){ this.message = message; this.sender = sender; - if(sender == null){ //no sender, this is a server message + if(sender == null){ //no sender, this is a server message? formattedMessage = message; }else{ formattedMessage = "[ROYAL]["+sender+"]: [YELLOW]"+message; diff --git a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java index bfc660e9d1..ddc20f59e0 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java @@ -65,6 +65,7 @@ public class HudFragment implements Fragment{ pause = new imagebutton("icon-pause", isize, ()->{ if(Net.active() && Vars.android){ //TODO open android chat + ui.chatfrag.toggle(); }else { GameState.set(GameState.is(State.paused) ? State.playing : State.paused); } @@ -134,8 +135,7 @@ public class HudFragment implements Fragment{ //profiling table if(debug){ new table(){{ - abottom(); - aleft(); + atop(); new label("[green]density: " + Gdx.graphics.getDensity()).left(); row(); new label(() -> "[blue]requests: " + renderer.getBlocks().getRequests()).left(); diff --git a/core/src/io/anuke/mindustry/world/blocks/DefenseBlocks.java b/core/src/io/anuke/mindustry/world/blocks/DefenseBlocks.java index 4d27db33be..67b24c60f8 100644 --- a/core/src/io/anuke/mindustry/world/blocks/DefenseBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/DefenseBlocks.java @@ -9,19 +9,19 @@ public class DefenseBlocks{ static final int wallHealthMultiplier = 4; public static final Block - + stonewall = new Wall("stonewall"){{ health = 50*wallHealthMultiplier; }}, - + ironwall = new Wall("ironwall"){{ health = 80*wallHealthMultiplier; }}, - + steelwall = new Wall("steelwall"){{ health = 110*wallHealthMultiplier; }}, - + titaniumwall = new Wall("titaniumwall"){{ health = 150*wallHealthMultiplier; }}, @@ -46,24 +46,25 @@ public class DefenseBlocks{ titaniumshieldwall = new ShieldedWallBlock("titaniumshieldwall"){{ health = 150*wallHealthMultiplier; }}, - + repairturret = new RepairTurret("repairturret"){ { range = 30; reload = 40f; health = 60; + powerUsed = 0.08f; } }, - + megarepairturret = new RepairTurret("megarepairturret"){ { range = 44; - reload = 20f; - powerUsed = 0.15f; + reload = 20f; health = 90; + powerUsed = 0.13f; } }, - + shieldgenerator = new ShieldBlock("shieldgenerator"){ { health = 100*wallHealthMultiplier;