Upgradeable cores

This commit is contained in:
Anuken
2020-06-27 19:16:39 -04:00
parent 313cadb763
commit 80332e37d5
63 changed files with 365 additions and 290 deletions

View File

@@ -4,6 +4,7 @@ import arc.*;
import arc.graphics.*;
import arc.graphics.Texture.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.scene.style.*;
import arc.scene.ui.*;
import arc.scene.ui.ImageButton.*;
@@ -348,6 +349,26 @@ public class SchematicsDialog extends BaseDialog{
}
}
});
cont.row();
float cons = schem.powerConsumption(), prod = schem.powerProduction();
if(!Mathf.zero(cons) || !Mathf.zero(prod)){
cont.table(t -> {
if(!Mathf.zero(prod)){
t.image(Icon.powerSmall).color(Pal.powerLight).padRight(3);
t.add("+" + Strings.autoFixed(prod, 2)).color(Pal.powerLight).left();
if(!Mathf.zero(cons)){
t.add().width(15);
}
}
if(!Mathf.zero(cons)){
t.image(Icon.powerSmall).color(Pal.remove).padRight(3);
t.add("-" + Strings.autoFixed(cons, 2)).color(Pal.remove).left();
}
});
}
show();
}

View File

@@ -238,7 +238,6 @@ public class SettingsMenuDialog extends SettingsDialog{
game.checkPref("savecreate", true);
game.checkPref("blockreplace", true);
game.checkPref("conveyorpathfinding", true);
game.checkPref("coreselect", false);
game.checkPref("hints", true);
if(!mobile){
game.checkPref("buildautopause", false);

View File

@@ -68,10 +68,7 @@ public class HudFragment extends Fragment{
cont.top().left();
if(mobile){
{
Table select = new Table();
cont.table(select -> {
select.left();
select.defaults().size(dsize).left();
@@ -118,28 +115,7 @@ public class HudFragment extends Fragment{
});
select.image().color(Pal.gray).width(4f).fillY();
float size = Scl.scl(dsize);
Seq<Element> children = new Seq<>(select.getChildren());
//now, you may be wondering, why is this necessary? the answer is, I don't know, but it fixes layout issues somehow
int index = 0;
for(Element elem : children){
int fi = index++;
parent.addChild(elem);
elem.visible(() -> {
if(fi < 5){
elem.setSize(size);
}else{
elem.setSize(Scl.scl(4f), size);
}
elem.setPosition(fi * size, Core.graphics.getHeight(), Align.topLeft);
return true;
});
}
cont.add().size(dsize * 5 + 3, dsize).left();
}
});
cont.row();
cont.image().height(4f).color(Pal.gray).fillX();
@@ -363,10 +339,8 @@ public class HudFragment extends Fragment{
parent.fill(t -> {
t.bottom().visible(() -> state.isCampaign() && player.team().core() != null);
t.button("test launch", Icon.warning, () -> {
ui.planet.show(state.getSector(), player.team().core());
}).width(150f)
.disabled(b -> player.team().core() == null || !player.team().core().items.has(player.team().core().block.requirements)); //disable core when missing resources for launch
t.button("test launch", Icon.warning, () -> ui.planet.show(state.getSector(), player.team().core()))
.width(150f).disabled(b -> player.team().core() == null || !player.team().core().items.has(player.team().core().block.requirements)); //disable core when missing resources for launch
});
blockfrag.build(parent);

View File

@@ -450,9 +450,9 @@ public class PlacementFragment extends Fragment{
Tile hoverTile = world.tileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
if(hoverTile != null){
//if the tile has an entity, display it
if(hoverTile.entity != null){
hoverTile.entity.updateFlow(true);
return hoverTile.entity;
if(hoverTile.build != null){
hoverTile.build.updateFlow(true);
return hoverTile.build;
}
//if the tile has a drop, display the drop