Compare commits

..

11 Commits
v62 ... v63

Author SHA1 Message Date
Anuken
d56c041c4a Fixed ground units always spawning in (-1, -1) 2018-11-29 16:58:11 -05:00
Anuken
be48ed5589 Fixed another boring layout issue 2018-11-29 16:37:22 -05:00
Anuken
897c296fbe Fixed server crash 2018-11-29 16:30:41 -05:00
Anuken
d25fe028b8 Fixed mobile recipe switching 2018-11-29 16:23:11 -05:00
Anuken
7fd05b7ca6 Added mobile copy/paste 2018-11-29 13:04:34 -05:00
Anuken
0eec5383ed UI fixes / Better ghost connection fix 2018-11-29 12:07:43 -05:00
Anuken
f474d2c834 Fixed ghost connections 2018-11-29 09:32:36 -05:00
Anuken
e40e5e6a99 UI fix 2018-11-29 09:22:39 -05:00
Anuken
23750bab55 Layout fixes 2018-11-28 22:05:34 -05:00
Anuken
22aeddc655 Fixed screenshot key firing when chat open 2018-11-28 20:30:34 -05:00
Anuken
f3d35e9537 Crash fixes 2018-11-28 18:43:35 -05:00
25 changed files with 966 additions and 977 deletions

View File

@@ -20,7 +20,7 @@
<activity <activity
android:name="io.anuke.mindustry.AndroidLauncher" android:name="io.anuke.mindustry.AndroidLauncher"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="sensor" android:screenOrientation="user"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout"> android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout">
<intent-filter> <intent-filter>

View File

