something may have been fixed
This commit is contained in:
@@ -266,7 +266,7 @@ public class UnitTypes implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
lich = new UnitType("lich", Revenant.class, Revenant::new){{
|
lich = new UnitType("lich", Revenant.class, Revenant::new){{
|
||||||
health = 6000;
|
health = 7000;
|
||||||
mass = 20f;
|
mass = 20f;
|
||||||
hitsize = 40f;
|
hitsize = 40f;
|
||||||
speed = 0.01f;
|
speed = 0.01f;
|
||||||
@@ -285,7 +285,7 @@ public class UnitTypes implements ContentList{
|
|||||||
length = 4f;
|
length = 4f;
|
||||||
reload = 180f;
|
reload = 180f;
|
||||||
width = 22f;
|
width = 22f;
|
||||||
shots = 20;
|
shots = 22;
|
||||||
shotDelay = 2;
|
shotDelay = 2;
|
||||||
inaccuracy = 10f;
|
inaccuracy = 10f;
|
||||||
roundrobin = true;
|
roundrobin = true;
|
||||||
@@ -297,7 +297,7 @@ public class UnitTypes implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
reaper = new UnitType("reaper", Revenant.class, Revenant::new){{
|
reaper = new UnitType("reaper", Revenant.class, Revenant::new){{
|
||||||
health = 12000;
|
health = 13000;
|
||||||
mass = 30f;
|
mass = 30f;
|
||||||
hitsize = 56f;
|
hitsize = 56f;
|
||||||
speed = 0.01f;
|
speed = 0.01f;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.type;
|
|||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.Core;
|
||||||
import io.anuke.arc.Events;
|
import io.anuke.arc.Events;
|
||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.Array;
|
||||||
|
import io.anuke.arc.function.Consumer;
|
||||||
import io.anuke.arc.function.Supplier;
|
import io.anuke.arc.function.Supplier;
|
||||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
@@ -99,22 +100,21 @@ public class Zone extends UnlockableContent{
|
|||||||
public void updateLaunchCost(){
|
public void updateLaunchCost(){
|
||||||
Array<ItemStack> stacks = new Array<>();
|
Array<ItemStack> stacks = new Array<>();
|
||||||
|
|
||||||
//TODO optimize
|
Consumer<ItemStack> adder = stack -> {
|
||||||
for(ItemStack stack : baseLaunchCost){
|
for(ItemStack other : stacks){
|
||||||
ItemStack out = new ItemStack(stack.item, stack.amount);
|
if(other.item == stack.item){
|
||||||
for(ItemStack other : startingItems){
|
other.amount += stack.amount;
|
||||||
if(other.item == out.item){
|
return;
|
||||||
out.amount += other.amount;
|
|
||||||
out.amount = Math.max(out.amount, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stacks.add(out);
|
stacks.add(new ItemStack(stack.item, stack.amount));
|
||||||
}
|
};
|
||||||
|
|
||||||
for(ItemStack other : startingItems){
|
for(ItemStack stack : baseLaunchCost) adder.accept(stack);
|
||||||
if(stacks.find(s -> s.item == other.item) == null){
|
for(ItemStack stack : startingItems) adder.accept(stack);
|
||||||
stacks.add(other);
|
|
||||||
}
|
for(ItemStack stack : stacks){
|
||||||
|
if(stack.amount < 0) stack.amount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
stacks.sort();
|
stacks.sort();
|
||||||
|
|||||||
@@ -195,7 +195,6 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
graphics.checkPref("fps", false);
|
graphics.checkPref("fps", false);
|
||||||
graphics.checkPref("indicators", true);
|
graphics.checkPref("indicators", true);
|
||||||
graphics.checkPref("lasers", true);
|
graphics.checkPref("lasers", true);
|
||||||
graphics.checkPref("minimap", !mobile); //minimap is disabled by default on mobile devices
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void back(){
|
private void back(){
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
|||||||
t.add(!zone.canConfigure() ? Core.bundle.format("configure.locked", zone.configureWave) : "$configure").growX().wrap();
|
t.add(!zone.canConfigure() ? Core.bundle.format("configure.locked", zone.configureWave) : "$configure").growX().wrap();
|
||||||
if(zone.canConfigure()){
|
if(zone.canConfigure()){
|
||||||
t.row();
|
t.row();
|
||||||
t.add(load).pad(2).growX().left();
|
t.pane(load).pad(2).growX().left();
|
||||||
}
|
}
|
||||||
}).width(300f).pad(4).left();
|
}).width(300f).pad(4).left();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import io.anuke.arc.scene.ui.ImageButton;
|
|||||||
import io.anuke.arc.scene.ui.TextButton;
|
import io.anuke.arc.scene.ui.TextButton;
|
||||||
import io.anuke.arc.scene.ui.layout.Stack;
|
import io.anuke.arc.scene.ui.layout.Stack;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
|
||||||
import io.anuke.arc.scene.utils.Elements;
|
import io.anuke.arc.scene.utils.Elements;
|
||||||
import io.anuke.arc.util.Align;
|
import io.anuke.arc.util.Align;
|
||||||
import io.anuke.arc.util.Scaling;
|
import io.anuke.arc.util.Scaling;
|
||||||
@@ -37,9 +36,7 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
public class HudFragment extends Fragment{
|
public class HudFragment extends Fragment{
|
||||||
public final PlacementFragment blockfrag = new PlacementFragment();
|
public final PlacementFragment blockfrag = new PlacementFragment();
|
||||||
|
|
||||||
private ImageButton menu, flip;
|
private ImageButton flip;
|
||||||
private Stack wavetable;
|
|
||||||
private Table infolabel;
|
|
||||||
private Table lastUnlockTable;
|
private Table lastUnlockTable;
|
||||||
private Table lastUnlockLayout;
|
private Table lastUnlockLayout;
|
||||||
private boolean shown = true;
|
private boolean shown = true;
|
||||||
@@ -61,7 +58,7 @@ public class HudFragment extends Fragment{
|
|||||||
select.left();
|
select.left();
|
||||||
select.defaults().size(dsize).left();
|
select.defaults().size(dsize).left();
|
||||||
|
|
||||||
menu = select.addImageButton("icon-menu", "clear", isize, ui.paused::show).get();
|
ImageButton menu = select.addImageButton("icon-menu", "clear", isize, ui.paused::show).get();
|
||||||
flip = select.addImageButton("icon-arrow-up", "clear", isize, this::toggleMenus).get();
|
flip = select.addImageButton("icon-arrow-up", "clear", isize, this::toggleMenus).get();
|
||||||
|
|
||||||
select.addImageButton("icon-pause", "clear", isize, () -> {
|
select.addImageButton("icon-pause", "clear", isize, () -> {
|
||||||
@@ -113,53 +110,35 @@ public class HudFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Stack stack = new Stack();
|
cont.table(stuff -> {
|
||||||
TextButton waves = new TextButton("", "wave");
|
stuff.left();
|
||||||
Table btable = new Table().margin(0);
|
Stack stack = new Stack();
|
||||||
|
TextButton waves = new TextButton("", "wave");
|
||||||
|
Table btable = new Table().margin(0);
|
||||||
|
|
||||||
stack.add(waves);
|
stack.add(waves);
|
||||||
stack.add(btable);
|
stack.add(btable);
|
||||||
|
|
||||||
wavetable = stack;
|
addWaveTable(waves);
|
||||||
|
addPlayButton(btable);
|
||||||
addWaveTable(waves);
|
stuff.add(stack).width(dsize * 4 + 6f);
|
||||||
addPlayButton(btable);
|
stuff.row();
|
||||||
cont.add(stack).width(dsize * 4 + 6f);
|
stuff.table("button", t -> t.margin(10f).add(new Bar("boss.health", Pal.health, () -> state.boss() == null ? 0f : state.boss().healthf()).blink(Color.WHITE))
|
||||||
|
.grow()).fillX().visible(() -> world.isZone() && state.boss() != null).height(60f).get();
|
||||||
cont.row();
|
stuff.row();
|
||||||
|
}).visible(() -> shown);
|
||||||
Table healthTable = cont.table("button", t ->
|
|
||||||
t.margin(10f).add(new Bar("boss.health", Pal.health, () -> state.boss() == null ? 0f : state.boss().healthf()).blink(Color.WHITE)).grow()
|
|
||||||
).fillX().visible(() -> world.isZone() && state.boss() != null).height(60f).update(t -> t.getTranslation().set(0, Unit.dp.scl(wavetable.getTranslation().y))).get();
|
|
||||||
|
|
||||||
cont.row();
|
|
||||||
|
|
||||||
//fps display
|
|
||||||
infolabel = new Table();
|
|
||||||
infolabel.marginLeft(10f);
|
|
||||||
IntFormat fps = new IntFormat("fps");
|
|
||||||
IntFormat ping = new IntFormat("ping");
|
|
||||||
infolabel.label(() -> fps.get(Core.graphics.getFramesPerSecond())).padLeft(10).growX();
|
|
||||||
infolabel.row();
|
|
||||||
if(Net.hasClient()){
|
|
||||||
infolabel.label(() -> ping.get(Net.getPing())).visible(Net::client).colspan(2);
|
|
||||||
}
|
|
||||||
infolabel.visible(() -> Core.settings.getBool("fps")).update(() ->
|
|
||||||
infolabel.setPosition(0,
|
|
||||||
healthTable.isVisible() ? healthTable.getY() + healthTable.getTranslation().y : waves.isVisible() ? Math.min(wavetable.getY(), Core.graphics.getHeight()) : Core.graphics.getHeight(),
|
|
||||||
Align.topLeft));
|
|
||||||
|
|
||||||
infolabel.pack();
|
|
||||||
cont.addChild(infolabel);
|
|
||||||
|
|
||||||
//make wave box appear below rest of menu
|
|
||||||
if(mobile){
|
|
||||||
cont.swapActor(wavetable, menu.getParent());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//minimap
|
|
||||||
//parent.fill(t -> t.top().right().add(new Minimap()).visible(() -> !state.is(State.menu) && Core.settings.getBool("minimap")));
|
//fps display
|
||||||
|
parent.fill(info -> {
|
||||||
|
info.top().right().margin(4).visible(() -> Core.settings.getBool("fps"));
|
||||||
|
IntFormat fps = new IntFormat("fps");
|
||||||
|
IntFormat ping = new IntFormat("ping");
|
||||||
|
info.label(() -> fps.get(Core.graphics.getFramesPerSecond())).right();
|
||||||
|
info.row();
|
||||||
|
info.label(() -> ping.get(Net.getPing())).visible(Net::client).right();
|
||||||
|
});
|
||||||
|
|
||||||
//spawner warning
|
//spawner warning
|
||||||
parent.fill(t -> {
|
parent.fill(t -> {
|
||||||
@@ -300,6 +279,10 @@ public class HudFragment extends Fragment{
|
|||||||
Actions.run(() -> container.actions(Actions.translateBy(0, table.getPrefHeight(), 1f, Interpolation.fade), Actions.removeActor())));
|
Actions.run(() -> container.actions(Actions.translateBy(0, table.getPrefHeight(), 1f, Interpolation.fade), Actions.removeActor())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shown(){
|
||||||
|
return shown;
|
||||||
|
}
|
||||||
|
|
||||||
/** Show unlock notification for a new recipe. */
|
/** Show unlock notification for a new recipe. */
|
||||||
public void showUnlock(UnlockableContent content){
|
public void showUnlock(UnlockableContent content){
|
||||||
//some content may not have icons... yet
|
//some content may not have icons... yet
|
||||||
@@ -399,27 +382,11 @@ public class HudFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void toggleMenus(){
|
private void toggleMenus(){
|
||||||
wavetable.clearActions();
|
|
||||||
infolabel.clearActions();
|
|
||||||
|
|
||||||
float dur = 0.3f;
|
|
||||||
Interpolation in = Interpolation.pow3Out;
|
|
||||||
|
|
||||||
if(flip != null){
|
if(flip != null){
|
||||||
flip.getStyle().imageUp = Core.scene.skin.getDrawable(shown ? "icon-arrow-down" : "icon-arrow-up");
|
flip.getStyle().imageUp = Core.scene.skin.getDrawable(shown ? "icon-arrow-down" : "icon-arrow-up");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(shown){
|
shown = !shown;
|
||||||
shown = false;
|
|
||||||
blockfrag.toggle(dur, in);
|
|
||||||
wavetable.actions(Actions.translateBy(0, (wavetable.getHeight() + Unit.dp.scl(dsize) + Unit.dp.scl(6)) - wavetable.getTranslation().y, dur, in));
|
|
||||||
infolabel.actions(Actions.translateBy(0, (wavetable.getHeight()) - wavetable.getTranslation().y, dur, in));
|
|
||||||
}else{
|
|
||||||
shown = true;
|
|
||||||
blockfrag.toggle(dur, in);
|
|
||||||
wavetable.actions(Actions.translateBy(0, -wavetable.getTranslation().y, dur, in));
|
|
||||||
infolabel.actions(Actions.translateBy(0, -infolabel.getTranslation().y, dur, in));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addWaveTable(TextButton table){
|
private void addWaveTable(TextButton table){
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ import io.anuke.arc.Events;
|
|||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.Array;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.Color;
|
||||||
import io.anuke.arc.input.KeyCode;
|
import io.anuke.arc.input.KeyCode;
|
||||||
import io.anuke.arc.math.Interpolation;
|
|
||||||
import io.anuke.arc.math.geom.Vector2;
|
import io.anuke.arc.math.geom.Vector2;
|
||||||
import io.anuke.arc.scene.Group;
|
import io.anuke.arc.scene.Group;
|
||||||
import io.anuke.arc.scene.actions.Actions;
|
|
||||||
import io.anuke.arc.scene.event.Touchable;
|
import io.anuke.arc.scene.event.Touchable;
|
||||||
import io.anuke.arc.scene.style.TextureRegionDrawable;
|
import io.anuke.arc.scene.style.TextureRegionDrawable;
|
||||||
import io.anuke.arc.scene.ui.ButtonGroup;
|
import io.anuke.arc.scene.ui.ButtonGroup;
|
||||||
@@ -43,7 +41,6 @@ public class PlacementFragment extends Fragment{
|
|||||||
Tile lastHover;
|
Tile lastHover;
|
||||||
Tile hoverTile;
|
Tile hoverTile;
|
||||||
Table blockTable, toggler, topTable;
|
Table blockTable, toggler, topTable;
|
||||||
boolean shown = true;
|
|
||||||
boolean lastGround;
|
boolean lastGround;
|
||||||
|
|
||||||
//TODO make this configurable
|
//TODO make this configurable
|
||||||
@@ -123,7 +120,7 @@ public class PlacementFragment extends Fragment{
|
|||||||
public void build(Group parent){
|
public void build(Group parent){
|
||||||
parent.fill(full -> {
|
parent.fill(full -> {
|
||||||
toggler = full;
|
toggler = full;
|
||||||
full.bottom().right().visible(() -> !state.is(State.menu));
|
full.bottom().right().visible(() -> !state.is(State.menu) && ui.hudfrag.shown());
|
||||||
|
|
||||||
full.table(frame -> {
|
full.table(frame -> {
|
||||||
InputHandler input = control.input(0);
|
InputHandler input = control.input(0);
|
||||||
@@ -345,16 +342,4 @@ public class PlacementFragment extends Fragment{
|
|||||||
Block tileDisplayBlock(){
|
Block tileDisplayBlock(){
|
||||||
return hoverTile == null ? null : hoverTile.block().synthetic() ? hoverTile.block() : hoverTile.floor() instanceof OreBlock ? hoverTile.floor() : null;
|
return hoverTile == null ? null : hoverTile.block().synthetic() ? hoverTile.block() : hoverTile.floor() instanceof OreBlock ? hoverTile.floor() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Show or hide the placement menu. */
|
|
||||||
void toggle(float t, Interpolation ip){
|
|
||||||
toggler.clearActions();
|
|
||||||
if(shown){
|
|
||||||
shown = false;
|
|
||||||
toggler.actions(Actions.translateBy(toggler.getTranslation().x + toggler.getWidth(), 0, t, ip));
|
|
||||||
}else{
|
|
||||||
shown = true;
|
|
||||||
toggler.actions(Actions.translateBy(-toggler.getTranslation().x, 0, t, ip));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user