From 460c7163d91e9ee8704e12db1ebd8886b75bde12 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 21 Dec 2017 20:59:40 -0500 Subject: [PATCH] uCore dependency setup --- android/AndroidManifest.xml | 4 ++-- build.gradle | 13 +++++++------ core/src/io/anuke/mindustry/Vars.java | 5 ++--- core/src/io/anuke/mindustry/core/UI.java | 4 ++-- .../anuke/mindustry/mapeditor/MapEditorDialog.java | 4 ++-- core/src/io/anuke/mindustry/mapeditor/MapView.java | 2 +- core/src/io/anuke/mindustry/ui/LoadDialog.java | 10 +++------- core/src/io/anuke/mindustry/ui/SaveDialog.java | 1 - .../world/blocks/types/defense/RepairTurret.java | 8 ++++++-- desktop/build.gradle | 3 +++ .../io/anuke/mindustry/desktop/DesktopLauncher.java | 7 +++---- settings.gradle | 4 ++-- 12 files changed, 33 insertions(+), 32 deletions(-) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index e9fc71c3cc..862e2c41ba 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="43" + android:versionName="3.2b2" > diff --git a/build.gradle b/build.gradle index 1ac0d7e99d..031014ecda 100644 --- a/build.gradle +++ b/build.gradle @@ -20,8 +20,9 @@ allprojects { version = 'release' ext { appName = "Mindustry" - gdxVersion = '1.9.6' - aiVersion = '1.8.0' + gdxVersion = '1.9.8' + aiVersion = '1.8.1' + uCoreVersion = '4434f35'; } repositories { @@ -55,7 +56,7 @@ project(":html") { compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion" compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources" compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources" - compile "com.badlogicgames.gdx:gdx-ai:1.8.0:sources" + compile "com.badlogicgames.gdx:gdx-ai:$aiVersion:sources" } } @@ -80,13 +81,13 @@ project(":core") { apply plugin: "java" dependencies { - if(new File('../uCore-master').exists()){ + if(new File('../uCore').exists()){ compile project(":uCore") }else{ - compile 'com.github.anuken:ucore:7938cb4bf9' + compile "com.github.anuken:ucore:$uCoreVersion" } compile "com.badlogicgames.gdx:gdx:$gdxVersion" - compile "com.badlogicgames.gdx:gdx-ai:1.8.1" + compile "com.badlogicgames.gdx:gdx-ai:$aiVersion" } } diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index ab3e403cdd..938d9c30b8 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -53,9 +53,8 @@ public class Vars{ public static boolean showPlayer = true; //whether to hide ui, only on debug public static boolean showUI = true; - //number of save slots-- increasing may lead to layout issues - //TODO named save slots - public static final int saveSlots = 8; + + public static final int saveSlots = 10; //amount of drops that are left when breaking a block public static final float breakDropAmount = 0.5f; diff --git a/core/src/io/anuke/mindustry/core/UI.java b/core/src/io/anuke/mindustry/core/UI.java index e33403e723..35324a4c96 100644 --- a/core/src/io/anuke/mindustry/core/UI.java +++ b/core/src/io/anuke/mindustry/core/UI.java @@ -205,11 +205,11 @@ public class UI extends SceneModule{ prefs.checkPref("fps", "Show FPS", false); prefs.checkPref("vsync", "VSync", true, b -> Gdx.graphics.setVSync(b)); - prefs.checkPref("noshadows", "Disable shadows", false); + //prefs.checkPref("noshadows", "Disable shadows", false); + //prefs.checkPref("drawblocks", "Draw Blocks", true); prefs.checkPref("smoothcam", "Smooth Camera", true); prefs.checkPref("indicators", "Enemy Indicators", true); prefs.checkPref("effects", "Display Effects", true); - prefs.checkPref("drawblocks", "Draw Blocks", true); prefs.checkPref("pixelate", "Pixelate Screen", true, b->{ if(b){ Vars.renderer.pixelSurface.setScale(Core.cameraScale); diff --git a/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java b/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java index 6770417d21..af218c58f0 100644 --- a/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java +++ b/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java @@ -55,7 +55,7 @@ public class MapEditorDialog extends Dialog{ Vars.ui.showError("[orange]Invalid image dimensions![]\nValid map dimensions: " + Arrays.toString(MapEditor.validMapSizes)); } }catch (Exception e){ - Vars.ui.showError("Error loading image file:\n" + Strings.parseException((Exception)e.getCause())); + Vars.ui.showError("Error loading image file:\n[orange]" + Strings.parseException(e, false)); e.printStackTrace(); } Vars.ui.hideLoading(); @@ -72,7 +72,7 @@ public class MapEditorDialog extends Dialog{ try{ Pixmaps.write(editor.pixmap(), result); }catch (Exception e){ - Vars.ui.showError("Error saving image file:\n " + Strings.parseException((Exception)e.getCause())); + Vars.ui.showError("Error saving image file:\n[orange]" + Strings.parseException(e, false)); e.printStackTrace(); } Vars.ui.hideLoading(); diff --git a/core/src/io/anuke/mindustry/mapeditor/MapView.java b/core/src/io/anuke/mindustry/mapeditor/MapView.java index 3cd4795d8d..1fe2cfd6ac 100644 --- a/core/src/io/anuke/mindustry/mapeditor/MapView.java +++ b/core/src/io/anuke/mindustry/mapeditor/MapView.java @@ -304,6 +304,6 @@ public class MapView extends Element implements GestureListener{ @Override public void pinchStop(){ - + } } diff --git a/core/src/io/anuke/mindustry/ui/LoadDialog.java b/core/src/io/anuke/mindustry/ui/LoadDialog.java index d9b640838b..06aa4d6c26 100644 --- a/core/src/io/anuke/mindustry/ui/LoadDialog.java +++ b/core/src/io/anuke/mindustry/ui/LoadDialog.java @@ -13,7 +13,6 @@ import io.anuke.ucore.scene.ui.ScrollPane; import io.anuke.ucore.scene.ui.TextButton; import io.anuke.ucore.scene.ui.layout.Table; -//TODO unified save/load dialogs public class LoadDialog extends FloatingDialog{ ScrollPane pane; @@ -46,7 +45,6 @@ public class LoadDialog extends FloatingDialog{ slots.padRight(24); for(int i = 0; i < Vars.saveSlots; i++){ - final int slot = i; TextButton button = new TextButton("[accent]Slot " + (i + 1)); button.pad(12); @@ -54,17 +52,15 @@ public class LoadDialog extends FloatingDialog{ button.row(); - Label info = new Label("[gray]" + (!SaveIO.isSaveValid(i) ? "" : SaveIO.getMode(slot) + ", " - + SaveIO.getMap(slot).name + ", Wave " + SaveIO.getWave(slot) + Label info = new Label("[gray]" + (!SaveIO.isSaveValid(i) ? "" : SaveIO.getMode(i) + ", " + + SaveIO.getMap(i).name + ", Wave " + SaveIO.getWave(i) + "\nLast Saved: " + SaveIO.getTimeString(i))); info.setAlignment(Align.center, Align.center); button.add(info).padBottom(3).padTop(7); button.row(); - //button.addImage("white", Color.GRAY) - //.growX().height(3f).pad(4f); button.row(); - modifyButton(button, slot); + modifyButton(button, i); slots.add(button).size(404, 104).pad(4); slots.row(); diff --git a/core/src/io/anuke/mindustry/ui/SaveDialog.java b/core/src/io/anuke/mindustry/ui/SaveDialog.java index eb8a1d52b4..99872b80ec 100644 --- a/core/src/io/anuke/mindustry/ui/SaveDialog.java +++ b/core/src/io/anuke/mindustry/ui/SaveDialog.java @@ -10,7 +10,6 @@ import io.anuke.ucore.scene.ui.ConfirmDialog; import io.anuke.ucore.scene.ui.TextButton; import io.anuke.ucore.scene.ui.layout.Cell; -//TODO unified save/load dialogs public class SaveDialog extends LoadDialog{ public SaveDialog() { diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/RepairTurret.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/RepairTurret.java index 854b084985..81f3305f9e 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/RepairTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/RepairTurret.java @@ -52,15 +52,19 @@ public class RepairTurret extends PowerTurret{ if(entity.timer.get(timerTarget, targetInterval)){ entity.blockTarget = Vars.world.findTileTarget(tile.worldx(), tile.worldy(), tile, range, true); } - + if(entity.blockTarget != null){ + if(Float.isNaN(entity.rotation)){ + entity.rotation = 0; + } + float target = entity.angleTo(entity.blockTarget); entity.rotation = Mathf.slerp(entity.rotation, target, 0.16f*Timers.delta()); if(entity.timer.get(timerReload, reload) && Angles.angleDist(target, entity.rotation) < shootCone){ entity.blockTarget.health++; - if(entity.blockTarget.health > entity.blockTarget.health) + if(entity.blockTarget.health > entity.blockTarget.maxhealth) entity.blockTarget.health = entity.blockTarget.maxhealth; entity.power -= powerUsed; diff --git a/desktop/build.gradle b/desktop/build.gradle index b5ecc5798b..d99ec7616c 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -14,6 +14,9 @@ task run(dependsOn: classes, type: JavaExec) { standardInput = System.in workingDir = project.assetsDir ignoreExitValue = true + if (project.hasProperty("appArgs")) { + args Eval.me(appArgs) + } } task debug(dependsOn: classes, type: JavaExec) { diff --git a/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java b/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java index 51523fad8d..de9324b816 100644 --- a/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java +++ b/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.net.URI; import java.text.NumberFormat; import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.Date; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; @@ -14,22 +15,20 @@ import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.Mindustry; import io.anuke.mindustry.Vars; import io.anuke.mindustry.io.PlatformFunction; +import io.anuke.ucore.UCore; import io.anuke.ucore.scene.ui.TextField; import io.anuke.ucore.scene.ui.layout.Unit; public class DesktopLauncher { public static void main (String[] arg) { - - Unit.dp.addition = 2f; Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration(); config.setTitle("Mindustry"); config.setMaximized(true); config.setWindowedMode(960, 540); config.setWindowIcon("sprites/icon.png"); - config.useVsync(true); - + Mindustry.platforms = new PlatformFunction(){ SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm"); diff --git a/settings.gradle b/settings.gradle index 37e8392bdd..8c1c9cc895 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,6 @@ include 'desktop', 'html', 'core', 'android' -if (new File(settingsDir, '../uCore-master').exists()) { +if (new File(settingsDir, '../uCore').exists()) { include ':uCore' - project(':uCore').projectDir = new File(settingsDir, '../uCore-master') + project(':uCore').projectDir = new File(settingsDir, '../uCore') }