Many various campaign mechanic changes

This commit is contained in:
Anuken
2020-07-07 21:13:03 -04:00
parent b95206cf87
commit 26e70fa585
11 changed files with 220 additions and 31 deletions

View File

@@ -122,7 +122,11 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
//draw all sector stuff
for(Sector sec : planet.sectors){
if(selectAlpha > 0.01f){
if(canLaunch(sec) || sec.unlocked()){
if(/*canLaunch(sec) || sec.unlocked()*/true){
if(sec.baseCoverage > 0){
planets.fill(sec, Tmp.c1.set(Team.crux.color).a(0.1f * sec.baseCoverage * selectAlpha), -0.002f);
}
Color color =
sec.hasBase() ? Team.sharded.color :
sec.preset != null ? Team.derelict.color :
@@ -220,6 +224,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
@Override
public void draw(){
planets.render(PlanetDialog.this);
Core.scene.setScrollFocus(PlanetDialog.this);
}
},
new Table(t -> {
@@ -277,7 +282,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
selectAlpha = Mathf.lerpDelta(selectAlpha, Mathf.num(planets.zoom < 1.9f), 0.1f);
}
//TODO add strings to bundle after prototyping is done
//TODO localize
private void updateSelected(){
Sector sector = selected;
@@ -294,6 +299,13 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
stable.image().color(Pal.accent).fillX().height(3f).pad(3f).row();
stable.add(sector.save != null ? sector.save.getPlayTime() : "[lightgray]Unexplored").row();
if(sector.hasBase() && sector.hasWaves()){
stable.add("[scarlet]Under attack!");
stable.row();
stable.add("[accent]" + Mathf.ceil(sectorDestructionTurns - (sector.getSecondsPassed() * 60) / turnDuration) + " turn(s) until destruction");
stable.row();
}
stable.add("Resources:").row();
stable.table(t -> {
t.left();

View File

@@ -7,6 +7,7 @@ import arc.math.*;
import arc.scene.*;
import arc.scene.actions.*;
import arc.scene.event.*;
import arc.scene.style.*;
import arc.scene.ui.*;
import arc.scene.ui.ImageButton.*;
import arc.scene.ui.layout.*;
@@ -28,13 +29,14 @@ import mindustry.ui.dialogs.*;
import static mindustry.Vars.*;
public class HudFragment extends Fragment{
private static final float dsize = 47.2f;
public final PlacementFragment blockfrag = new PlacementFragment();
private ImageButton flip;
private Table lastUnlockTable;
private Table lastUnlockLayout;
private boolean shown = true;
private float dsize = 47.2f;
private CoreItemsDisplay coreItems = new CoreItemsDisplay();
private String hudText = "";
@@ -51,6 +53,11 @@ public class HudFragment extends Fragment{
showToast("Sector[accent] captured[]!");
});
//TODO localize
Events.on(SectorLoseEvent.class, e -> {
showToast(Icon.warning, "Sector " + e.sector.id + " [scarlet]lost!");
});
//TODO full implementation
Events.on(ResetEvent.class, e -> {
coreItems.resetUsed();
@@ -393,6 +400,10 @@ public class HudFragment extends Fragment{
}
public void showToast(String text){
showToast(Icon.ok, text);
}
public void showToast(Drawable icon, String text){
if(state.isMenu()) return;
scheduleToast(() -> {
@@ -405,7 +416,7 @@ public class HudFragment extends Fragment{
}
});
table.margin(12);
table.image(Icon.ok).pad(3);
table.image(icon).pad(3);
table.add(text).wrap().width(280f).get().setAlignment(Align.center, Align.center);
table.pack();