WIP campaign completion text

This commit is contained in:
Anuken 2022-10-29 19:25:37 -04:00
parent b3874b76e0
commit 3bdf0bdc1f
11 changed files with 54 additions and 7 deletions

View File

@ -2951,7 +2951,7 @@ public class Blocks{
}};
coreAcropolis = new CoreBlock("core-acropolis"){{
requirements(Category.effect, with(Items.beryllium, 8000, Items.silicon, 7000, Items.tungsten, 6000, Items.carbide, 5000, Items.oxide, 4000));
requirements(Category.effect, with(Items.beryllium, 6000, Items.silicon, 5000, Items.tungsten, 5000, Items.carbide, 3000, Items.oxide, 3000));
unitType = UnitTypes.emanate;
health = 30000;

View File

@ -56,8 +56,10 @@ public class ErekirTechTree{
var costMultipliers = new ObjectFloatMap<Item>();
//these are hard to make
costMultipliers.put(Items.oxide, 0.5f);
costMultipliers.put(Items.surgeAlloy, 0.8f);
costMultipliers.put(Items.carbide, 0.35f);
costMultipliers.put(Items.surgeAlloy, 0.7f);
costMultipliers.put(Items.carbide, 0.3f);
for(var item : content.items()) costMultipliers.put(item, 0.9f);
Planets.erekir.techTree = nodeRoot("erekir", coreBastion, true, () -> {
context().researchCostMultipliers = costMultipliers;

View File

@ -105,6 +105,7 @@ public class SectorPresets{
planetaryTerminal = new SectorPreset("planetaryTerminal", serpulo, 93){{
difficulty = 10;
isLastSector = true;
}};
//endregion
@ -183,6 +184,7 @@ public class SectorPresets{
origin = new SectorPreset("origin", erekir, 12){{
difficulty = 10;
isLastSector = true;
}};
//endregion

View File

@ -161,6 +161,10 @@ public class Control implements ApplicationListener, Loadable{
Events.on(SectorCaptureEvent.class, e -> {
app.post(this::checkAutoUnlocks);
if(e.sector.preset != null && e.sector.preset.isLastSector && e.initialCapture){
ui.campaignComplete.show(e.sector.planet);
}
});
//delete save on campaign game over

View File

@ -339,10 +339,12 @@ public class Logic implements ApplicationListener{
return;
}
boolean initial = !state.rules.sector.info.wasCaptured;
state.rules.sector.info.wasCaptured = true;
//fire capture event
Events.fire(new SectorCaptureEvent(state.rules.sector));
Events.fire(new SectorCaptureEvent(state.rules.sector, initial));
//disable attack mode
state.rules.attackMode = false;

View File

@ -73,6 +73,7 @@ public class UI implements ApplicationListener, Loadable{
public ColorPicker picker;
public LogicDialog logic;
public FullTextDialog fullText;
public CampaignCompleteDialog campaignComplete;
public Cursor drillCursor, unloadCursor, targetCursor;
@ -199,6 +200,7 @@ public class UI implements ApplicationListener, Loadable{
schematics = new SchematicsDialog();
logic = new LogicDialog();
fullText = new FullTextDialog();
campaignComplete = new CampaignCompleteDialog();
Group group = Core.scene.root;

View File

@ -195,9 +195,11 @@ public class EventType{
/** Called when a sector is conquered, e.g. a boss or base is defeated. */
public static class SectorCaptureEvent{
public final Sector sector;
public final boolean initialCapture;
public SectorCaptureEvent(Sector sector){
public SectorCaptureEvent(Sector sector, boolean initialCapture){
this.sector = sector;
this.initialCapture = initialCapture;
}
}

View File

@ -18,6 +18,8 @@ public class SectorPreset extends UnlockableContent{
public float startWaveTimeMultiplier = 2f;
public boolean addStartingItems = false;
public boolean noLighting = false;
/** If true, this is the last sector in its planetary campaign. */
public boolean isLastSector;
public boolean showSectorLandInfo = true;
/** If true, uses this sector's launch fields instead */
public boolean overrideLaunchDefaults = false;

View File

@ -12,6 +12,7 @@ import static mindustry.Vars.*;
public class BaseDialog extends Dialog{
protected boolean wasPaused;
/** If true, this dialog will pause the game while open. */
protected boolean shouldPause;
public BaseDialog(String title, DialogStyle style){

View File

@ -0,0 +1,29 @@
package mindustry.ui.dialogs;
import mindustry.*;
import mindustry.gen.*;
import mindustry.type.*;
public class CampaignCompleteDialog extends BaseDialog{
public CampaignCompleteDialog(){
super("");
addCloseListener();
shouldPause = true;
buttons.defaults().size(210f, 64f);
buttons.button("@menu", Icon.left, () -> Vars.ui.paused.runExitSave());
buttons.button("@continue", Icon.left, this::hide);
}
public void show(Planet planet){
//TODO obviously needs different text.
cont.clear();
cont.add("[accent]Congrations. You done it.[]\n\nThe enemy on " + planet.localizedName + " has been defeated.");
show();
}
}

View File

@ -100,8 +100,6 @@ public class PausedDialog extends BaseDialog{
void showQuitConfirm(){
Runnable quit = () -> {
wasClient = net.client();
if(net.client()) netClient.disconnectQuietly();
runExitSave();
hide();
};
@ -125,6 +123,9 @@ public class PausedDialog extends BaseDialog{
}
public void runExitSave(){
wasClient = net.client();
if(net.client()) netClient.disconnectQuietly();
if(state.isEditor() && !wasClient){
ui.editor.resumeEditing();
return;