Merge branch 'master' into weapon-upgrade-rework
This commit is contained in:
@@ -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).
|
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)_
|
_[TODO list](TODO.md)_
|
||||||
_[Wiki](http://mindustry.wikia.com/wiki/Mindustry_Wiki)_
|
_[Wiki](http://mindustry.wikia.com/wiki/Mindustry_Wiki)_
|
||||||
_[Discord](https://discord.gg/r8BkXNd)_
|
_[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. <br>
|
Gradle may take up to several minutes to download files. Be patient. <br>
|
||||||
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
|
### Downloads
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addDialog(TextField field){
|
public void addDialog(TextField field, int length){
|
||||||
TextFieldDialogListener.add(field);
|
TextFieldDialogListener.add(field, 0, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -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.TextField.TextFieldFilter;
|
||||||
import io.anuke.ucore.scene.ui.TooltipManager;
|
import io.anuke.ucore.scene.ui.TooltipManager;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
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.mindustry.Vars.control;
|
||||||
import static io.anuke.ucore.scene.actions.Actions.*;
|
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;
|
TooltipManager.getInstance().animations = false;
|
||||||
|
|
||||||
Settings.setErrorHandler(()-> Timers.run(1f, ()-> showError("[crimson]Failed to access local storage.\nSettings will not be saved.")));
|
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
|
@Override
|
||||||
protected void loadSkin(){
|
protected void loadSkin(){
|
||||||
skin = new Skin(Gdx.files.internal("ui/uiskin.json"), Core.atlas);
|
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
|
@Override
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.badlogic.gdx.math.Rectangle;
|
|||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.graphics.Fx;
|
import io.anuke.mindustry.graphics.Fx;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.resource.ItemStack;
|
import io.anuke.mindustry.resource.ItemStack;
|
||||||
@@ -27,6 +28,7 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
import io.anuke.ucore.util.Tmp;
|
import io.anuke.ucore.util.Tmp;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
import static io.anuke.mindustry.Vars.player;
|
||||||
|
|
||||||
public abstract class InputHandler extends InputAdapter{
|
public abstract class InputHandler extends InputAdapter{
|
||||||
public float breaktime = 0;
|
public float breaktime = 0;
|
||||||
@@ -106,9 +108,11 @@ public abstract class InputHandler extends InputAdapter{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Vars.android && Tmp.r2.overlaps(player.hitbox.getRect(player.x, player.y))){
|
for(Player player : Vars.control.playerGroup.all()){
|
||||||
return false;
|
if(!player.isAndroid && Tmp.r2.overlaps(player.hitbox.getRect(player.x, player.y))){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Tile tile = world.tile(x, y);
|
Tile tile = world.tile(x, y);
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ public abstract class PlatformFunction{
|
|||||||
public String format(Date date){return "invalid";}
|
public String format(Date date){return "invalid";}
|
||||||
public String format(int number){return "invalid";}
|
public String format(int number){return "invalid";}
|
||||||
public void openLink(String link){}
|
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 updateRPC(){}
|
||||||
public void onGameExit(){}
|
public void onGameExit(){}
|
||||||
public void openDonations(){}
|
public void openDonations(){}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import static io.anuke.mindustry.Vars.aboutText;
|
|||||||
public class AboutDialog extends FloatingDialog {
|
public class AboutDialog extends FloatingDialog {
|
||||||
|
|
||||||
public AboutDialog(){
|
public AboutDialog(){
|
||||||
super("$text.about");
|
super("$text.about.button");
|
||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class FileChooser extends FloatingDialog {
|
|||||||
Table content = new Table();
|
Table content = new Table();
|
||||||
|
|
||||||
filefield = new TextField();
|
filefield = new TextField();
|
||||||
|
filefield.setOnlyFontChars(false);
|
||||||
if(!open) Mindustry.platforms.addDialog(filefield);
|
if(!open) Mindustry.platforms.addDialog(filefield);
|
||||||
filefield.setDisabled(open);
|
filefield.setDisabled(open);
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
|||||||
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
|
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import io.anuke.mindustry.Mindustry;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.core.GameState;
|
import io.anuke.mindustry.core.GameState;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
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.Label.LabelStyle;
|
||||||
import io.anuke.ucore.scene.ui.TextField;
|
import io.anuke.ucore.scene.ui.TextField;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
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.scene;
|
||||||
import static io.anuke.ucore.core.Core.skin;
|
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 final static int maxLength = 150;
|
||||||
private Array<ChatMessage> messages = new Array<>();
|
private Array<ChatMessage> messages = new Array<>();
|
||||||
private float fadetime;
|
private float fadetime;
|
||||||
private float lastfadetime;
|
|
||||||
private boolean chatOpen = false;
|
private boolean chatOpen = false;
|
||||||
private TextField chatfield;
|
private TextField chatfield;
|
||||||
private Label fieldlabel = new Label(">");
|
private Label fieldlabel = new Label(">");
|
||||||
private BitmapFont font;
|
private BitmapFont font;
|
||||||
private GlyphLayout layout = new GlyphLayout();
|
private GlyphLayout layout = new GlyphLayout();
|
||||||
private float offsetx = 4, offsety = 4, fontoffsetx = 2, chatspace = 50;
|
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 = 600;
|
private float textWidth = Unit.dp.scl(600);
|
||||||
private Color shadowColor = new Color(0, 0, 0, 0.4f);
|
private Color shadowColor = new Color(0, 0, 0, 0.4f);
|
||||||
private float textspacing = 10;
|
private float textspacing = Unit.dp.scl(10);
|
||||||
|
|
||||||
public ChatFragment(){
|
public ChatFragment(){
|
||||||
super();
|
super();
|
||||||
@@ -73,6 +74,8 @@ public class ChatFragment extends Table implements Fragment{
|
|||||||
chatfield.getStyle().background = skin.getDrawable("chatfield");
|
chatfield.getStyle().background = skin.getDrawable("chatfield");
|
||||||
chatfield.getStyle().fontColor = Color.WHITE;
|
chatfield.getStyle().fontColor = Color.WHITE;
|
||||||
chatfield.getStyle().font = skin.getFont("default-font-chat");
|
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);
|
bottom().left().marginBottom(offsety).marginLeft(offsetx*2).add(fieldlabel).padBottom(4f);
|
||||||
|
|
||||||
@@ -87,8 +90,9 @@ public class ChatFragment extends Table implements Fragment{
|
|||||||
if(chatOpen)
|
if(chatOpen)
|
||||||
batch.draw(skin.getRegion("white"), offsetx, chatfield.getY(), Gdx.graphics.getWidth()-offsetx*2, chatfield.getHeight()-1);
|
batch.draw(skin.getRegion("white"), offsetx, chatfield.getY(), Gdx.graphics.getWidth()-offsetx*2, chatfield.getHeight()-1);
|
||||||
|
|
||||||
font.getData().down = -21.5f;
|
//font.getData().down = Unit.dp.scl(-21.5f);
|
||||||
font.getData().lineHeight = 22f;
|
//font.getData().lineHeight = 22f;
|
||||||
|
//chatfield.getStyle().font.getData().setScale(Vars.fontscale);
|
||||||
|
|
||||||
super.draw(batch, alpha);
|
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.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);
|
batch.setColor(shadowColor);
|
||||||
|
|
||||||
font.getCache().draw(batch);
|
font.getCache().draw(batch);
|
||||||
@@ -141,7 +145,6 @@ public class ChatFragment extends Table implements Fragment{
|
|||||||
if(!chatOpen && (scene.getKeyboardFocus() == null || !scene.getKeyboardFocus().getParent().isVisible())){
|
if(!chatOpen && (scene.getKeyboardFocus() == null || !scene.getKeyboardFocus().getParent().isVisible())){
|
||||||
scene.setKeyboardFocus(chatfield);
|
scene.setKeyboardFocus(chatfield);
|
||||||
chatOpen = !chatOpen;
|
chatOpen = !chatOpen;
|
||||||
lastfadetime = fadetime;
|
|
||||||
fadetime = messagesShown + 1;
|
fadetime = messagesShown + 1;
|
||||||
}else if(chatOpen){
|
}else if(chatOpen){
|
||||||
scene.setKeyboardFocus(null);
|
scene.setKeyboardFocus(null);
|
||||||
@@ -170,7 +173,7 @@ public class ChatFragment extends Table implements Fragment{
|
|||||||
public ChatMessage(String message, String sender){
|
public ChatMessage(String message, String sender){
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.sender = sender;
|
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;
|
formattedMessage = message;
|
||||||
}else{
|
}else{
|
||||||
formattedMessage = "[ROYAL]["+sender+"]: [YELLOW]"+message;
|
formattedMessage = "[ROYAL]["+sender+"]: [YELLOW]"+message;
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ public class HudFragment implements Fragment{
|
|||||||
pause = new imagebutton("icon-pause", isize, ()->{
|
pause = new imagebutton("icon-pause", isize, ()->{
|
||||||
if(Net.active() && Vars.android){
|
if(Net.active() && Vars.android){
|
||||||
//TODO open android chat
|
//TODO open android chat
|
||||||
|
ui.chatfrag.toggle();
|
||||||
}else {
|
}else {
|
||||||
GameState.set(GameState.is(State.paused) ? State.playing : State.paused);
|
GameState.set(GameState.is(State.paused) ? State.playing : State.paused);
|
||||||
}
|
}
|
||||||
@@ -134,8 +135,7 @@ public class HudFragment implements Fragment{
|
|||||||
//profiling table
|
//profiling table
|
||||||
if(debug){
|
if(debug){
|
||||||
new table(){{
|
new table(){{
|
||||||
abottom();
|
atop();
|
||||||
aleft();
|
|
||||||
new label("[green]density: " + Gdx.graphics.getDensity()).left();
|
new label("[green]density: " + Gdx.graphics.getDensity()).left();
|
||||||
row();
|
row();
|
||||||
new label(() -> "[blue]requests: " + renderer.getBlocks().getRequests()).left();
|
new label(() -> "[blue]requests: " + renderer.getBlocks().getRequests()).left();
|
||||||
|
|||||||
@@ -9,19 +9,19 @@ public class DefenseBlocks{
|
|||||||
static final int wallHealthMultiplier = 4;
|
static final int wallHealthMultiplier = 4;
|
||||||
|
|
||||||
public static final Block
|
public static final Block
|
||||||
|
|
||||||
stonewall = new Wall("stonewall"){{
|
stonewall = new Wall("stonewall"){{
|
||||||
health = 50*wallHealthMultiplier;
|
health = 50*wallHealthMultiplier;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
ironwall = new Wall("ironwall"){{
|
ironwall = new Wall("ironwall"){{
|
||||||
health = 80*wallHealthMultiplier;
|
health = 80*wallHealthMultiplier;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
steelwall = new Wall("steelwall"){{
|
steelwall = new Wall("steelwall"){{
|
||||||
health = 110*wallHealthMultiplier;
|
health = 110*wallHealthMultiplier;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
titaniumwall = new Wall("titaniumwall"){{
|
titaniumwall = new Wall("titaniumwall"){{
|
||||||
health = 150*wallHealthMultiplier;
|
health = 150*wallHealthMultiplier;
|
||||||
}},
|
}},
|
||||||
@@ -46,24 +46,25 @@ public class DefenseBlocks{
|
|||||||
titaniumshieldwall = new ShieldedWallBlock("titaniumshieldwall"){{
|
titaniumshieldwall = new ShieldedWallBlock("titaniumshieldwall"){{
|
||||||
health = 150*wallHealthMultiplier;
|
health = 150*wallHealthMultiplier;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
repairturret = new RepairTurret("repairturret"){
|
repairturret = new RepairTurret("repairturret"){
|
||||||
{
|
{
|
||||||
range = 30;
|
range = 30;
|
||||||
reload = 40f;
|
reload = 40f;
|
||||||
health = 60;
|
health = 60;
|
||||||
|
powerUsed = 0.08f;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
megarepairturret = new RepairTurret("megarepairturret"){
|
megarepairturret = new RepairTurret("megarepairturret"){
|
||||||
{
|
{
|
||||||
range = 44;
|
range = 44;
|
||||||
reload = 20f;
|
reload = 20f;
|
||||||
powerUsed = 0.15f;
|
|
||||||
health = 90;
|
health = 90;
|
||||||
|
powerUsed = 0.13f;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
shieldgenerator = new ShieldBlock("shieldgenerator"){
|
shieldgenerator = new ShieldBlock("shieldgenerator"){
|
||||||
{
|
{
|
||||||
health = 100*wallHealthMultiplier;
|
health = 100*wallHealthMultiplier;
|
||||||
|
|||||||
Reference in New Issue
Block a user