UI refactoring, new save dialog
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="io.anuke.mindustry"
|
package="io.anuke.mindustry"
|
||||||
android:versionCode="43"
|
android:versionCode="44"
|
||||||
android:versionName="3.2b2" >
|
android:versionName="3.2b3" >
|
||||||
|
|
||||||
<uses-permission android:name="com.android.vending.BILLING" />
|
<uses-permission android:name="com.android.vending.BILLING" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|||||||
+8
-3
@@ -21,7 +21,7 @@ allprojects {
|
|||||||
appName = "Mindustry"
|
appName = "Mindustry"
|
||||||
gdxVersion = '1.9.8'
|
gdxVersion = '1.9.8'
|
||||||
aiVersion = '1.8.1'
|
aiVersion = '1.8.1'
|
||||||
uCoreVersion = '4434f35';
|
uCoreVersion = 'd239170bc0';
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -36,11 +36,11 @@ allprojects {
|
|||||||
project(":desktop") {
|
project(":desktop") {
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
compile "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
|
||||||
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||||
|
compile "com.badlogicgames.gdx:gdx-controllers-lwjgl3:$gdxVersion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,11 +51,14 @@ project(":html") {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
compile fileTree(dir: '../core/lib', include: '*.jar')
|
|
||||||
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
|
||||||
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
|
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
|
||||||
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
|
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
|
||||||
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion:sources"
|
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion:sources"
|
||||||
|
|
||||||
|
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion:sources"
|
||||||
|
compile "com.badlogicgames.gdx:gdx-controllers-gwt:$gdxVersion"
|
||||||
|
compile "com.badlogicgames.gdx:gdx-controllers-gwt:$gdxVersion:sources"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,6 +76,7 @@ project(":android") {
|
|||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
|
||||||
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
|
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
|
||||||
|
compile "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,6 +94,7 @@ project(":core") {
|
|||||||
}
|
}
|
||||||
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||||
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
|
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
|
||||||
|
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "https://raw.githubusercontent.com/gwtproject/gwt/master/distro-source/core/src/gwt-module.dtd">
|
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "https://raw.githubusercontent.com/gwtproject/gwt/master/distro-source/core/src/gwt-module.dtd">
|
||||||
<module>
|
<module>
|
||||||
<source path="io/anuke/mindustry" />
|
<source path="io/anuke/mindustry" />
|
||||||
<extend-configuration-property name="gdx.reflect.include" value="io.anuke.mindustry.entities" />
|
<extend-configuration-property name="gdx.reflect.include" value="io.anuke.mindustry.entities.enemies" />
|
||||||
<extend-configuration-property name="gdx.reflect.include" value="io.anuke.mindustry.world.Tile" />
|
<extend-configuration-property name="gdx.reflect.include" value="io.anuke.mindustry.world.Tile" />
|
||||||
</module>
|
</module>
|
||||||
@@ -7,6 +7,7 @@ import java.util.Arrays;
|
|||||||
import com.badlogic.gdx.Application.ApplicationType;
|
import com.badlogic.gdx.Application.ApplicationType;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Input.Keys;
|
import com.badlogic.gdx.Input.Keys;
|
||||||
|
import com.badlogic.gdx.audio.Music;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||||
|
|
||||||
@@ -423,7 +424,7 @@ public class Control extends Module{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
Musics.shuffleAll();
|
Timers.run(1f, Musics::shuffleAll);
|
||||||
|
|
||||||
Entities.initPhysics();
|
Entities.initPhysics();
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.badlogic.gdx.graphics.Texture;
|
|||||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
|
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
|
||||||
import com.badlogic.gdx.math.Rectangle;
|
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.FloatArray;
|
import com.badlogic.gdx.utils.FloatArray;
|
||||||
|
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
@@ -27,6 +28,7 @@ import io.anuke.ucore.core.*;
|
|||||||
import io.anuke.ucore.entities.DestructibleEntity;
|
import io.anuke.ucore.entities.DestructibleEntity;
|
||||||
import io.anuke.ucore.entities.EffectEntity;
|
import io.anuke.ucore.entities.EffectEntity;
|
||||||
import io.anuke.ucore.entities.Entities;
|
import io.anuke.ucore.entities.Entities;
|
||||||
|
import io.anuke.ucore.function.Callable;
|
||||||
import io.anuke.ucore.graphics.Hue;
|
import io.anuke.ucore.graphics.Hue;
|
||||||
import io.anuke.ucore.graphics.Surface;
|
import io.anuke.ucore.graphics.Surface;
|
||||||
import io.anuke.ucore.modules.RendererModule;
|
import io.anuke.ucore.modules.RendererModule;
|
||||||
@@ -43,6 +45,7 @@ public class Renderer extends RendererModule{
|
|||||||
|
|
||||||
private int targetscale = baseCameraScale;
|
private int targetscale = baseCameraScale;
|
||||||
private FloatArray shieldHits = new FloatArray();
|
private FloatArray shieldHits = new FloatArray();
|
||||||
|
private Array<Callable> shieldDraws = new Array<>();
|
||||||
private BlockRenderer blocks = new BlockRenderer();
|
private BlockRenderer blocks = new BlockRenderer();
|
||||||
|
|
||||||
public Renderer() {
|
public Renderer() {
|
||||||
@@ -251,7 +254,6 @@ public class Renderer extends RendererModule{
|
|||||||
void drawEnemyMarkers(){
|
void drawEnemyMarkers(){
|
||||||
Graphics.surface(indicatorSurface);
|
Graphics.surface(indicatorSurface);
|
||||||
Draw.color(Color.RED);
|
Draw.color(Color.RED);
|
||||||
//Draw.alpha(0.6f);
|
|
||||||
for(Enemy enemy : control.enemyGroup.all()){
|
for(Enemy enemy : control.enemyGroup.all()){
|
||||||
|
|
||||||
if(Tmp.r1.setSize(camera.viewportWidth, camera.viewportHeight).setCenter(camera.position.x, camera.position.y).overlaps(enemy.hitbox.getRect(enemy.x, enemy.y))){
|
if(Tmp.r1.setSize(camera.viewportWidth, camera.viewportHeight).setCenter(camera.position.x, camera.position.y).overlaps(enemy.hitbox.getRect(enemy.x, enemy.y))){
|
||||||
@@ -269,11 +271,14 @@ public class Renderer extends RendererModule{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void drawShield(){
|
void drawShield(){
|
||||||
if(control.shieldGroup.amount() == 0) return;
|
if(control.shieldGroup.amount() == 0 && shieldDraws.size == 0) return;
|
||||||
|
|
||||||
Graphics.surface(Vars.renderer.shieldSurface, false);
|
Graphics.surface(Vars.renderer.shieldSurface, false);
|
||||||
Draw.color(Color.ROYAL);
|
Draw.color(Color.ROYAL);
|
||||||
Entities.draw(control.shieldGroup);
|
Entities.draw(control.shieldGroup);
|
||||||
|
for(Callable c : shieldDraws){
|
||||||
|
c.run();
|
||||||
|
}
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
Graphics.surface();
|
Graphics.surface();
|
||||||
|
|
||||||
@@ -315,6 +320,7 @@ public class Renderer extends RendererModule{
|
|||||||
Graphics.beginCam();
|
Graphics.beginCam();
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
shieldDraws.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockRenderer getBlocks() {
|
public BlockRenderer getBlocks() {
|
||||||
@@ -325,6 +331,10 @@ public class Renderer extends RendererModule{
|
|||||||
shieldHits.addAll(x, y, 0f);
|
shieldHits.addAll(x, y, 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addShield(Callable call){
|
||||||
|
shieldDraws.add(call);
|
||||||
|
}
|
||||||
|
|
||||||
void drawOverlay(){
|
void drawOverlay(){
|
||||||
|
|
||||||
//draw tutorial placement point
|
//draw tutorial placement point
|
||||||
@@ -394,7 +404,7 @@ public class Renderer extends RendererModule{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Vars.debug || Vars.showUI){
|
if((!Vars.debug || Vars.showUI) && Settings.getBool("healthbars")){
|
||||||
|
|
||||||
//draw entity health bars
|
//draw entity health bars
|
||||||
for(Enemy entity : control.enemyGroup.all()){
|
for(Enemy entity : control.enemyGroup.all()){
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ public class Tutorial{
|
|||||||
|
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
prev.pad(16);
|
prev.margin(16);
|
||||||
next.pad(16);
|
next.margin(16);
|
||||||
|
|
||||||
prev.setDisabled(()->!canMove(false) || !stage.canBack);
|
prev.setDisabled(()->!canMove(false) || !stage.canBack);
|
||||||
next.setDisabled(()->!stage.canForward);
|
next.setDisabled(()->!stage.canForward);
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
settingserror = new Dialog("Warning", "dialog");
|
settingserror = new Dialog("Warning", "dialog");
|
||||||
settingserror.content().add("[crimson]Failed to access local storage.\nSettings will not be saved.");
|
settingserror.content().add("[crimson]Failed to access local storage.\nSettings will not be saved.");
|
||||||
settingserror.content().pad(10f);
|
settingserror.content().margin(10f);
|
||||||
settingserror.getButtonTable().addButton("OK", ()->{
|
settingserror.getButtonTable().addButton("OK", ()->{
|
||||||
settingserror.hide();
|
settingserror.hide();
|
||||||
}).size(80f, 55f).pad(4);
|
}).size(80f, 55f).pad(4);
|
||||||
@@ -181,7 +181,7 @@ public class UI extends SceneModule{
|
|||||||
gameerror.buttons().addButton("OK", gameerror::hide).size(200f, 50);
|
gameerror.buttons().addButton("OK", gameerror::hide).size(200f, 50);
|
||||||
|
|
||||||
discord = new Dialog("Discord", "dialog");
|
discord = new Dialog("Discord", "dialog");
|
||||||
discord.content().pad(12f);
|
discord.content().margin(12f);
|
||||||
discord.content().add("Join the mindustry discord!\n[orange]" + Vars.discordURL);
|
discord.content().add("Join the mindustry discord!\n[orange]" + Vars.discordURL);
|
||||||
discord.buttons().defaults().size(200f, 50);
|
discord.buttons().defaults().size(200f, 50);
|
||||||
discord.buttons().addButton("Open link", () -> Mindustry.platforms.openLink(Vars.discordURL));
|
discord.buttons().addButton("Open link", () -> Mindustry.platforms.openLink(Vars.discordURL));
|
||||||
@@ -197,20 +197,20 @@ public class UI extends SceneModule{
|
|||||||
prefs.setStyle(Core.skin.get("dialog", WindowStyle.class));
|
prefs.setStyle(Core.skin.get("dialog", WindowStyle.class));
|
||||||
|
|
||||||
menu = new MenuDialog();
|
menu = new MenuDialog();
|
||||||
|
|
||||||
|
prefs.sound.volumePrefs();
|
||||||
|
|
||||||
prefs.sliderPref("difficulty", "Difficulty", 1, 0, 2, i -> i == 0 ? "Easy" : i == 1 ? "Normal" : "Hard");
|
prefs.game.sliderPref("difficulty", "Difficulty", 1, 0, 2, i -> i == 0 ? "Easy" : i == 1 ? "Normal" : "Hard");
|
||||||
|
prefs.game.screenshakePref();
|
||||||
prefs.screenshakePref();
|
prefs.game.checkPref("smoothcam", "Smooth Camera", true);
|
||||||
prefs.volumePrefs();
|
prefs.game.checkPref("indicators", "Enemy Indicators", true);
|
||||||
|
prefs.game.checkPref("effects", "Display Effects", true);
|
||||||
prefs.checkPref("fps", "Show FPS", false);
|
|
||||||
prefs.checkPref("vsync", "VSync", true, b -> Gdx.graphics.setVSync(b));
|
prefs.graphics.checkPref("fps", "Show FPS", false);
|
||||||
//prefs.checkPref("noshadows", "Disable shadows", false);
|
prefs.graphics.checkPref("vsync", "VSync", true, b -> Gdx.graphics.setVSync(b));
|
||||||
//prefs.checkPref("drawblocks", "Draw Blocks", true);
|
prefs.graphics.checkPref("lasers", "Show Power Lasers", true);
|
||||||
prefs.checkPref("smoothcam", "Smooth Camera", true);
|
prefs.graphics.checkPref("healthbars", "Show Entity Health bars", true);
|
||||||
prefs.checkPref("indicators", "Enemy Indicators", true);
|
prefs.graphics.checkPref("pixelate", "Pixelate Screen", true, b->{
|
||||||
prefs.checkPref("effects", "Display Effects", true);
|
|
||||||
prefs.checkPref("pixelate", "Pixelate Screen", true, b->{
|
|
||||||
if(b){
|
if(b){
|
||||||
Vars.renderer.pixelSurface.setScale(Core.cameraScale);
|
Vars.renderer.pixelSurface.setScale(Core.cameraScale);
|
||||||
Vars.renderer.shadowSurface.setScale(Core.cameraScale);
|
Vars.renderer.shadowSurface.setScale(Core.cameraScale);
|
||||||
@@ -241,13 +241,6 @@ public class UI extends SceneModule{
|
|||||||
menu.hide();
|
menu.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!android){
|
|
||||||
prefs.content().row();
|
|
||||||
prefs.content().addButton("Controls", () -> {
|
|
||||||
keys.show(scene);
|
|
||||||
}).size(300f, 50f).pad(5f);
|
|
||||||
}
|
|
||||||
|
|
||||||
keys = new MindustryKeybindDialog();
|
keys = new MindustryKeybindDialog();
|
||||||
|
|
||||||
@@ -358,7 +351,7 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
public void showError(String text){
|
public void showError(String text){
|
||||||
new Dialog("[crimson]An error has occured", "dialog"){{
|
new Dialog("[crimson]An error has occured", "dialog"){{
|
||||||
content().pad(15);
|
content().margin(15);
|
||||||
content().add(text);
|
content().add(text);
|
||||||
getButtonTable().addButton("OK", this::hide).size(90, 50).pad(4);
|
getButtonTable().addButton("OK", this::hide).size(90, 50).pad(4);
|
||||||
}}.show();
|
}}.show();
|
||||||
@@ -366,7 +359,7 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
public void showErrorClose(String text){
|
public void showErrorClose(String text){
|
||||||
new Dialog("[crimson]A critical error has occured", "dialog"){{
|
new Dialog("[crimson]A critical error has occured", "dialog"){{
|
||||||
content().pad(15);
|
content().margin(15);
|
||||||
content().add(text);
|
content().add(text);
|
||||||
getButtonTable().addButton("Exit", Gdx.app::exit).size(90, 50).pad(4);
|
getButtonTable().addButton("Exit", Gdx.app::exit).size(90, 50).pad(4);
|
||||||
}}.show();
|
}}.show();
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package io.anuke.mindustry.mapeditor;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Pixmap;
|
import com.badlogic.gdx.graphics.Pixmap;
|
||||||
@@ -126,7 +125,7 @@ public class MapEditorDialog extends Dialog{
|
|||||||
setFillParent(true);
|
setFillParent(true);
|
||||||
|
|
||||||
clearChildren();
|
clearChildren();
|
||||||
pad(0);
|
margin(0);
|
||||||
build.begin(this);
|
build.begin(this);
|
||||||
build();
|
build();
|
||||||
build.end();
|
build.end();
|
||||||
@@ -224,7 +223,7 @@ public class MapEditorDialog extends Dialog{
|
|||||||
new table(){{
|
new table(){{
|
||||||
Table tools = new Table("button");
|
Table tools = new Table("button");
|
||||||
tools.top();
|
tools.top();
|
||||||
tools.padTop(0).padBottom(6);
|
tools.marginTop(0).marginBottom(6);
|
||||||
|
|
||||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||||||
image.setScaling(Scaling.fit);
|
image.setScaling(Scaling.fit);
|
||||||
Table preft = new Table();
|
Table preft = new Table();
|
||||||
preft.left();
|
preft.left();
|
||||||
preft.pad(4f).padRight(25f);
|
preft.margin(4f).marginRight(25f);
|
||||||
|
|
||||||
for(GenPref pref : editor.getFilter().getPrefs().values()){
|
for(GenPref pref : editor.getFilter().getPrefs().values()){
|
||||||
CheckBox box = new CheckBox(pref.name);
|
CheckBox box = new CheckBox(pref.name);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class MapLoadDialog extends FloatingDialog{
|
|||||||
|
|
||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
table.defaults().size(200f, 90f).pad(4f);
|
table.defaults().size(200f, 90f).pad(4f);
|
||||||
table.pad(10f);
|
table.margin(10f);
|
||||||
|
|
||||||
ScrollPane pane = new ScrollPane(table, "horizontal");
|
ScrollPane pane = new ScrollPane(table, "horizontal");
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
public boolean zoom(float initialDistance, float distance){
|
public boolean zoom(float initialDistance, float distance){
|
||||||
if(!active()) return false;
|
if(!active()) return false;
|
||||||
float nzoom = distance - initialDistance;
|
float nzoom = distance - initialDistance;
|
||||||
zoom += nzoom / 5000f / Unit.dp.scl(1f) * zoom;
|
zoom += nzoom / 10000f / Unit.dp.scl(1f) * zoom;
|
||||||
clampZoom();
|
clampZoom();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
|
|
||||||
private void setupWidgets(){
|
private void setupWidgets(){
|
||||||
getCell(content()).maxWidth(Gdx.graphics.getWidth()/Unit.dp.scl(2f));
|
getCell(content()).maxWidth(Gdx.graphics.getWidth()/Unit.dp.scl(2f));
|
||||||
content().pad(-10);
|
content().margin(-10);
|
||||||
|
|
||||||
Table content = new Table();
|
Table content = new Table();
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
content.add(icontable).expandX().fillX();
|
content.add(icontable).expandX().fillX();
|
||||||
content.row();
|
content.row();
|
||||||
|
|
||||||
//content.add(navigation).colspan(3).left().padBottom(10f).expandX().fillX().height(40f);
|
//content.add(navigation).colspan(3).left().marginBottom(10f).expandX().fillX().height(40f);
|
||||||
//content.row();
|
//content.row();
|
||||||
|
|
||||||
content.center().add(pane).width(Gdx.graphics.getWidth()/Unit.dp.scl(2)).colspan(3).grow();
|
content.center().add(pane).width(Gdx.graphics.getWidth()/Unit.dp.scl(2)).colspan(3).grow();
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class LevelDialog extends FloatingDialog{
|
|||||||
|
|
||||||
maps.add(stack).width(170).top().pad(4f);
|
maps.add(stack).width(170).top().pad(4f);
|
||||||
|
|
||||||
maps.padRight(26);
|
maps.marginRight(26);
|
||||||
|
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,12 +42,12 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
pane = new ScrollPane(slots);
|
pane = new ScrollPane(slots);
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
|
|
||||||
slots.padRight(24);
|
slots.marginRight(24);
|
||||||
|
|
||||||
for(int i = 0; i < Vars.saveSlots; i++){
|
for(int i = 0; i < Vars.saveSlots; i++){
|
||||||
|
|
||||||
TextButton button = new TextButton("[accent]Slot " + (i + 1));
|
TextButton button = new TextButton("[accent]Slot " + (i + 1));
|
||||||
button.pad(12);
|
button.margin(12);
|
||||||
button.getLabelCell().top().left().growX();
|
button.getLabelCell().top().left().growX();
|
||||||
|
|
||||||
button.row();
|
button.row();
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ public class MindustryKeybindDialog extends KeybindDialog{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCloseButton(){
|
public void addCloseButton(){
|
||||||
buttons().addImageTextButton("Back", "icon-arrow-left", 30f, ()->{
|
buttons().addImageTextButton("Back", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
||||||
hide();
|
|
||||||
}).size(230f, 64f);
|
|
||||||
|
|
||||||
keyDown(key->{
|
keyDown(key->{
|
||||||
if(key == Keys.ESCAPE || key == Keys.BACK)
|
if(key == Keys.ESCAPE || key == Keys.BACK)
|
||||||
|
|||||||
@@ -4,11 +4,23 @@ import com.badlogic.gdx.Input.Keys;
|
|||||||
import com.badlogic.gdx.graphics.Colors;
|
import com.badlogic.gdx.graphics.Colors;
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
|
|
||||||
import io.anuke.ucore.scene.ui.Image;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.ucore.scene.ui.SettingsDialog;
|
import io.anuke.ucore.UCore;
|
||||||
|
import io.anuke.ucore.scene.builders.table;
|
||||||
|
import io.anuke.ucore.scene.ui.*;
|
||||||
|
import io.anuke.ucore.scene.ui.layout.Stack;
|
||||||
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class MindustrySettingsDialog extends SettingsDialog{
|
public class MindustrySettingsDialog extends SettingsDialog{
|
||||||
|
public SettingsTable graphics;
|
||||||
|
public SettingsTable game;
|
||||||
|
public SettingsTable sound;
|
||||||
|
|
||||||
|
private Table prefs;
|
||||||
|
private Table menu;
|
||||||
|
private boolean built = false;
|
||||||
|
|
||||||
public MindustrySettingsDialog(){
|
public MindustrySettingsDialog(){
|
||||||
setFillParent(true);
|
setFillParent(true);
|
||||||
@@ -16,24 +28,71 @@ public class MindustrySettingsDialog extends SettingsDialog{
|
|||||||
getTitleTable().row();
|
getTitleTable().row();
|
||||||
getTitleTable().add(new Image("white"))
|
getTitleTable().add(new Image("white"))
|
||||||
.growX().height(3f).pad(4f).get().setColor(Colors.get("accent"));
|
.growX().height(3f).pad(4f).get().setColor(Colors.get("accent"));
|
||||||
|
|
||||||
|
content().clearChildren();
|
||||||
content().remove();
|
content().remove();
|
||||||
buttons().remove();
|
buttons().remove();
|
||||||
|
|
||||||
ScrollPane pane = new ScrollPane(content(), "clear");
|
menu = new Table();
|
||||||
|
|
||||||
|
game = new SettingsTable();
|
||||||
|
graphics = new SettingsTable();
|
||||||
|
sound = new SettingsTable();
|
||||||
|
|
||||||
|
prefs = new Table();
|
||||||
|
prefs.top();
|
||||||
|
prefs.margin(14f);
|
||||||
|
|
||||||
|
menu.defaults().size(300f, 60f).pad(3f);
|
||||||
|
menu.addButton("Game", () -> visible(0));
|
||||||
|
menu.row();
|
||||||
|
menu.addButton("Graphics", () -> visible(1));
|
||||||
|
menu.row();
|
||||||
|
menu.addButton("Sound", () -> visible(2));
|
||||||
|
|
||||||
|
if(!Vars.android) {
|
||||||
|
menu.row();
|
||||||
|
menu.addButton("Controls", () -> Vars.ui.showControls());
|
||||||
|
}
|
||||||
|
|
||||||
|
prefs.clearChildren();
|
||||||
|
prefs.add(menu);
|
||||||
|
|
||||||
|
ScrollPane pane = new ScrollPane(prefs, "clear");
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
|
|
||||||
row();
|
row();
|
||||||
add(pane).expand().fill();
|
add(pane).grow().top();
|
||||||
row();
|
row();
|
||||||
add(buttons()).fillX();
|
add(buttons()).fillX();
|
||||||
|
|
||||||
|
hidden(this::back);
|
||||||
|
|
||||||
|
shown(() -> {
|
||||||
|
if(built) return;
|
||||||
|
built = true;
|
||||||
|
|
||||||
|
Mathf.each(table -> {
|
||||||
|
table.row();
|
||||||
|
table.addImageTextButton("Back", "icon-arrow-left", 10*3, this::back).size(240f, 60f).colspan(2).padTop(15f);
|
||||||
|
}, game, graphics, sound);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void back(){
|
||||||
|
prefs.clearChildren();
|
||||||
|
prefs.add(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void visible(int index){
|
||||||
|
prefs.clearChildren();
|
||||||
|
Table table = Mathf.select(index, game, graphics, sound);
|
||||||
|
prefs.add(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCloseButton(){
|
public void addCloseButton(){
|
||||||
buttons().addImageTextButton("Back", "icon-arrow-left", 30f, ()->{
|
buttons().addImageTextButton("Menu", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
||||||
hide();
|
|
||||||
}).size(230f, 64f);
|
|
||||||
|
|
||||||
keyDown(key->{
|
keyDown(key->{
|
||||||
if(key == Keys.ESCAPE || key == Keys.BACK)
|
if(key == Keys.ESCAPE || key == Keys.BACK)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package io.anuke.mindustry.ui;
|
package io.anuke.mindustry.ui;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
|
||||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||||
|
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
@@ -24,7 +23,7 @@ public class SaveDialog extends LoadDialog{
|
|||||||
save(slot);
|
save(slot);
|
||||||
}){
|
}){
|
||||||
{
|
{
|
||||||
content().pad(16);
|
content().margin(16);
|
||||||
for(Cell<?> cell : getButtonTable().getCells())
|
for(Cell<?> cell : getButtonTable().getCells())
|
||||||
cell.size(110, 45).pad(4);
|
cell.size(110, 45).pad(4);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class UpgradeDialog extends FloatingDialog{
|
|||||||
});
|
});
|
||||||
|
|
||||||
Table weptab = new Table();
|
Table weptab = new Table();
|
||||||
weptab.pad(20);
|
weptab.margin(20);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(Weapon weapon : Weapon.values()){
|
for(Weapon weapon : Weapon.values()){
|
||||||
@@ -48,7 +48,7 @@ public class UpgradeDialog extends FloatingDialog{
|
|||||||
button.add(img).size(8*5);
|
button.add(img).size(8*5);
|
||||||
button.getCells().reverse();
|
button.getCells().reverse();
|
||||||
button.row();
|
button.row();
|
||||||
button.pad(14);
|
button.margin(14);
|
||||||
button.getLabelCell().left();
|
button.getLabelCell().left();
|
||||||
button.pack();
|
button.pack();
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ public class UpgradeDialog extends FloatingDialog{
|
|||||||
if(control.hasWeapon(weapon)){
|
if(control.hasWeapon(weapon)){
|
||||||
tiptable.add("[LIME]Purchased!").padTop(6).left();
|
tiptable.add("[LIME]Purchased!").padTop(6).left();
|
||||||
}
|
}
|
||||||
tiptable.pad(14f);
|
tiptable.margin(14f);
|
||||||
};
|
};
|
||||||
|
|
||||||
run.listen();
|
run.listen();
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class BlocksFragment implements Fragment{
|
|||||||
row();
|
row();
|
||||||
}
|
}
|
||||||
|
|
||||||
table.pad(4);
|
table.margin(4);
|
||||||
table.top().left();
|
table.top().left();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -124,8 +124,8 @@ public class BlocksFragment implements Fragment{
|
|||||||
add(stack).colspan(Section.values().length);
|
add(stack).colspan(Section.values().length);
|
||||||
margin(10f);
|
margin(10f);
|
||||||
|
|
||||||
get().padLeft(0f);
|
get().marginLeft(0f);
|
||||||
get().padRight(0f);
|
get().marginRight(0f);
|
||||||
|
|
||||||
end();
|
end();
|
||||||
}}.right().bottom().uniformX();
|
}}.right().bottom().uniformX();
|
||||||
@@ -142,7 +142,7 @@ public class BlocksFragment implements Fragment{
|
|||||||
|
|
||||||
desctable.defaults().left();
|
desctable.defaults().left();
|
||||||
desctable.left();
|
desctable.left();
|
||||||
desctable.pad(12);
|
desctable.margin(12);
|
||||||
|
|
||||||
Table header = new Table();
|
Table header = new Table();
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ public class HudFragment implements Fragment{
|
|||||||
.minWidth(140).left();
|
.minWidth(140).left();
|
||||||
|
|
||||||
margin(12f);
|
margin(12f);
|
||||||
get().padLeft(6);
|
get().marginLeft(6);
|
||||||
}}.left().end();
|
}}.left().end();
|
||||||
|
|
||||||
playButton(uheight);
|
playButton(uheight);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class MenuFragment implements Fragment{
|
|||||||
if(!gwt){
|
if(!gwt){
|
||||||
add(new MenuButton("text-exit", group, Gdx.app::exit));
|
add(new MenuButton("text-exit", group, Gdx.app::exit));
|
||||||
}
|
}
|
||||||
get().pad(16);
|
get().margin(16);
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
visible(()->GameState.is(State.menu));
|
visible(()->GameState.is(State.menu));
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class WeaponFragment implements Fragment{
|
|||||||
tiptable.row();
|
tiptable.row();
|
||||||
tiptable.row();
|
tiptable.row();
|
||||||
tiptable.add("[GRAY]" + description).left();
|
tiptable.add("[GRAY]" + description).left();
|
||||||
tiptable.pad(14f);
|
tiptable.margin(14f);
|
||||||
|
|
||||||
Tooltip tip = new Tooltip(tiptable);
|
Tooltip tip = new Tooltip(tiptable);
|
||||||
|
|
||||||
|
|||||||
@@ -48,10 +48,7 @@ public class ShieldedWallBlock extends PowerBlock{
|
|||||||
ShieldedWallEntity entity = tile.entity();
|
ShieldedWallEntity entity = tile.entity();
|
||||||
|
|
||||||
if(entity.power > powerToDamage){
|
if(entity.power > powerToDamage){
|
||||||
Graphics.surface(Vars.renderer.shieldSurface, false);
|
Vars.renderer.addShield(() -> Draw.rect("blank", tile.worldx(), tile.worldy(), Vars.tilesize, Vars.tilesize));
|
||||||
Draw.color(Color.ROYAL);
|
|
||||||
Draw.rect("blank", tile.worldx(), tile.worldy(), Vars.tilesize, Vars.tilesize);
|
|
||||||
Graphics.surface();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.color(hitColor);
|
Draw.color(hitColor);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import io.anuke.mindustry.world.blocks.types.PowerAcceptor;
|
|||||||
import io.anuke.mindustry.world.blocks.types.PowerBlock;
|
import io.anuke.mindustry.world.blocks.types.PowerBlock;
|
||||||
import io.anuke.ucore.core.Draw;
|
import io.anuke.ucore.core.Draw;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
|
import io.anuke.ucore.core.Settings;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.graphics.Hue;
|
import io.anuke.ucore.graphics.Hue;
|
||||||
import io.anuke.ucore.util.*;
|
import io.anuke.ucore.util.*;
|
||||||
@@ -127,6 +128,8 @@ public class Generator extends PowerBlock{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLayer(Tile tile){
|
public void drawLayer(Tile tile){
|
||||||
|
if(!Settings.getBool("lasers")) return;
|
||||||
|
|
||||||
PowerEntity entity = tile.entity();
|
PowerEntity entity = tile.entity();
|
||||||
|
|
||||||
for(int i = 0; i < laserDirections; i++){
|
for(int i = 0; i < laserDirections; i++){
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ draftWar {
|
|||||||
task addSource{
|
task addSource{
|
||||||
doLast{
|
doLast{
|
||||||
sourceSets.main.compileClasspath += files(project(':core').sourceSets.main.allJava.srcDirs)
|
sourceSets.main.compileClasspath += files(project(':core').sourceSets.main.allJava.srcDirs)
|
||||||
|
//this WILL fail if uCore is not a module
|
||||||
|
sourceSets.main.compileClasspath += files(project(':uCore').sourceSets.main.allJava.srcDirs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<module rename-to="html">
|
<module rename-to="html">
|
||||||
<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
|
<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
|
||||||
<inherits name='com.badlogic.gdx.ai' />
|
<inherits name='com.badlogic.gdx.ai' />
|
||||||
|
<inherits name='com.badlogic.gdx.controllers.controllers-gwt' />
|
||||||
<inherits name='Mindustry' />
|
<inherits name='Mindustry' />
|
||||||
<inherits name='uCore' />
|
<inherits name='uCore' />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user