@@ -25,7 +25,7 @@ allprojects {
appName = 'Mindustry' appName = 'Mindustry'
gdxVersion = '1.9.9' gdxVersion = '1.9.9'
roboVMVersion = '2.3.0' roboVMVersion = '2.3.0'
uCoreVersion = '7eb80a9765557d025d589f28fa1910dffa3fc8ed' uCoreVersion = '3dfb820142a0fc583ad19413a24fc5038aa29d89'
getVersionString = { getVersionString = {
String buildVersion = getBuildVersion() String buildVersion = getBuildVersion()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

@@ -24,7 +24,6 @@ ButtonStyle: {
}, },
TextButtonStyle: { TextButtonStyle: {
default: {over: button-over, disabled: button, font: default-font, fontColor: white, disabledFontColor: gray, down: button-down, up: button}, default: {over: button-over, disabled: button, font: default-font, fontColor: white, disabledFontColor: gray, down: button-down, up: button},
left: {over: button-left-over, font: default-font, fontColor: white, disabledFontColor: gray, down: button-left-down, up: button-left},
right: {over: button-right-over, font: default-font, fontColor: white, disabledFontColor: gray, down: button-right-down, up: button-right}, right: {over: button-right-over, font: default-font, fontColor: white, disabledFontColor: gray, down: button-right-down, up: button-right},
wave: {font: default-font, fontColor: white, disabledFontColor: gray, up: button-edge-4}, wave: {font: default-font, fontColor: white, disabledFontColor: gray, up: button-edge-4},
clear: {over: flat-over, font: default-font, fontColor: white, disabledFontColor: gray, down: pane, up: flat}, clear: {over: flat-over, font: default-font, fontColor: white, disabledFontColor: gray, down: pane, up: flat},

View File

@@ -10,9 +10,9 @@ import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.game.Waves; import io.anuke.mindustry.game.Waves;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Events; import io.anuke.ucore.core.Events;
import io.anuke.ucore.util.Structs;
import io.anuke.ucore.util.GridBits; import io.anuke.ucore.util.GridBits;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Structs;
import java.io.DataInput; import java.io.DataInput;
import java.io.DataOutput; import java.io.DataOutput;

View File

@@ -372,7 +372,7 @@ public class Control extends Module{
} }
} }
if(Inputs.keyTap("screenshot")){ if(Inputs.keyTap("screenshot") && !ui.chatfrag.chatOpen()){
renderer.takeMapScreenshot(); renderer.takeMapScreenshot();
} }

View File

@@ -79,7 +79,9 @@ public class NetServer extends Module{
public NetServer(){ public NetServer(){
Events.on(WorldLoadEvent.class, event -> { Events.on(WorldLoadEvent.class, event -> {
connections.clear(); if(!headless){
connections.clear();
}
}); });
Net.handleServer(Connect.class, (id, connect) -> { Net.handleServer(Connect.class, (id, connect) -> {
@@ -596,14 +598,18 @@ public class NetServer extends Module{
} }
void sync(){ void sync(){
try{ try{
//iterate through each player //iterate through each player
for(Player player : connections.values()){ for(int i = 0; i < playerGroup.size(); i ++){
Player player = playerGroup.all().get(i);
if(player.isLocal) continue;
NetConnection connection = player.con; NetConnection connection = player.con;
if(!connection.isConnected()){ if(!connection.isConnected() || !connections.containsKey(connection.id)){
//player disconnected, ignore them //player disconnected, call d/c event
onDisconnect(player); onDisconnect(player);
return; return;
} }

View File

@@ -32,9 +32,22 @@ public abstract class Platform {
dialog.setFillParent(true); dialog.setFillParent(true);
dialog.content().top(); dialog.content().top();
dialog.content().defaults().height(65f); dialog.content().defaults().height(65f);
TextField[] use = {null};
dialog.content().addImageButton("icon-copy", "clear", 16*3, () -> use[0].copy())
.visible(() -> !use[0].getSelection().isEmpty()).width(65f);
dialog.content().addImageButton("icon-paste", "clear", 16*3, () ->
use[0].paste(Gdx.app.getClipboard().getContents(), false))
.visible(() -> !Gdx.app.getClipboard().getContents().isEmpty()).width(65f);
TextField to = dialog.content().addField(field.getText(), t-> {}).pad(15).width(250f).get(); TextField to = dialog.content().addField(field.getText(), t-> {}).pad(15).width(250f).get();
to.setMaxLength(maxLength); to.setMaxLength(maxLength);
to.keyDown(Keys.ENTER, () -> dialog.content().find("okb").fireClick()); to.keyDown(Keys.ENTER, () -> dialog.content().find("okb").fireClick());
use[0] = to;
dialog.content().addButton("$text.ok", () -> { dialog.content().addButton("$text.ok", () -> {
field.clearText(); field.clearText();
field.appendText(to.getText()); field.appendText(to.getText());

View File

@@ -30,8 +30,8 @@ public class World extends Module{
public final Sectors sectors = new Sectors(); public final Sectors sectors = new Sectors();
public final WorldGenerator generator = new WorldGenerator(); public final WorldGenerator generator = new WorldGenerator();
public final BlockIndexer indexer = new BlockIndexer(); public final BlockIndexer indexer = new BlockIndexer();
public final Pathfinder pathfinder = new Pathfinder();
public final WaveSpawner spawner = new WaveSpawner(); public final WaveSpawner spawner = new WaveSpawner();
public final Pathfinder pathfinder = new Pathfinder();
private Map currentMap; private Map currentMap;
private Sector currentSector; private Sector currentSector;

View File

@@ -4,11 +4,9 @@ import com.badlogic.gdx.utils.Scaling;
import io.anuke.mindustry.maps.Map; import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.ui.BorderImage; import io.anuke.mindustry.ui.BorderImage;
import io.anuke.mindustry.ui.dialogs.FloatingDialog; import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.ucore.core.Core;
import io.anuke.ucore.function.Consumer; import io.anuke.ucore.function.Consumer;
import io.anuke.ucore.scene.ui.ButtonGroup; import io.anuke.ucore.scene.ui.ButtonGroup;
import io.anuke.ucore.scene.ui.ScrollPane; import io.anuke.ucore.scene.ui.ScrollPane;
import io.anuke.ucore.scene.ui.ScrollPane.ScrollPaneStyle;
import io.anuke.ucore.scene.ui.TextButton; import io.anuke.ucore.scene.ui.TextButton;
import io.anuke.ucore.scene.ui.layout.Table; import io.anuke.ucore.scene.ui.layout.Table;
@@ -69,7 +67,6 @@ public class MapLoadDialog extends FloatingDialog{
} }
if(world.maps.all().size == 0){ if(world.maps.all().size == 0){
pane.setStyle(Core.skin.get("clear", ScrollPaneStyle.class));
table.add("$text.maps.none").center(); table.add("$text.maps.none").center();
}else{ }else{
content().add("$text.editor.loadmap"); content().add("$text.editor.loadmap");

View File

@@ -1,8 +1,6 @@
package io.anuke.mindustry.game; package io.anuke.mindustry.game;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap; import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.ObjectMap.Entry;
import com.badlogic.gdx.utils.ObjectSet; import com.badlogic.gdx.utils.ObjectSet;
import io.anuke.mindustry.game.EventType.UnlockEvent; import io.anuke.mindustry.game.EventType.UnlockEvent;
import io.anuke.mindustry.type.ContentType; import io.anuke.mindustry.type.ContentType;
@@ -67,27 +65,8 @@ public class Unlocks{
save(); save();
} }
/**Loads 'legacy' unlocks. Will be removed in final release.*/
public void tryLoadLegacy(){
try{
ObjectMap<String, ObjectMap<ContentType, Array<String>>> sets = Settings.getObject("content-sets", ObjectMap.class, ObjectMap::new);
for(Entry<ContentType, Array<String>> entry : sets.get("root").entries()){
unlocked.put(entry.key, new ObjectSet<>());
unlocked.get(entry.key).addAll(entry.value);
}
}catch(Throwable t){
t.printStackTrace();
}
Settings.prefs().remove("content-sets");
Settings.save();
}
public void load(){ public void load(){
unlocked = Settings.getObject("unlockset", ObjectMap.class, ObjectMap::new); unlocked = Settings.getObject("unlockset", ObjectMap.class, ObjectMap::new);
if(Settings.has("content-sets")){
tryLoadLegacy();
}
} }
public void save(){ public void save(){

View File

@@ -242,8 +242,10 @@ public class MobileInput extends InputHandler implements GestureListener{
if(tile != null){ if(tile != null){
if(!request.remove){ if(!request.remove){
rotation = request.rotation; rotation = request.rotation;
Recipe before = recipe;
recipe = request.recipe; recipe = request.recipe;
tryPlaceBlock(tile.x, tile.y); tryPlaceBlock(tile.x, tile.y);
recipe = before;
}else{ }else{
tryBreakBlock(tile.x, tile.y); tryBreakBlock(tile.x, tile.y);
} }

View File

@@ -108,7 +108,7 @@ public class AboutDialog extends FloatingDialog{
dialog.content().row(); dialog.content().row();
dialog.content().add("$text.contributors"); dialog.content().add("$text.contributors");
dialog.content().row(); dialog.content().row();
dialog.content().pane("clear", new Table(){{ dialog.content().pane(new Table(){{
int i = 0; int i = 0;
left(); left();
for(Contributor c : contributors){ for(Contributor c : contributors){

View File

@@ -96,11 +96,11 @@ public class JoinDialog extends FloatingDialog{
//why are java lambdas this bad //why are java lambdas this bad
TextButton[] buttons = {null}; TextButton[] buttons = {null};
TextButton button = buttons[0] = remote.addButton("[accent]" + server.displayIP(), () -> { TextButton button = buttons[0] = remote.addButton("[accent]" + server.displayIP(), "clear", () -> {
if(!buttons[0].childrenPressed()){ if(!buttons[0].childrenPressed()){
connect(server.ip, server.port); connect(server.ip, server.port);
} }
}).width(targetWidth()).height(150f).pad(4f).get(); }).width(targetWidth()).height(155f).pad(4f).get();
button.getLabel().setWrap(true); button.getLabel().setWrap(true);
@@ -159,7 +159,7 @@ public class JoinDialog extends FloatingDialog{
Bundles.format("text.server.version", host.version); Bundles.format("text.server.version", host.version);
}else if(host.version > Version.build && Version.build != -1){ }else if(host.version > Version.build && Version.build != -1){
versionString = Bundles.get("text.server.outdated.client") + "\n" + versionString = Bundles.get("text.server.outdated.client") + "\n" +
Bundles.format("text.server.version", host.version); Bundles.format("text.server.version", host.version, "");
}else{ }else{
versionString = Bundles.format("text.server.version", host.version, host.versionType); versionString = Bundles.format("text.server.version", host.version, host.versionType);
} }
@@ -273,7 +273,7 @@ public class JoinDialog extends FloatingDialog{
local.row(); local.row();
TextButton button = local.addButton("[accent]" + host.name, () -> connect(host.address, port)) TextButton button = local.addButton("[accent]" + host.name, "clear", () -> connect(host.address, port))
.width(w).height(80f).pad(4f).get(); .width(w).height(80f).pad(4f).get();
button.left(); button.left();
button.row(); button.row();

View File

@@ -116,7 +116,7 @@ public class MapsDialog extends FloatingDialog{
table.stack(new Image(map.texture).setScaling(Scaling.fit), new BorderImage(map.texture).setScaling(Scaling.fit)).size(mapsize); table.stack(new Image(map.texture).setScaling(Scaling.fit), new BorderImage(map.texture).setScaling(Scaling.fit)).size(mapsize);
table.table("clear", desc -> { table.table("flat", desc -> {
desc.top(); desc.top();
Table t = new Table(); Table t = new Table();
t.margin(6); t.margin(6);

View File

@@ -24,9 +24,13 @@ import io.anuke.ucore.scene.Element;
import io.anuke.ucore.scene.Group; import io.anuke.ucore.scene.Group;
import io.anuke.ucore.scene.actions.Actions; import io.anuke.ucore.scene.actions.Actions;
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.Image;
import io.anuke.ucore.scene.ui.ImageButton;
import io.anuke.ucore.scene.ui.Label;
import io.anuke.ucore.scene.ui.TextButton;
import io.anuke.ucore.scene.ui.layout.Stack; import io.anuke.ucore.scene.ui.layout.Stack;
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 io.anuke.ucore.util.Bundles; import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
@@ -150,7 +154,7 @@ public class HudFragment extends Fragment{
//paused table //paused table
parent.fill(t -> { parent.fill(t -> {
t.top().visible(() -> state.is(State.paused) && !Net.active()); t.top().visible(() -> state.is(State.paused) && !Net.active());
t.table("clear", top -> top.add("$text.paused").pad(6).get().setFontScale(1.5f)); t.table("button", top -> top.add("$text.paused").pad(6f));
}); });
parent.fill(t -> { parent.fill(t -> {
@@ -347,7 +351,7 @@ public class HudFragment extends Fragment{
if(shown){ if(shown){
shown = false; shown = false;
blockfrag.toggle(dur, in); blockfrag.toggle(dur, in);
wavetable.actions(Actions.translateBy(0, (wavetable.getHeight() + dsize + 6) - wavetable.getTranslation().y, dur, in)); wavetable.actions(Actions.translateBy(0, (wavetable.getHeight() + Unit.dp.scl(dsize) + Unit.dp.scl(6)) - wavetable.getTranslation().y, dur, in));
infolabel.actions(Actions.translateBy(0, (wavetable.getHeight()) - wavetable.getTranslation().y, dur, in)); infolabel.actions(Actions.translateBy(0, (wavetable.getHeight()) - wavetable.getTranslation().y, dur, in));
}else{ }else{
shown = true; shown = true;

View File

@@ -104,19 +104,19 @@ public class PlayerListFragment extends Fragment{
if((Net.server() || players[0].isAdmin) && !player.isLocal && (!player.isAdmin || Net.server())){ if((Net.server() || players[0].isAdmin) && !player.isLocal && (!player.isAdmin || Net.server())){
button.add().growY(); button.add().growY();
float bs = (h + 14) / 2f; float bs = (h) / 2f;
button.table(t -> { button.table(t -> {
t.defaults().size(bs); t.defaults().size(bs);
t.addImageButton("icon-ban", 14 * 2, t.addImageButton("icon-ban", "clear-partial", 14 * 2,
() -> ui.showConfirm("$text.confirm", "$text.confirmban", () -> Call.onAdminRequest(player, AdminAction.ban))); () -> ui.showConfirm("$text.confirm", "$text.confirmban", () -> Call.onAdminRequest(player, AdminAction.ban)));
t.addImageButton("icon-cancel", 16 * 2, t.addImageButton("icon-cancel", "clear-partial", 16 * 2,
() -> ui.showConfirm("$text.confirm", "$text.confirmkick", () -> Call.onAdminRequest(player, AdminAction.kick))); () -> ui.showConfirm("$text.confirm", "$text.confirmkick", () -> Call.onAdminRequest(player, AdminAction.kick)));
t.row(); t.row();
t.addImageButton("icon-admin", "toggle", 14 * 2, () -> { t.addImageButton("icon-admin", "clear-toggle", 14 * 2, () -> {
if(Net.client()) return; if(Net.client()) return;
String id = player.uuid; String id = player.uuid;
@@ -132,9 +132,9 @@ public class PlayerListFragment extends Fragment{
.touchable(() -> Net.client() ? Touchable.disabled : Touchable.enabled) .touchable(() -> Net.client() ? Touchable.disabled : Touchable.enabled)
.checked(player.isAdmin); .checked(player.isAdmin);
t.addImageButton("icon-zoom-small", 14 * 2, () -> ui.showError("Currently unimplemented.")/*Call.onAdminRequest(player, AdminAction.trace)*/); t.addImageButton("icon-zoom-small", "clear-partial", 14 * 2, () -> ui.showError("Currently unimplemented.")/*Call.onAdminRequest(player, AdminAction.trace)*/);
}).padRight(12).padTop(-5).padLeft(0).padBottom(-10).size(bs + 10f, bs); }).padRight(12).size(bs + 10f, bs);
} }
content.add(button).padBottom(-6).width(350f).maxHeight(h + 14); content.add(button).padBottom(-6).width(350f).maxHeight(h + 14);

View File

@@ -33,7 +33,7 @@ public abstract class Consume{
} }
public void build(Table table){ public void build(Table table){
Table t = new Table("clear"); Table t = new Table("flat");
t.margin(4); t.margin(4);
buildTooltip(t); buildTooltip(t);

View File

@@ -71,7 +71,6 @@ public class KryoServer implements ServerProvider {
@Override @Override
public void disconnected (Connection connection) { public void disconnected (Connection connection) {
KryoConnection k = getByKryoID(connection.getID()); KryoConnection k = getByKryoID(connection.getID());
Log.info("&bLost kryonet connection {0}", connection.getID());
if(k == null) return; if(k == null) return;
Disconnect c = new Disconnect(); Disconnect c = new Disconnect();