mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-20 19:42:20 -08:00
Added zone requirement display
This commit is contained in:
parent
a9d7ed50b7
commit
6bfbcc4aa9
7 changed files with 85 additions and 21 deletions
|
|
@ -22,9 +22,8 @@ stat.destroyed = Buildings Destroyed:[accent] {0}
|
|||
stat.deconstructed = Buildings Deconstructed:[accent] {0}
|
||||
stat.delivered = Resources Launched:
|
||||
|
||||
level.highscore = High Score: [accent]{0}
|
||||
level.delete.title = Confirm Delete
|
||||
map.delete = Are you sure you want to delete the map "[accent]{0}[]"?
|
||||
level.highscore = High Score: [accent]{0}
|
||||
level.select = Level Select
|
||||
level.mode = Gamemode:
|
||||
construction.desktop = To deselect a block or stop building, [accent]use space[].
|
||||
|
|
@ -238,7 +237,10 @@ tutorial = Tutorial
|
|||
editor = Editor
|
||||
mapeditor = Map Editor
|
||||
donate = Donate
|
||||
|
||||
complete = Complete:
|
||||
resume = Resume Zone:\n[LIGHT_GRAY]{0}
|
||||
bestwave = [LIGHT_GRAY]Best: {0}
|
||||
launch = Launch
|
||||
launch.title = Launch Successful
|
||||
|
||||
|
|
|
|||
|
|
@ -865,10 +865,10 @@ public class Blocks implements ContentList{
|
|||
duo = new DoubleTurret("duo"){{
|
||||
requirements(Category.turret, ItemStack.with(Items.copper, 60), true);
|
||||
ammo(
|
||||
Items.copper, Bullets.standardCopper,
|
||||
Items.graphite, Bullets.standardDense,
|
||||
Items.pyratite, Bullets.standardIncendiary,
|
||||
Items.silicon, Bullets.standardHoming
|
||||
Items.copper, Bullets.standardCopper,
|
||||
Items.graphite, Bullets.standardDense,
|
||||
Items.pyratite, Bullets.standardIncendiary,
|
||||
Items.silicon, Bullets.standardHoming
|
||||
);
|
||||
reload = 20f;
|
||||
restitution = 0.03f;
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ public class Bullets implements ContentList{
|
|||
bulletHeight = 9f;
|
||||
homingPower = 5f;
|
||||
reloadMultiplier = 1.4f;
|
||||
ammoMultiplier = 5;
|
||||
ammoMultiplier = 3;
|
||||
}};
|
||||
|
||||
standardIncendiary = new BasicBulletType(3.2f, 11, "bullet"){{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ import io.anuke.arc.entities.EntityQuery;
|
|||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.game.*;
|
||||
import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.game.*;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
|
|
@ -33,6 +33,12 @@ public class Logic implements ApplicationListener{
|
|||
handleContent(event.tile.block());
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(WaveEvent.class, event -> {
|
||||
if(world.isZone()){
|
||||
data.updateWaveScore(world.getZone(), state.wave);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import io.anuke.mindustry.game.EventType.UnlockEvent;
|
|||
import io.anuke.mindustry.type.ContentType;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
|
|
@ -26,6 +27,22 @@ public class GlobalData{
|
|||
Core.settings.setSerializer(Item.class, (stream, t) -> stream.writeUTF(t.name), stream -> content.getByName(ContentType.item, stream.readUTF()));
|
||||
}
|
||||
|
||||
public void updateWaveScore(Zone zone, int wave){
|
||||
int value = Core.settings.getInt(zone.name + "-wave", 0);
|
||||
if(value < wave){
|
||||
Core.settings.put(zone.name + "-wave", wave);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
public int getWaveScore(Zone zone){
|
||||
return Core.settings.getInt(zone.name + "-wave", 0);
|
||||
}
|
||||
|
||||
public boolean isCompleted(Zone zone){
|
||||
return getWaveScore(zone) >= zone.conditionWave;
|
||||
}
|
||||
|
||||
public void addItem(Item item, int amount){
|
||||
modified = true;
|
||||
items.getAndIncrement(item, 0, amount);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package io.anuke.mindustry.ui.dialogs;
|
|||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.collection.ObjectIntMap;
|
||||
import io.anuke.arc.scene.ui.ScrollPane;
|
||||
import io.anuke.arc.scene.ui.TextButton;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
|
|
@ -41,32 +42,70 @@ public class DeployDialog extends FloatingDialog{
|
|||
}
|
||||
}
|
||||
|
||||
}}, new Table(){{
|
||||
}}, new ScrollPane(new Table(){{
|
||||
|
||||
if(control.saves.getZoneSlot() == null){
|
||||
|
||||
int i = 0;
|
||||
for(Zone zone : content.zones()){
|
||||
table(t -> {
|
||||
TextButton button = t.addButton(zone.localizedName(), () -> {
|
||||
TextButton button = t.addButton(data.isUnlocked(zone) ? zone.localizedName() : "???", () -> {
|
||||
data.removeItems(zone.deployCost);
|
||||
hide();
|
||||
world.playZone(zone);
|
||||
}).size(150f).disabled(b -> !data.hasItems(zone.deployCost) || !data.isUnlocked(zone)).get();
|
||||
}).size(200f).disabled(!data.hasItems(zone.deployCost) || !data.isUnlocked(zone)).get();
|
||||
|
||||
button.row();
|
||||
button.table(req -> {
|
||||
for(ItemStack stack : zone.deployCost){
|
||||
req.addImage(stack.item.region).size(8 * 3);
|
||||
req.add(stack.amount + "").left();
|
||||
|
||||
if(data.getWaveScore(zone) > 0){
|
||||
button.add(Core.bundle.format("bestwave", data.getWaveScore(zone)));
|
||||
}
|
||||
|
||||
button.row();
|
||||
|
||||
if(data.isUnlocked(zone)){
|
||||
button.table(req -> {
|
||||
for(ItemStack stack : zone.deployCost){
|
||||
req.addImage(stack.item.region).size(8 * 3);
|
||||
req.add(stack.amount + "").left();
|
||||
}
|
||||
}).pad(3).growX();
|
||||
}else{
|
||||
boolean anyNeeded = false;
|
||||
for(Zone other : zone.zoneRequirements){
|
||||
if(!data.isCompleted(other)){
|
||||
anyNeeded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}).pad(3).growX();
|
||||
|
||||
if(anyNeeded){
|
||||
button.row();
|
||||
button.table(req -> {
|
||||
req.add("$complete").left();
|
||||
req.row();
|
||||
for(Zone other : zone.zoneRequirements){
|
||||
if(!data.isCompleted(other)){
|
||||
req.add("- [LIGHT_GRAY]" + other.localizedName()).left();
|
||||
req.row();
|
||||
}
|
||||
}
|
||||
|
||||
req.table(r -> {
|
||||
if(zone.itemRequirements.length > 0){
|
||||
for(ItemStack stack : zone.itemRequirements){
|
||||
r.addImage(stack.item.region).size(8 * 3);
|
||||
r.add(stack.amount + "").left();
|
||||
}
|
||||
}
|
||||
});
|
||||
}).pad(3).growX();
|
||||
}
|
||||
}
|
||||
|
||||
button.row();
|
||||
button.addImage("icon-zone-locked").visible(() -> !data.isUnlocked(zone));
|
||||
|
||||
button.update(() -> button.setText(data.isUnlocked(zone) ? zone.localizedName() : "???"));
|
||||
}).pad(3);
|
||||
}).pad(4);
|
||||
|
||||
if(++i % 4 == 0){
|
||||
row();
|
||||
|
|
@ -88,6 +127,6 @@ public class DeployDialog extends FloatingDialog{
|
|||
});
|
||||
}).size(200f);
|
||||
}
|
||||
}}).grow();
|
||||
}})).grow();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import java.io.DataOutput;
|
|||
import java.io.IOException;
|
||||
|
||||
public class ItemTurret extends CooledTurret{
|
||||
protected int maxAmmo = 50;
|
||||
protected int maxAmmo = 30;
|
||||
protected ObjectMap<Item, BulletType> ammo = new ObjectMap<>();
|
||||
|
||||
public ItemTurret(String name){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue