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
border
rotate: false
xy: 336, 2
xy: 344, 25
size: 12, 12
split: 4, 4, 4, 4
orig: 12, 12
@ -35,7 +35,7 @@ border-circle-error
index: -1
border-dark-blue
rotate: false
xy: 324, 11
xy: 500, 42
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
@ -43,7 +43,7 @@ border-dark-blue
index: -1
border-error
rotate: false
xy: 500, 42
xy: 43, 7
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
@ -59,7 +59,7 @@ border-white
index: -1
button
rotate: false
xy: 238, 2
xy: 212, 2
size: 24, 40
split: 10, 10, 6, 10
orig: 24, 40
@ -128,9 +128,9 @@ button-gray-over
index: -1
button-map
rotate: false
xy: 238, 44
xy: 212, 44
size: 24, 40
split: 10, 10, 8, 8
split: 10, 10, 5, 10
orig: 24, 40
offset: 0, 0
index: -1
@ -138,21 +138,21 @@ button-map-down
rotate: false
xy: 186, 40
size: 24, 40
split: 10, 10, 8, 8
split: 10, 10, 5, 10
orig: 24, 40
offset: 0, 0
index: -1
button-map-over
rotate: false
xy: 212, 44
xy: 186, 40
size: 24, 40
split: 10, 10, 8, 8
split: 10, 10, 5, 10
orig: 24, 40
offset: 0, 0
index: -1
button-red
rotate: false
xy: 264, 44
xy: 238, 44
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
@ -161,7 +161,7 @@ button-red
index: -1
button-select
rotate: false
xy: 354, 39
xy: 330, 39
size: 24, 24
split: 4, 4, 4, 4
orig: 24, 24
@ -169,7 +169,7 @@ button-select
index: -1
button-window-bg
rotate: false
xy: 290, 44
xy: 264, 44
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
@ -178,7 +178,7 @@ button-window-bg
index: -1
button-window-over
rotate: false
xy: 212, 2
xy: 290, 44
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
@ -194,14 +194,14 @@ check-off
index: -1
check-on
rotate: false
xy: 264, 10
xy: 238, 10
size: 28, 32
orig: 28, 32
offset: 0, 0
index: -1
check-over
rotate: false
xy: 294, 10
xy: 268, 10
size: 28, 32
orig: 28, 32
offset: 0, 0
@ -222,7 +222,7 @@ color-picker-bar-selector
index: -1
color-picker-cross
rotate: false
xy: 402, 30
xy: 332, 11
size: 10, 10
orig: 10, 10
offset: 0, 0
@ -250,14 +250,14 @@ cursor
index: -1
cursor-normal
rotate: false
xy: 350, 4
xy: 344, 13
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
default-pane
rotate: false
xy: 324, 81
xy: 382, 44
size: 5, 3
split: 1, 1, 1, 1
orig: 5, 3
@ -265,7 +265,7 @@ default-pane
index: -1
default-pane-no-border
rotate: false
xy: 386, 42
xy: 75, 2
size: 1, 1
split: 0, 0, 0, 0
orig: 1, 1
@ -281,7 +281,7 @@ default-select
index: -1
default-select-selection
rotate: false
xy: 324, 76
xy: 43, 2
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
@ -289,28 +289,28 @@ default-select-selection
index: -1
grey
rotate: false
xy: 72, 10
xy: 78, 2
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
menu-bg
rotate: false
xy: 72, 10
xy: 78, 2
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
icon-cancel
rotate: false
xy: 324, 16
xy: 356, 49
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
icon-check
rotate: false
xy: 340, 16
xy: 372, 49
size: 14, 14
orig: 14, 14
offset: 0, 0
@ -338,49 +338,56 @@ icon-close-over
index: -1
icon-defense
rotate: false
xy: 402, 18
xy: 358, 37
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-distribution
rotate: false
xy: 414, 23
xy: 358, 25
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-menu
rotate: false
xy: 426, 23
xy: 356, 13
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-pause
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
orig: 10, 10
offset: 0, 0
index: -1
icon-production
rotate: false
xy: 426, 11
xy: 368, 13
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-rotate
rotate: false
xy: 386, 26
xy: 328, 23
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
icon-settings
rotate: false
xy: 358, 27
xy: 382, 30
size: 10, 10
orig: 10, 10
offset: 0, 0
@ -424,14 +431,14 @@ pane
index: -1
progressbar
rotate: false
xy: 380, 31
xy: 324, 52
size: 1, 32
orig: 1, 32
offset: 0, 0
index: -1
progressbar-filled
rotate: false
xy: 383, 31
xy: 327, 52
size: 1, 32
orig: 1, 32
offset: 0, 0
@ -445,7 +452,7 @@ progressbar-filled-vertical
index: -1
progressbar-vertical
rotate: false
xy: 324, 32
xy: 298, 11
size: 32, 1
orig: 32, 1
offset: 0, 0
@ -466,7 +473,7 @@ radio-on
index: -1
scroll
rotate: false
xy: 300, 2
xy: 274, 2
size: 34, 6
split: 4, 4, 2, 2
orig: 34, 6
@ -492,7 +499,7 @@ scroll-knob-horizontal
index: -1
scroll-knob-vertical
rotate: false
xy: 264, 2
xy: 238, 2
size: 34, 6
split: 12, 12, 2, 2
orig: 34, 6
@ -500,14 +507,14 @@ scroll-knob-vertical
index: -1
select-box-list-bg
rotate: false
xy: 414, 39
xy: 328, 20
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
window-bg
rotate: false
xy: 414, 39
xy: 328, 20
size: 1, 1
orig: 1, 1
offset: 0, 0
@ -528,35 +535,35 @@ select-up
index: -1
selection
rotate: false
xy: 354, 36
xy: 495, 92
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
separator
rotate: false
xy: 495, 92
xy: 505, 44
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
tree-over
rotate: false
xy: 495, 92
xy: 505, 44
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
separator-menu
rotate: false
xy: 75, 10
xy: 508, 44
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
slider
rotate: false
xy: 386, 55
xy: 34, 2
size: 1, 8
orig: 1, 8
offset: 0, 0
@ -613,21 +620,21 @@ splitpane
index: -1
splitpane-over
rotate: false
xy: 438, 32
xy: 72, 10
size: 8, 1
orig: 8, 1
offset: 0, 0
index: -1
splitpane-vertical
rotate: false
xy: 386, 45
xy: 37, 2
size: 1, 8
orig: 1, 8
offset: 0, 0
index: -1
splitpane-vertical-over
rotate: false
xy: 34, 2
xy: 40, 2
size: 1, 8
orig: 1, 8
offset: 0, 0
@ -641,7 +648,7 @@ sub-menu
index: -1
textfield
rotate: false
xy: 324, 35
xy: 298, 14
size: 28, 28
split: 6, 6, 6, 6
orig: 28, 28
@ -657,7 +664,7 @@ textfield-over
index: -1
tooltip-bg
rotate: false
xy: 438, 27
xy: 75, 5
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
@ -672,7 +679,7 @@ touchpad-knob
index: -1
tree-minus
rotate: false
xy: 362, 6
xy: 394, 30
size: 10, 10
orig: 10, 10
offset: 0, 0
@ -686,7 +693,7 @@ tree-plus
index: -1
tree-selection
rotate: false
xy: 443, 27
xy: 382, 25
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
@ -694,7 +701,7 @@ tree-selection
index: -1
white
rotate: false
xy: 37, 7
xy: 380, 20
size: 3, 3
orig: 3, 3
offset: 0, 0
@ -709,7 +716,7 @@ window
index: -1
window-border-bg
rotate: false
xy: 37, 2
xy: 406, 37
size: 3, 3
split: 1, 1, 1, 1
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<>();
int wave = 1;
float wavetime;
float extrawavetime;
int enemies = 0;
float respawntime;
@ -79,7 +80,8 @@ public class Control extends Module{
"down", Keys.S,
"right", Keys.D,
"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");
@ -127,6 +129,7 @@ public class Control extends Module{
);
//TODO remove this debugging
for(int i = 1; i < 60; i ++){
UCore.log("\n\n--WAVE " + i);
printEnemies(i);
@ -143,6 +146,7 @@ public class Control extends Module{
player.weapon = weapons.first();
wave = 1;
extrawavetime = maxwavespace;
wavetime = waveSpacing();
Entities.clear();
enemies = 0;
@ -196,6 +200,7 @@ public class Control extends Module{
this.wave = wave;
this.wavetime = wavetime;
this.enemies = enemies;
this.extrawavetime = maxwavespace;
}
void runWave(){
@ -241,6 +246,7 @@ public class Control extends Module{
}
wavetime = waveSpacing();
extrawavetime = maxwavespace;
}
void printEnemies(int wave){
@ -320,10 +326,6 @@ public class Control extends Module{
public void update(){
if(debug){
if(Inputs.keyUp(Keys.SPACE))
Effects.sound("shoot", World.core.worldx(), World.core.worldy());
if(Inputs.keyUp(Keys.O)){
Timers.mark();
SaveIO.write(Gdx.files.local("mapsave.mins"));
@ -339,23 +341,23 @@ public class Control extends Module{
if(Inputs.keyUp(Keys.C)){
for(Entity entity : Entities.all()){
if(entity instanceof Enemy)
if(entity instanceof Enemy){
entity.remove();
}
}
}
if(Inputs.keyDown(Keys.SPACE)){
Effects.shake(6, 4, Graphics.mouseWorld().x, Graphics.mouseWorld().y);
}
if(Inputs.keyDown(Keys.Y)){
new TestEnemy(0).set(player.x, player.y).add();
}
}
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(GameState.is(State.paused)){
ui.hideMenu();
@ -381,21 +383,23 @@ public class Control extends Module{
}
}
extrawavetime -= delta();
if(enemies <= 0){
wavetime -= delta();
}
if(wavetime <= 0 || (debug && Inputs.keyUp(Keys.F))){
if(wavetime <= 0 || (debug && Inputs.keyUp(Keys.F)) || extrawavetime <= 0){
runWave();
}
Entities.update();
if(!android){
Input.doInput();
}else{
AndroidInput.doInput();
}
}
if(!android){
Input.doInput();
}else{
AndroidInput.doInput();
}
}
}

View File

@ -145,6 +145,13 @@ public class EffectLoader{
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 -> {
Draw.thickness(2f);
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)){
Inputs.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.builders.*;
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.util.Mathf;
@ -112,6 +113,7 @@ public class UI extends SceneModule{
levels = new LevelDialog();
prefs = new SettingsDialog();
prefs.setStyle(Core.skin.get("dialog", WindowStyle.class));
menu = new MenuDialog();
@ -125,6 +127,15 @@ public class UI extends SceneModule{
prefs.checkPref("tutorial", "Show tutorial Window", true);
prefs.checkPref("fps", "Show FPS", false);
prefs.checkPref("noshadows", "Disable shadows", false);
prefs.hidden(()->{
GameState.set(State.playing);
});
prefs.shown(()->{
GameState.set(State.paused);
menu.hide();
});
keys = new KeybindDialog();
@ -216,7 +227,9 @@ public class UI extends SceneModule{
ImageButton image = new ImageButton(Draw.region(r.result.name()), "select");
image.clicked(()->{
if(Inventory.hasItems(r.requirements)){
if(player.recipe == r){
player.recipe = null;
}else{
player.recipe = r;
updateRecipe();
}
@ -228,8 +241,8 @@ public class UI extends SceneModule{
image.update(()->{
boolean has = Inventory.hasItems(r.requirements);
image.setDisabled(!has);
image.setChecked(player.recipe == r && has);
//image.setDisabled(!has);
image.setChecked(player.recipe == r);
//image.setTouchable(has ? Touchable.enabled : Touchable.disabled);
image.getImage().setColor(has ? Color.WHITE : Color.GRAY);
});
@ -283,16 +296,23 @@ public class UI extends SceneModule{
float isize = Unit.dp.inPixels(40);
new imagebutton("icon-menu", isize, ()->{
GameState.set(State.paused);
showMenu();
});
new imagebutton("icon-settings", isize, ()->{
GameState.set(State.paused);
prefs.show();
});
new imagebutton("icon-pause", isize, ()->{
//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();
row();
@ -306,6 +326,16 @@ public class UI extends SceneModule{
add(fps).size(-1);
}}.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...
new table(){{
@ -431,7 +461,7 @@ public class UI extends SceneModule{
scene.add(tools);
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(()->{
@ -488,7 +518,7 @@ public class UI extends SceneModule{
reqlabel.setText(text);
});
requirements.add(reqlabel);
requirements.add(reqlabel).left();
requirements.row();
}
@ -512,7 +542,7 @@ public class UI extends SceneModule{
if(weapon != player.weapon)
button.setColor(Color.GRAY);
weapontable.add(button).size(48, 52);
weapontable.add(button).size(52, 56);
Table tiptable = new Table();
String description = weapon.description;
@ -532,6 +562,10 @@ public class UI extends SceneModule{
button.addListener(tip);
}
weapontable.addIButton("icon-menu", 8*3, ()->{
upgrades.show();
}).size(52, 56);
}
public void showLoading(){

View File

@ -15,6 +15,8 @@ public class Vars{
public static final float respawnduration = 60*4;
//time between waves in frames
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
public static final float enemyspawnspace = 65;
//scale of the font

View File

@ -34,9 +34,16 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
sniper = new BulletType(3f, 20){
public void draw(Bullet b){
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();
}
public void update(Bullet b){
if(Timers.get(b, "smoke", 4)){
Effects.effect("railsmoke", b.x, b.y);
}
}
},
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.ProductionBlocks;
import io.anuke.ucore.core.*;
import io.anuke.ucore.scene.utils.Cursors;
import io.anuke.ucore.util.Mathf;
public class AndroidInput extends InputAdapter{
@ -87,11 +86,6 @@ public class AndroidInput extends InputAdapter{
for(ItemStack stack : player.recipe.requirements){
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.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.World;
import io.anuke.mindustry.world.blocks.Blocks;
@ -22,7 +25,7 @@ public class GestureHandler extends GestureAdapter{
public boolean longPress(float x, float y){
Tile tile = World.cursorTile();
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.shake(3f, 1f);
tile.setBlock(Blocks.air);
@ -34,7 +37,7 @@ public class GestureHandler extends GestureAdapter{
@Override
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.y += deltaY*Core.camera.zoom/Core.cameraScale;
}else{

View File

@ -42,11 +42,12 @@ public class Input{
//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){
player.weapon = control.getWeapons().get(i);
ui.updateWeapons();
}
}
if(Inputs.buttonUp(Buttons.LEFT) && player.recipe != null &&
World.validPlace(World.tilex(), World.tiley(), player.recipe.result) && !ui.hasMouse() &&

View File

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

View File

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

View File

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