Fix more bugs
This commit is contained in:
@@ -66,9 +66,7 @@ public class Enemy extends DestructibleEntity{
|
|||||||
Tile core = Vars.control.getCore();
|
Tile core = Vars.control.getCore();
|
||||||
|
|
||||||
if(idletime > maxIdleLife){
|
if(idletime > maxIdleLife){
|
||||||
Effects.effect(Fx.shellsmoke, this);
|
onDeath();
|
||||||
Effects.effect(Fx.explosion, this);
|
|
||||||
remove();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +237,7 @@ public class Enemy extends DestructibleEntity{
|
|||||||
|
|
||||||
float minv = 0.08f;
|
float minv = 0.08f;
|
||||||
|
|
||||||
if(xvelocity < minv && yvelocity < minv && node > 0){
|
if(xvelocity < minv && yvelocity < minv && node > 0 && target == null){
|
||||||
idletime += Timers.delta();
|
idletime += Timers.delta();
|
||||||
}else{
|
}else{
|
||||||
idletime = 0;
|
idletime = 0;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import io.anuke.ucore.scene.ui.Image;
|
|||||||
|
|
||||||
public class MenuButton extends Button{
|
public class MenuButton extends Button{
|
||||||
|
|
||||||
public MenuButton(String icon, Listenable clicked){
|
public MenuButton(String icon, PressGroup group, Listenable clicked){
|
||||||
super("menu");
|
super("menu");
|
||||||
Image image = new Image(icon);
|
Image image = new Image(icon);
|
||||||
image.setScaling(Scaling.fit);
|
image.setScaling(Scaling.fit);
|
||||||
@@ -17,5 +17,6 @@ public class MenuButton extends Button{
|
|||||||
image.setOrigin(Align.center);
|
image.setOrigin(Align.center);
|
||||||
add(image);
|
add(image);
|
||||||
clicked(clicked);
|
clicked(clicked);
|
||||||
|
group.add(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,11 @@ import static io.anuke.mindustry.Vars.ui;
|
|||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.core.GameState;
|
import io.anuke.mindustry.core.GameState;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
|
import io.anuke.ucore.scene.Element;
|
||||||
import io.anuke.ucore.scene.builders.build;
|
import io.anuke.ucore.scene.builders.build;
|
||||||
import io.anuke.ucore.scene.builders.imagebutton;
|
import io.anuke.ucore.scene.builders.imagebutton;
|
||||||
import io.anuke.ucore.scene.ui.ConfirmDialog;
|
import io.anuke.ucore.scene.ui.ConfirmDialog;
|
||||||
|
import io.anuke.ucore.scene.ui.ImageButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Cell;
|
import io.anuke.ucore.scene.ui.layout.Cell;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
|
|
||||||
@@ -69,6 +71,8 @@ public class MenuDialog extends FloatingDialog{
|
|||||||
}else{
|
}else{
|
||||||
build.begin(content());
|
build.begin(content());
|
||||||
|
|
||||||
|
PressGroup group = new PressGroup();
|
||||||
|
|
||||||
content().defaults().size(120f).pad(5).units(Unit.dp);
|
content().defaults().size(120f).pad(5).units(Unit.dp);
|
||||||
float isize = Unit.dp.inPixels(14f*4);
|
float isize = Unit.dp.inPixels(14f*4);
|
||||||
|
|
||||||
@@ -94,6 +98,12 @@ public class MenuDialog extends FloatingDialog{
|
|||||||
}}.show();
|
}}.show();
|
||||||
}).text("Quit").padTop(4f);
|
}).text("Quit").padTop(4f);
|
||||||
|
|
||||||
|
for(Element e : content().getChildren()){
|
||||||
|
if(e instanceof ImageButton){
|
||||||
|
group.add((ImageButton)e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
build.end();
|
build.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
core/src/io/anuke/mindustry/ui/PressGroup.java
Normal file
16
core/src/io/anuke/mindustry/ui/PressGroup.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package io.anuke.mindustry.ui;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
|
import io.anuke.ucore.scene.ui.Button;
|
||||||
|
|
||||||
|
public class PressGroup{
|
||||||
|
private Array<Button> buttons = new Array<>();
|
||||||
|
private boolean active = true;
|
||||||
|
|
||||||
|
public void add(Button button){
|
||||||
|
//TODO make only one button in the group be clickable
|
||||||
|
buttons.add(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import io.anuke.mindustry.Mindustry;
|
|||||||
import io.anuke.mindustry.core.GameState;
|
import io.anuke.mindustry.core.GameState;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.ui.MenuButton;
|
import io.anuke.mindustry.ui.MenuButton;
|
||||||
|
import io.anuke.mindustry.ui.PressGroup;
|
||||||
import io.anuke.mindustry.world.Map;
|
import io.anuke.mindustry.world.Map;
|
||||||
import io.anuke.ucore.scene.builders.imagebutton;
|
import io.anuke.ucore.scene.builders.imagebutton;
|
||||||
import io.anuke.ucore.scene.builders.table;
|
import io.anuke.ucore.scene.builders.table;
|
||||||
@@ -21,25 +22,27 @@ public class MenuFragment implements Fragment{
|
|||||||
new table(){{
|
new table(){{
|
||||||
|
|
||||||
new table(){{
|
new table(){{
|
||||||
|
PressGroup group = new PressGroup();
|
||||||
|
|
||||||
float scale = 4f;
|
float scale = 4f;
|
||||||
defaults().size(100*scale, 21*scale).pad(-10f).units(Unit.dp);
|
defaults().size(100*scale, 21*scale).pad(-10f).units(Unit.dp);
|
||||||
|
|
||||||
add(new MenuButton("text-play", ()-> ui.showLevels()));
|
add(new MenuButton("text-play", group, ()-> ui.showLevels()));
|
||||||
row();
|
row();
|
||||||
|
|
||||||
add(new MenuButton("text-tutorial", ()-> control.playMap(Map.tutorial)));
|
add(new MenuButton("text-tutorial", group, ()-> control.playMap(Map.tutorial)));
|
||||||
row();
|
row();
|
||||||
|
|
||||||
if(!gwt){
|
if(!gwt){
|
||||||
add(new MenuButton("text-load", ()-> ui.showLoadGame()));
|
add(new MenuButton("text-load", group, ()-> ui.showLoadGame()));
|
||||||
row();
|
row();
|
||||||
}
|
}
|
||||||
|
|
||||||
add(new MenuButton("text-settings", ()-> ui.showPrefs()));
|
add(new MenuButton("text-settings", group, ()-> ui.showPrefs()));
|
||||||
row();
|
row();
|
||||||
|
|
||||||
if(!gwt){
|
if(!gwt){
|
||||||
add(new MenuButton("text-exit", ()-> Gdx.app.exit()));
|
add(new MenuButton("text-exit", group, ()-> Gdx.app.exit()));
|
||||||
}
|
}
|
||||||
get().pad(Unit.dp.inPixels(16));
|
get().pad(Unit.dp.inPixels(16));
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class ProductionBlocks{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int handleDamage(Tile tile, int amount){
|
public int handleDamage(Tile tile, int amount){
|
||||||
return Vars.debug ? amount : amount;
|
return Vars.debug ? 0 : amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user