1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-22 22:07:31 +03:00

More UI changes, made weapons usable, fixed ammo for turret types

This commit is contained in:
Anuken 2017-09-24 12:20:43 -04:00
parent 67b1fc4dbd
commit 2f092604a3
19 changed files with 156 additions and 93 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

View File

@ -13,7 +13,7 @@ blank
index: -1 index: -1
border border
rotate: false rotate: false
xy: 336, 2 xy: 344, 25
size: 12, 12 size: 12, 12
split: 4, 4, 4, 4 split: 4, 4, 4, 4
orig: 12, 12 orig: 12, 12
@ -35,7 +35,7 @@ border-circle-error
index: -1 index: -1
border-dark-blue border-dark-blue
rotate: false rotate: false
xy: 324, 11 xy: 500, 42
size: 3, 3 size: 3, 3
split: 1, 1, 1, 1 split: 1, 1, 1, 1
orig: 3, 3 orig: 3, 3
@ -43,7 +43,7 @@ border-dark-blue
index: -1 index: -1
border-error border-error
rotate: false rotate: false
xy: 500, 42 xy: 43, 7
size: 3, 3 size: 3, 3
split: 1, 1, 1, 1 split: 1, 1, 1, 1
orig: 3, 3 orig: 3, 3
@ -59,7 +59,7 @@ border-white
index: -1 index: -1
button button
rotate: false rotate: false
xy: 238, 2 xy: 212, 2
size: 24, 40 size: 24, 40
split: 10, 10, 6, 10 split: 10, 10, 6, 10
orig: 24, 40 orig: 24, 40
@ -128,9 +128,9 @@ button-gray-over
index: -1 index: -1
button-map button-map
rotate: false rotate: false
xy: 238, 44 xy: 212, 44
size: 24, 40 size: 24, 40
split: 10, 10, 8, 8 split: 10, 10, 5, 10
orig: 24, 40 orig: 24, 40
offset: 0, 0 offset: 0, 0
index: -1 index: -1
@ -138,21 +138,21 @@ button-map-down
rotate: false rotate: false
xy: 186, 40 xy: 186, 40
size: 24, 40 size: 24, 40
split: 10, 10, 8, 8 split: 10, 10, 5, 10
orig: 24, 40 orig: 24, 40
offset: 0, 0 offset: 0, 0
index: -1 index: -1
button-map-over button-map-over
rotate: false rotate: false
xy: 212, 44 xy: 186, 40
size: 24, 40 size: 24, 40
split: 10, 10, 8, 8 split: 10, 10, 5, 10
orig: 24, 40 orig: 24, 40
offset: 0, 0 offset: 0, 0
index: -1 index: -1
button-red button-red
rotate: false rotate: false
xy: 264, 44 xy: 238, 44
size: 24, 40 size: 24, 40
split: 10, 10, 10, 8 split: 10, 10, 10, 8
pad: 8, 8, 2, 2 pad: 8, 8, 2, 2
@ -161,7 +161,7 @@ button-red
index: -1 index: -1
button-select button-select
rotate: false rotate: false
xy: 354, 39 xy: 330, 39
size: 24, 24 size: 24, 24
split: 4, 4, 4, 4 split: 4, 4, 4, 4
orig: 24, 24 orig: 24, 24
@ -169,7 +169,7 @@ button-select
index: -1 index: -1
button-window-bg button-window-bg
rotate: false rotate: false
xy: 290, 44 xy: 264, 44
size: 24, 40 size: 24, 40
split: 10, 10, 10, 8 split: 10, 10, 10, 8
pad: 8, 8, 2, 2 pad: 8, 8, 2, 2
@ -178,7 +178,7 @@ button-window-bg
index: -1 index: -1
button-window-over button-window-over
rotate: false rotate: false
xy: 212, 2 xy: 290, 44
size: 24, 40 size: 24, 40
split: 10, 10, 10, 8 split: 10, 10, 10, 8
pad: 8, 8, 2, 2 pad: 8, 8, 2, 2
@ -194,14 +194,14 @@ check-off
index: -1 index: -1
check-on check-on
rotate: false rotate: false
xy: 264, 10 xy: 238, 10
size: 28, 32 size: 28, 32
orig: 28, 32 orig: 28, 32
offset: 0, 0 offset: 0, 0
index: -1 index: -1
check-over check-over
rotate: false rotate: false
xy: 294, 10 xy: 268, 10
size: 28, 32 size: 28, 32
orig: 28, 32 orig: 28, 32
offset: 0, 0 offset: 0, 0
@ -222,7 +222,7 @@ color-picker-bar-selector
index: -1 index: -1
color-picker-cross color-picker-cross
rotate: false rotate: false
xy: 402, 30 xy: 332, 11
size: 10, 10 size: 10, 10
orig: 10, 10 orig: 10, 10
offset: 0, 0 offset: 0, 0
@ -250,14 +250,14 @@ cursor
index: -1 index: -1
cursor-normal cursor-normal
rotate: false rotate: false
xy: 350, 4 xy: 344, 13
size: 10, 10 size: 10, 10
orig: 10, 10 orig: 10, 10
offset: 0, 0 offset: 0, 0
index: -1 index: -1
default-pane default-pane
rotate: false rotate: false
xy: 324, 81 xy: 382, 44
size: 5, 3 size: 5, 3
split: 1, 1, 1, 1 split: 1, 1, 1, 1
orig: 5, 3 orig: 5, 3
@ -265,7 +265,7 @@ default-pane
index: -1 index: -1
default-pane-no-border default-pane-no-border
rotate: false rotate: false
xy: 386, 42 xy: 75, 2
size: 1, 1 size: 1, 1
split: 0, 0, 0, 0 split: 0, 0, 0, 0
orig: 1, 1 orig: 1, 1
@ -281,7 +281,7 @@ default-select
index: -1 index: -1
default-select-selection default-select-selection
rotate: false rotate: false
xy: 324, 76 xy: 43, 2
size: 3, 3 size: 3, 3
split: 1, 1, 1, 1 split: 1, 1, 1, 1
orig: 3, 3 orig: 3, 3
@ -289,28 +289,28 @@ default-select-selection
index: -1 index: -1
grey grey
rotate: false rotate: false
xy: 72, 10 xy: 78, 2
size: 1, 1 size: 1, 1
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
menu-bg menu-bg
rotate: false rotate: false
xy: 72, 10 xy: 78, 2
size: 1, 1 size: 1, 1
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-cancel icon-cancel
rotate: false rotate: false
xy: 324, 16 xy: 356, 49
size: 14, 14 size: 14, 14
orig: 14, 14 orig: 14, 14
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-check icon-check
rotate: false rotate: false
xy: 340, 16 xy: 372, 49
size: 14, 14 size: 14, 14
orig: 14, 14 orig: 14, 14
offset: 0, 0 offset: 0, 0
@ -338,49 +338,56 @@ icon-close-over
index: -1 index: -1
icon-defense icon-defense
rotate: false rotate: false
xy: 402, 18 xy: 358, 37
size: 10, 10 size: 10, 10
orig: 10, 10 orig: 10, 10
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-distribution icon-distribution
rotate: false rotate: false
xy: 414, 23 xy: 358, 25
size: 10, 10 size: 10, 10
orig: 10, 10 orig: 10, 10
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-menu icon-menu
rotate: false rotate: false
xy: 426, 23 xy: 356, 13
size: 10, 10 size: 10, 10
orig: 10, 10 orig: 10, 10
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-pause icon-pause
rotate: false rotate: false
xy: 414, 11 xy: 370, 37
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-play
rotate: false
xy: 370, 25
size: 10, 10 size: 10, 10
orig: 10, 10 orig: 10, 10
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-production icon-production
rotate: false rotate: false
xy: 426, 11 xy: 368, 13
size: 10, 10 size: 10, 10
orig: 10, 10 orig: 10, 10
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-rotate icon-rotate
rotate: false rotate: false
xy: 386, 26 xy: 328, 23
size: 14, 14 size: 14, 14
orig: 14, 14 orig: 14, 14
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-settings icon-settings
rotate: false rotate: false
xy: 358, 27 xy: 382, 30
size: 10, 10 size: 10, 10
orig: 10, 10 orig: 10, 10
offset: 0, 0 offset: 0, 0
@ -424,14 +431,14 @@ pane
index: -1 index: -1
progressbar progressbar
rotate: false rotate: false
xy: 380, 31 xy: 324, 52
size: 1, 32 size: 1, 32
orig: 1, 32 orig: 1, 32
offset: 0, 0 offset: 0, 0
index: -1 index: -1
progressbar-filled progressbar-filled
rotate: false rotate: false
xy: 383, 31 xy: 327, 52
size: 1, 32 size: 1, 32
orig: 1, 32 orig: 1, 32
offset: 0, 0 offset: 0, 0
@ -445,7 +452,7 @@ progressbar-filled-vertical
index: -1 index: -1
progressbar-vertical progressbar-vertical
rotate: false rotate: false
xy: 324, 32 xy: 298, 11
size: 32, 1 size: 32, 1
orig: 32, 1 orig: 32, 1
offset: 0, 0 offset: 0, 0
@ -466,7 +473,7 @@ radio-on
index: -1 index: -1
scroll scroll
rotate: false rotate: false
xy: 300, 2 xy: 274, 2
size: 34, 6 size: 34, 6
split: 4, 4, 2, 2 split: 4, 4, 2, 2
orig: 34, 6 orig: 34, 6
@ -492,7 +499,7 @@ scroll-knob-horizontal
index: -1 index: -1
scroll-knob-vertical scroll-knob-vertical
rotate: false rotate: false
xy: 264, 2 xy: 238, 2
size: 34, 6 size: 34, 6
split: 12, 12, 2, 2 split: 12, 12, 2, 2
orig: 34, 6 orig: 34, 6
@ -500,14 +507,14 @@ scroll-knob-vertical
index: -1 index: -1
select-box-list-bg select-box-list-bg
rotate: false rotate: false
xy: 414, 39 xy: 328, 20
size: 1, 1 size: 1, 1
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
window-bg window-bg
rotate: false rotate: false
xy: 414, 39 xy: 328, 20
size: 1, 1 size: 1, 1
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
@ -528,35 +535,35 @@ select-up
index: -1 index: -1
selection selection
rotate: false rotate: false
xy: 354, 36 xy: 495, 92
size: 1, 1 size: 1, 1
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
separator separator
rotate: false rotate: false
xy: 495, 92 xy: 505, 44
size: 1, 1 size: 1, 1
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
tree-over tree-over
rotate: false rotate: false
xy: 495, 92 xy: 505, 44
size: 1, 1 size: 1, 1
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
separator-menu separator-menu
rotate: false rotate: false
xy: 75, 10 xy: 508, 44
size: 1, 1 size: 1, 1
orig: 1, 1 orig: 1, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
slider slider
rotate: false rotate: false
xy: 386, 55 xy: 34, 2
size: 1, 8 size: 1, 8
orig: 1, 8 orig: 1, 8
offset: 0, 0 offset: 0, 0
@ -613,21 +620,21 @@ splitpane
index: -1 index: -1
splitpane-over splitpane-over
rotate: false rotate: false
xy: 438, 32 xy: 72, 10
size: 8, 1 size: 8, 1
orig: 8, 1 orig: 8, 1
offset: 0, 0 offset: 0, 0
index: -1 index: -1
splitpane-vertical splitpane-vertical
rotate: false rotate: false
xy: 386, 45 xy: 37, 2
size: 1, 8 size: 1, 8
orig: 1, 8 orig: 1, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
splitpane-vertical-over splitpane-vertical-over
rotate: false rotate: false
xy: 34, 2 xy: 40, 2
size: 1, 8 size: 1, 8
orig: 1, 8 orig: 1, 8
offset: 0, 0 offset: 0, 0
@ -641,7 +648,7 @@ sub-menu
index: -1 index: -1
textfield textfield
rotate: false rotate: false
xy: 324, 35 xy: 298, 14
size: 28, 28 size: 28, 28
split: 6, 6, 6, 6 split: 6, 6, 6, 6
orig: 28, 28 orig: 28, 28
@ -657,7 +664,7 @@ textfield-over
index: -1 index: -1
tooltip-bg tooltip-bg
rotate: false rotate: false
xy: 438, 27 xy: 75, 5
size: 3, 3 size: 3, 3
split: 1, 1, 1, 1 split: 1, 1, 1, 1
orig: 3, 3 orig: 3, 3
@ -672,7 +679,7 @@ touchpad-knob
index: -1 index: -1
tree-minus tree-minus
rotate: false rotate: false
xy: 362, 6 xy: 394, 30
size: 10, 10 size: 10, 10
orig: 10, 10 orig: 10, 10
offset: 0, 0 offset: 0, 0
@ -686,7 +693,7 @@ tree-plus
index: -1 index: -1
tree-selection tree-selection
rotate: false rotate: false
xy: 443, 27 xy: 382, 25
size: 3, 3 size: 3, 3
split: 1, 1, 1, 1 split: 1, 1, 1, 1
orig: 3, 3 orig: 3, 3
@ -694,7 +701,7 @@ tree-selection
index: -1 index: -1
white white
rotate: false rotate: false
xy: 37, 7 xy: 380, 20
size: 3, 3 size: 3, 3
orig: 3, 3 orig: 3, 3
offset: 0, 0 offset: 0, 0
@ -709,7 +716,7 @@ window
index: -1 index: -1
window-border-bg window-border-bg
rotate: false rotate: false
xy: 37, 2 xy: 406, 37
size: 3, 3 size: 3, 3
split: 1, 1, 1, 1 split: 1, 1, 1, 1
orig: 3, 3 orig: 3, 3

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -41,6 +41,7 @@ public class Control extends Module{
Array<EnemySpawn> spawns = new Array<>(); Array<EnemySpawn> spawns = new Array<>();
int wave = 1; int wave = 1;
float wavetime; float wavetime;
float extrawavetime;
int enemies = 0; int enemies = 0;
float respawntime; float respawntime;
@ -79,7 +80,8 @@ public class Control extends Module{
"down", Keys.S, "down", Keys.S,
"right", Keys.D, "right", Keys.D,
"rotate", Keys.R, "rotate", Keys.R,
"menu", Gdx.app.getType() == ApplicationType.Android ? Keys.BACK : Keys.ESCAPE "menu", Gdx.app.getType() == ApplicationType.Android ? Keys.BACK : Keys.ESCAPE,
"pause", Keys.SPACE
); );
Settings.loadAll("io.anuke.moment"); Settings.loadAll("io.anuke.moment");
@ -127,6 +129,7 @@ public class Control extends Module{
); );
//TODO remove this debugging
for(int i = 1; i < 60; i ++){ for(int i = 1; i < 60; i ++){
UCore.log("\n\n--WAVE " + i); UCore.log("\n\n--WAVE " + i);
printEnemies(i); printEnemies(i);
@ -143,6 +146,7 @@ public class Control extends Module{
player.weapon = weapons.first(); player.weapon = weapons.first();
wave = 1; wave = 1;
extrawavetime = maxwavespace;
wavetime = waveSpacing(); wavetime = waveSpacing();
Entities.clear(); Entities.clear();
enemies = 0; enemies = 0;
@ -196,6 +200,7 @@ public class Control extends Module{
this.wave = wave; this.wave = wave;
this.wavetime = wavetime; this.wavetime = wavetime;
this.enemies = enemies; this.enemies = enemies;
this.extrawavetime = maxwavespace;
} }
void runWave(){ void runWave(){
@ -241,6 +246,7 @@ public class Control extends Module{
} }
wavetime = waveSpacing(); wavetime = waveSpacing();
extrawavetime = maxwavespace;
} }
void printEnemies(int wave){ void printEnemies(int wave){
@ -320,10 +326,6 @@ public class Control extends Module{
public void update(){ public void update(){
if(debug){ if(debug){
if(Inputs.keyUp(Keys.SPACE))
Effects.sound("shoot", World.core.worldx(), World.core.worldy());
if(Inputs.keyUp(Keys.O)){ if(Inputs.keyUp(Keys.O)){
Timers.mark(); Timers.mark();
SaveIO.write(Gdx.files.local("mapsave.mins")); SaveIO.write(Gdx.files.local("mapsave.mins"));
@ -339,23 +341,23 @@ public class Control extends Module{
if(Inputs.keyUp(Keys.C)){ if(Inputs.keyUp(Keys.C)){
for(Entity entity : Entities.all()){ for(Entity entity : Entities.all()){
if(entity instanceof Enemy) if(entity instanceof Enemy){
entity.remove(); entity.remove();
}
} }
} }
if(Inputs.keyDown(Keys.SPACE)){
Effects.shake(6, 4, Graphics.mouseWorld().x, Graphics.mouseWorld().y);
}
if(Inputs.keyDown(Keys.Y)){ if(Inputs.keyDown(Keys.Y)){
new TestEnemy(0).set(player.x, player.y).add(); new TestEnemy(0).set(player.x, player.y).add();
} }
} }
if(!GameState.is(State.menu)){ if(!GameState.is(State.menu)){
if(Inputs.keyUp("pause") && (GameState.is(State.paused) || GameState.is(State.playing))){
GameState.set(GameState.is(State.playing) ? State.paused : State.playing);
}
if(Inputs.keyUp("menu")){ if(Inputs.keyUp("menu")){
if(GameState.is(State.paused)){ if(GameState.is(State.paused)){
ui.hideMenu(); ui.hideMenu();
@ -381,21 +383,23 @@ public class Control extends Module{
} }
} }
extrawavetime -= delta();
if(enemies <= 0){ if(enemies <= 0){
wavetime -= delta(); wavetime -= delta();
} }
if(wavetime <= 0 || (debug && Inputs.keyUp(Keys.F))){ if(wavetime <= 0 || (debug && Inputs.keyUp(Keys.F)) || extrawavetime <= 0){
runWave(); runWave();
} }
Entities.update(); Entities.update();
}
if(!android){
Input.doInput(); if(!android){
}else{ Input.doInput();
AndroidInput.doInput(); }else{
} AndroidInput.doInput();
} }
} }
} }

View File

@ -145,6 +145,13 @@ public class EffectLoader{
Draw.reset(); Draw.reset();
}); });
Effects.create("railsmoke", 30, e -> {
Draw.color(Color.LIGHT_GRAY, Color.WHITE, e.ifract());
float size = e.fract()*4f;
Draw.rect("circle", e.x, e.y, size, size);
Draw.reset();
});
Effects.create("spawn", 23, e -> { Effects.create("spawn", 23, e -> {
Draw.thickness(2f); Draw.thickness(2f);
Draw.color(Hue.mix(Color.DARK_GRAY, Color.SCARLET, e.ifract())); Draw.color(Hue.mix(Color.DARK_GRAY, Color.SCARLET, e.ifract()));

View File

@ -32,8 +32,9 @@ public class Mindustry extends ModuleCore {
} }
if(!GameState.is(State.paused)){ if(!GameState.is(State.paused)){
Inputs.update();
Timers.update(); Timers.update();
} }
Inputs.update();
} }
} }

View File

@ -26,6 +26,7 @@ import io.anuke.ucore.modules.SceneModule;
import io.anuke.ucore.scene.actions.Actions; import io.anuke.ucore.scene.actions.Actions;
import io.anuke.ucore.scene.builders.*; import io.anuke.ucore.scene.builders.*;
import io.anuke.ucore.scene.ui.*; import io.anuke.ucore.scene.ui.*;
import io.anuke.ucore.scene.ui.Window.WindowStyle;
import io.anuke.ucore.scene.ui.layout.*; import io.anuke.ucore.scene.ui.layout.*;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
@ -112,6 +113,7 @@ public class UI extends SceneModule{
levels = new LevelDialog(); levels = new LevelDialog();
prefs = new SettingsDialog(); prefs = new SettingsDialog();
prefs.setStyle(Core.skin.get("dialog", WindowStyle.class));
menu = new MenuDialog(); menu = new MenuDialog();
@ -125,6 +127,15 @@ public class UI extends SceneModule{
prefs.checkPref("tutorial", "Show tutorial Window", true); prefs.checkPref("tutorial", "Show tutorial Window", true);
prefs.checkPref("fps", "Show FPS", false); prefs.checkPref("fps", "Show FPS", false);
prefs.checkPref("noshadows", "Disable shadows", false); prefs.checkPref("noshadows", "Disable shadows", false);
prefs.hidden(()->{
GameState.set(State.playing);
});
prefs.shown(()->{
GameState.set(State.paused);
menu.hide();
});
keys = new KeybindDialog(); keys = new KeybindDialog();
@ -216,7 +227,9 @@ public class UI extends SceneModule{
ImageButton image = new ImageButton(Draw.region(r.result.name()), "select"); ImageButton image = new ImageButton(Draw.region(r.result.name()), "select");
image.clicked(()->{ image.clicked(()->{
if(Inventory.hasItems(r.requirements)){ if(player.recipe == r){
player.recipe = null;
}else{
player.recipe = r; player.recipe = r;
updateRecipe(); updateRecipe();
} }
@ -228,8 +241,8 @@ public class UI extends SceneModule{
image.update(()->{ image.update(()->{
boolean has = Inventory.hasItems(r.requirements); boolean has = Inventory.hasItems(r.requirements);
image.setDisabled(!has); //image.setDisabled(!has);
image.setChecked(player.recipe == r && has); image.setChecked(player.recipe == r);
//image.setTouchable(has ? Touchable.enabled : Touchable.disabled); //image.setTouchable(has ? Touchable.enabled : Touchable.disabled);
image.getImage().setColor(has ? Color.WHITE : Color.GRAY); image.getImage().setColor(has ? Color.WHITE : Color.GRAY);
}); });
@ -283,16 +296,23 @@ public class UI extends SceneModule{
float isize = Unit.dp.inPixels(40); float isize = Unit.dp.inPixels(40);
new imagebutton("icon-menu", isize, ()->{ new imagebutton("icon-menu", isize, ()->{
GameState.set(State.paused);
showMenu(); showMenu();
}); });
new imagebutton("icon-settings", isize, ()->{ new imagebutton("icon-settings", isize, ()->{
GameState.set(State.paused);
prefs.show(); prefs.show();
}); });
new imagebutton("icon-pause", isize, ()->{ new imagebutton("icon-pause", isize, ()->{
//TODO pause //TODO pause
}); GameState.set(GameState.is(State.paused) ? State.playing : State.paused);
}){{
get().update(()->{
get().getStyle().imageUp = Core.skin.getDrawable(GameState.is(State.paused) ? "icon-play" : "icon-pause");
});
}};
}}.end(); }}.end();
row(); row();
@ -306,6 +326,16 @@ public class UI extends SceneModule{
add(fps).size(-1); add(fps).size(-1);
}}.end(); }}.end();
//paused table
new table(){{
visible(()->GameState.is(State.paused));
atop();
new table("pane"){{
new label("[orange]< paused >").scale(0.75f).pad(6);
}}.end();
}}.end();
//wave table... //wave table...
new table(){{ new table(){{
@ -431,7 +461,7 @@ public class UI extends SceneModule{
scene.add(tools); scene.add(tools);
tools.setVisible(()->{ tools.setVisible(()->{
return !GameState.is(State.menu) && android && player.recipe != null; return !GameState.is(State.menu) && android && player.recipe != null && Inventory.hasItems(player.recipe.requirements);
}); });
tools.update(()->{ tools.update(()->{
@ -488,7 +518,7 @@ public class UI extends SceneModule{
reqlabel.setText(text); reqlabel.setText(text);
}); });
requirements.add(reqlabel); requirements.add(reqlabel).left();
requirements.row(); requirements.row();
} }
@ -512,7 +542,7 @@ public class UI extends SceneModule{
if(weapon != player.weapon) if(weapon != player.weapon)
button.setColor(Color.GRAY); button.setColor(Color.GRAY);
weapontable.add(button).size(48, 52); weapontable.add(button).size(52, 56);
Table tiptable = new Table(); Table tiptable = new Table();
String description = weapon.description; String description = weapon.description;
@ -532,6 +562,10 @@ public class UI extends SceneModule{
button.addListener(tip); button.addListener(tip);
} }
weapontable.addIButton("icon-menu", 8*3, ()->{
upgrades.show();
}).size(52, 56);
} }
public void showLoading(){ public void showLoading(){

View File

@ -15,6 +15,8 @@ public class Vars{
public static final float respawnduration = 60*4; public static final float respawnduration = 60*4;
//time between waves in frames //time between waves in frames
public static final float wavespace = 35*60*(android ? 2 : 1); public static final float wavespace = 35*60*(android ? 2 : 1);
//waves can last no longer than 6 minutes, otherwise the next one spawns
public static final float maxwavespace = 60*60*6;
//how far away from spawn points the player can't place blocks //how far away from spawn points the player can't place blocks
public static final float enemyspawnspace = 65; public static final float enemyspawnspace = 65;
//scale of the font //scale of the font

View File

@ -34,9 +34,16 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
sniper = new BulletType(3f, 20){ sniper = new BulletType(3f, 20){
public void draw(Bullet b){ public void draw(Bullet b){
Draw.color(Color.LIGHT_GRAY); Draw.color(Color.LIGHT_GRAY);
Draw.rect("bullet", b.x, b.y, b.angle()); Draw.thick(1f);
Draw.lineAngleCenter(b.x, b.y, b.angle(), 3f);
Draw.reset(); Draw.reset();
} }
public void update(Bullet b){
if(Timers.get(b, "smoke", 4)){
Effects.effect("railsmoke", b.x, b.y);
}
}
}, },
shell = new BulletType(1.1f, 80){ shell = new BulletType(1.1f, 80){
{ {

View File

@ -14,7 +14,6 @@ import io.anuke.mindustry.world.World;
import io.anuke.mindustry.world.blocks.Blocks; import io.anuke.mindustry.world.blocks.Blocks;
import io.anuke.mindustry.world.blocks.ProductionBlocks; import io.anuke.mindustry.world.blocks.ProductionBlocks;
import io.anuke.ucore.core.*; import io.anuke.ucore.core.*;
import io.anuke.ucore.scene.utils.Cursors;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
public class AndroidInput extends InputAdapter{ public class AndroidInput extends InputAdapter{
@ -87,11 +86,6 @@ public class AndroidInput extends InputAdapter{
for(ItemStack stack : player.recipe.requirements){ for(ItemStack stack : player.recipe.requirements){
Inventory.removeItem(stack); Inventory.removeItem(stack);
} }
if(!Inventory.hasItems(player.recipe.requirements)){
player.recipe = null;
Cursors.restoreCursor();
}
} }
} }

View File

@ -6,6 +6,9 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.input.GestureDetector.GestureAdapter; import com.badlogic.gdx.input.GestureDetector.GestureAdapter;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import io.anuke.mindustry.GameState;
import io.anuke.mindustry.GameState.State;
import io.anuke.mindustry.Inventory;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.World; import io.anuke.mindustry.world.World;
import io.anuke.mindustry.world.blocks.Blocks; import io.anuke.mindustry.world.blocks.Blocks;
@ -22,7 +25,7 @@ public class GestureHandler extends GestureAdapter{
public boolean longPress(float x, float y){ public boolean longPress(float x, float y){
Tile tile = World.cursorTile(); Tile tile = World.cursorTile();
player.breaktime += Timers.delta(); player.breaktime += Timers.delta();
if(player.breaktime >= tile.block().breaktime){ if(!GameState.is(State.menu) && player.breaktime >= tile.block().breaktime){
Effects.effect("break", tile.worldx(), tile.worldy()); Effects.effect("break", tile.worldx(), tile.worldy());
Effects.shake(3f, 1f); Effects.shake(3f, 1f);
tile.setBlock(Blocks.air); tile.setBlock(Blocks.air);
@ -34,7 +37,7 @@ public class GestureHandler extends GestureAdapter{
@Override @Override
public boolean pan(float x, float y, float deltaX, float deltaY){ public boolean pan(float x, float y, float deltaX, float deltaY){
if(player.recipe == null){ if(player.recipe == null || !Inventory.hasItems(player.recipe.requirements)){
player.x -= deltaX*Core.camera.zoom/Core.cameraScale; player.x -= deltaX*Core.camera.zoom/Core.cameraScale;
player.y += deltaY*Core.camera.zoom/Core.cameraScale; player.y += deltaY*Core.camera.zoom/Core.cameraScale;
}else{ }else{

View File

@ -42,11 +42,12 @@ public class Input{
//TODO restore cursor when requirements are back //TODO restore cursor when requirements are back
for(int i = 0; i < 9; i ++) for(int i = 0; i < 9; i ++){
if(Inputs.keyUp(Keys.valueOf(""+(i+1))) && i < control.getWeapons().size){ if(Inputs.keyUp(Keys.valueOf(""+(i+1))) && i < control.getWeapons().size){
player.weapon = control.getWeapons().get(i); player.weapon = control.getWeapons().get(i);
ui.updateWeapons(); ui.updateWeapons();
} }
}
if(Inputs.buttonUp(Buttons.LEFT) && player.recipe != null && if(Inputs.buttonUp(Buttons.LEFT) && player.recipe != null &&
World.validPlace(World.tilex(), World.tiley(), player.recipe.result) && !ui.hasMouse() && World.validPlace(World.tilex(), World.tiley(), player.recipe.result) && !ui.hasMouse() &&

View File

@ -119,6 +119,7 @@ public class ProductionBlocks{
input = Item.stone; input = Item.stone;
inputLiquid = Liquid.water; inputLiquid = Liquid.water;
output = Item.coal; output = Item.coal;
health = 50;
} }
@Override @Override
@ -137,6 +138,7 @@ public class ProductionBlocks{
liquidCapacity = 41f; liquidCapacity = 41f;
purifyTime = 90; purifyTime = 90;
output = Item.titanium; output = Item.titanium;
health = 70;
} }
@Override @Override

View File

@ -113,7 +113,8 @@ public class WeaponBlocks{
range = 120; range = 120;
reload = 120f; reload = 120f;
bullet = BulletType.shell; bullet = BulletType.shell;
ammo = Item.stone; ammo = Item.coal;
ammoMultiplier = 5;
health = 110; health = 110;
} }
}, },
@ -128,7 +129,7 @@ public class WeaponBlocks{
range = 60; range = 60;
reload = 4f; reload = 4f;
damage = 9; damage = 9;
ammo = Item.stone; ammo = Item.coal;
health = 110; health = 110;
} }
}, },
@ -140,7 +141,7 @@ public class WeaponBlocks{
range = 70; range = 70;
reload = 20f; reload = 20f;
bullet = BulletType.shell; bullet = BulletType.shell;
ammo = Item.stone; ammo = Item.coal;
health = 140; health = 140;
} }
@ -162,8 +163,9 @@ public class WeaponBlocks{
range = 60f; range = 60f;
reload = 3f; reload = 3f;
bullet = BulletType.plasmaflame; bullet = BulletType.plasmaflame;
ammo = Item.stone; ammo = Item.coal;
health = 180; health = 180;
ammoMultiplier = 40;
} }
}, },

View File

@ -39,7 +39,6 @@ public class Drill extends Block{
@Override @Override
public void drawOver(Tile tile){ public void drawOver(Tile tile){
if(tile.floor() != resource && resource != null){ if(tile.floor() != resource && resource != null){
Draw.colorl(0.85f + Mathf.absin(Timers.time(), 6f, 0.15f)); Draw.colorl(0.85f + Mathf.absin(Timers.time(), 6f, 0.15f));
Draw.rect("cross", tile.worldx(), tile.worldy()); Draw.rect("cross", tile.worldx(), tile.worldy());