Tweaked sector dialog / Item icons fixed / Bugfixes
This commit is contained in:
@@ -445,11 +445,10 @@ public class Blocks implements ContentList{
|
||||
results = new ItemStack[]{
|
||||
new ItemStack(Items.copper, 5),
|
||||
new ItemStack(Items.lead, 3),
|
||||
new ItemStack(Items.titanium, 2),
|
||||
new ItemStack(Items.thorium, 1)
|
||||
new ItemStack(Items.titanium, 2)
|
||||
};
|
||||
hasPower = true;
|
||||
filterTime = 15f;
|
||||
filterTime = 30f;
|
||||
health = 50 * 4;
|
||||
spinnerLength = 1.5f;
|
||||
spinnerRadius = 3.5f;
|
||||
@@ -457,6 +456,7 @@ public class Blocks implements ContentList{
|
||||
spinnerSpeed = 3f;
|
||||
size = 2;
|
||||
|
||||
consumes.power(1f);
|
||||
consumes.liquid(Liquids.slag, 0.1f);
|
||||
}};
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import io.anuke.mindustry.game.ContentList;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.graphics.Shapes;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.Item.Icon;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
@@ -541,7 +542,7 @@ public class Fx implements ContentList{
|
||||
float length = 20f * e.finpow();
|
||||
float size = 7f * e.fout();
|
||||
|
||||
Draw.rect(((Item) e.data).region, e.x + Angles.trnsx(e.rotation, length), e.y + Angles.trnsy(e.rotation, length), size, size);
|
||||
Draw.rect(((Item) e.data).icon(Icon.large), e.x + Angles.trnsx(e.rotation, length), e.y + Angles.trnsy(e.rotation, length), size, size);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Items implements ContentList{
|
||||
genOre = true;
|
||||
}};
|
||||
|
||||
metaglass = new Item("metaglass", Color.valueOf("648b55")){{
|
||||
metaglass = new Item("metaglass", Color.valueOf("ebeef5")){{
|
||||
type = ItemType.material;
|
||||
cost = 2f;
|
||||
}};
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.anuke.mindustry.game.Rules;
|
||||
import io.anuke.mindustry.game.SpawnGroup;
|
||||
import io.anuke.mindustry.maps.generators.MapGenerator;
|
||||
import io.anuke.mindustry.maps.generators.MapGenerator.Decoration;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
@@ -23,6 +24,7 @@ public class Zones implements ContentList{
|
||||
alwaysUnlocked = true;
|
||||
conditionWave = 10;
|
||||
launchPeriod = 5;
|
||||
resources = new Item[]{Items.copper, Items.scrap};
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
waveTimer = true;
|
||||
@@ -67,6 +69,7 @@ public class Zones implements ContentList{
|
||||
itemRequirements = ItemStack.with(Items.copper, 2000);
|
||||
zoneRequirements = new Zone[]{groundZero};
|
||||
blockRequirements = new Block[]{Blocks.router};
|
||||
resources = new Item[]{Items.copper, Items.lead};
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
waveTimer = true;
|
||||
@@ -116,6 +119,7 @@ public class Zones implements ContentList{
|
||||
conditionWave = 10;
|
||||
zoneRequirements = new Zone[]{craters};
|
||||
itemRequirements = ItemStack.with(Items.copper, 4000, Items.lead, 2000);
|
||||
resources = new Item[]{Items.copper, Items.lead, Items.coal};
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
waveTimer = true;
|
||||
@@ -178,6 +182,7 @@ public class Zones implements ContentList{
|
||||
zoneRequirements = new Zone[]{frozenForest};
|
||||
itemRequirements = ItemStack.with(Items.lead, 6000, Items.graphite, 2000);
|
||||
blockRequirements = new Block[]{Blocks.graphitePress, Blocks.combustionGenerator};
|
||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand};
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
waveTimer = true;
|
||||
@@ -253,6 +258,7 @@ public class Zones implements ContentList{
|
||||
zoneRequirements = new Zone[]{frozenForest};
|
||||
blockRequirements = new Block[]{Blocks.pneumaticDrill};
|
||||
itemRequirements = ItemStack.with(Items.copper, 8000, Items.silicon, 2000);
|
||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium};
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
waveTimer = true;
|
||||
@@ -326,6 +332,7 @@ public class Zones implements ContentList{
|
||||
conditionWave = 20;
|
||||
zoneRequirements = new Zone[]{stainedMountains};
|
||||
blockRequirements = new Block[]{Blocks.launchPad, Blocks.unloader, Blocks.coreFoundation};
|
||||
resources = new Item[]{Items.scrap};
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
waveTimer = true;
|
||||
@@ -398,6 +405,7 @@ public class Zones implements ContentList{
|
||||
launchPeriod = 20;
|
||||
zoneRequirements = new Zone[]{ruinousShores};
|
||||
blockRequirements = new Block[]{Blocks.thermalGenerator};
|
||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium};
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
waveTimer = true;
|
||||
@@ -492,6 +500,7 @@ public class Zones implements ContentList{
|
||||
launchPeriod = 15;
|
||||
zoneRequirements = new Zone[]{impact};
|
||||
blockRequirements = new Block[]{Blocks.blastDrill, Blocks.thermalGenerator};
|
||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.thorium};
|
||||
rules = () -> new Rules(){{
|
||||
waves = true;
|
||||
waveTimer = true;
|
||||
|
||||
@@ -167,6 +167,10 @@ public class Control implements ApplicationListener{
|
||||
state.stats.enemyUnitsDestroyed ++;
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(ZoneCompleteEvent.class, e -> {
|
||||
ui.hudfrag.showToast(Core.bundle.get("zone.complete"));
|
||||
});
|
||||
}
|
||||
|
||||
public void addPlayer(int index){
|
||||
|
||||
@@ -22,10 +22,7 @@ import io.anuke.mindustry.entities.units.UnitState;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.type.ContentType;
|
||||
import io.anuke.mindustry.type.StatusEffect;
|
||||
import io.anuke.mindustry.type.UnitType;
|
||||
import io.anuke.mindustry.type.Weapon;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.meta.BlockFlag;
|
||||
|
||||
@@ -151,14 +148,14 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
}
|
||||
|
||||
protected void drawItems(){
|
||||
float backTrns = 4f, itemSize = 5f;
|
||||
float backTrns = 4f;
|
||||
if(item.amount > 0){
|
||||
int stored = Mathf.clamp(item.amount / 6, 1, 8);
|
||||
|
||||
for(int i = 0; i < stored; i++){
|
||||
float angT = i == 0 ? 0 : Mathf.randomSeedRange(i + 2, 60f);
|
||||
float lenT = i == 0 ? 0 : Mathf.randomSeedRange(i + 3, 1f) - 1f;
|
||||
Draw.rect(item.item.region,
|
||||
Draw.rect(item.item.icon(Item.Icon.large),
|
||||
x + Angles.trnsx(rotation + 180f + angT, backTrns + lenT),
|
||||
y + Angles.trnsy(rotation + 180f + angT, backTrns + lenT),
|
||||
itemSize, itemSize, rotation);
|
||||
|
||||
@@ -334,7 +334,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
rotation - 90);
|
||||
}
|
||||
|
||||
float backTrns = 4f, itemSize = 5f;
|
||||
float backTrns = 4f;
|
||||
if(item.amount > 0){
|
||||
ItemStack stack = item;
|
||||
int stored = Mathf.clamp(stack.amount / 6, 1, 8);
|
||||
@@ -342,7 +342,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
for(int i = 0; i < stored; i++){
|
||||
float angT = i == 0 ? 0 : Mathf.randomSeedRange(i + 1, 60f);
|
||||
float lenT = i == 0 ? 0 : Mathf.randomSeedRange(i + 2, 1f) - 1f;
|
||||
Draw.rect(stack.item.region,
|
||||
Draw.rect(stack.item.icon(Item.Icon.large),
|
||||
x + Angles.trnsx(rotation + 180f + angT, backTrns + lenT),
|
||||
y + Angles.trnsy(rotation + 180f + angT, backTrns + lenT),
|
||||
itemSize, itemSize, rotation);
|
||||
|
||||
@@ -4,12 +4,18 @@ import io.anuke.arc.Events.Event;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.type.Unit;
|
||||
import io.anuke.mindustry.entities.traits.BuilderTrait;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
public class EventType{
|
||||
|
||||
public static class SectorCompleteEvent implements Event{
|
||||
/**Called when a zone's requirements are met.*/
|
||||
public static class ZoneCompleteEvent implements Event{
|
||||
public final Zone zone;
|
||||
|
||||
public ZoneCompleteEvent(Zone zone){
|
||||
this.zone = zone;
|
||||
}
|
||||
}
|
||||
|
||||
/**Called when the game is first loaded.*/
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.game.EventType.UnlockEvent;
|
||||
import io.anuke.mindustry.game.EventType.ZoneCompleteEvent;
|
||||
import io.anuke.mindustry.type.ContentType;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
@@ -31,6 +32,9 @@ public class GlobalData{
|
||||
if(value < wave){
|
||||
Core.settings.put(zone.name + "-wave", wave);
|
||||
modified = true;
|
||||
if(wave > zone.conditionWave){
|
||||
Events.fire(new ZoneCompleteEvent(zone));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
5
core/src/io/anuke/mindustry/game/Rank.java
Normal file
5
core/src/io/anuke/mindustry/game/Rank.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
public enum Rank{
|
||||
SS, S, A, B, C, D, F
|
||||
}
|
||||
@@ -20,4 +20,8 @@ public class Stats{
|
||||
public int buildingsDeconstructed;
|
||||
/**Friendly buildings destroyed.*/
|
||||
public int buildingsDestroyed;
|
||||
|
||||
public Rank calculateRank(boolean launched){
|
||||
return Rank.F;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import io.anuke.mindustry.content.Blocks;
|
||||
import io.anuke.mindustry.entities.type.Player;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
@@ -98,7 +99,7 @@ public class OverlayRenderer{
|
||||
if(input.isDroppingItem()){
|
||||
Vector2 v = Core.input.mouseWorld(input.getMouseX(), input.getMouseY());
|
||||
float size = 8;
|
||||
Draw.rect(player.item().item.region, v.x, v.y, size, size);
|
||||
Draw.rect(player.item().item.icon(Item.Icon.large), v.x, v.y, size, size);
|
||||
Draw.color(Pal.accent);
|
||||
Lines.circle(v.x, v.y, 6 + Mathf.absin(Time.time(), 5f, 1f));
|
||||
Draw.reset();
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Item extends UnlockableContent implements Comparable<Item>{
|
||||
public final String name;
|
||||
public final String description;
|
||||
public final Color color;
|
||||
public TextureRegion region;
|
||||
private TextureRegion[] regions;
|
||||
|
||||
/**type of the item; used for tabs and core acceptance. default value is {@link ItemType#resource}.*/
|
||||
public ItemType type = ItemType.resource;
|
||||
@@ -52,7 +52,15 @@ public class Item extends UnlockableContent implements Comparable<Item>{
|
||||
}
|
||||
|
||||
public void load(){
|
||||
this.region = Core.atlas.find("item-" + name);
|
||||
regions = new TextureRegion[Icon.values().length];
|
||||
for(int i = 0; i < regions.length; i++){
|
||||
Icon icon = Icon.values()[i];
|
||||
regions[i] = Core.atlas.find(icon == Icon.large ? "item-" + name : "item-" + name + "-" + icon.name());
|
||||
}
|
||||
}
|
||||
|
||||
public TextureRegion icon(Icon icon){
|
||||
return regions[icon.ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,7 +80,7 @@ public class Item extends UnlockableContent implements Comparable<Item>{
|
||||
|
||||
@Override
|
||||
public TextureRegion getContentIcon(){
|
||||
return region;
|
||||
return icon(Icon.large);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,6 +103,18 @@ public class Item extends UnlockableContent implements Comparable<Item>{
|
||||
return ContentType.item;
|
||||
}
|
||||
|
||||
public enum Icon{
|
||||
small(8*2),
|
||||
medium(8*3),
|
||||
large(8*4);
|
||||
|
||||
public final int size;
|
||||
|
||||
Icon(int size){
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
|
||||
/**Allocates a new array containing all items the generate ores.*/
|
||||
public static Array<Item> getAllOres(){
|
||||
return Vars.content.items().select(i -> i.genOre);
|
||||
|
||||
@@ -20,6 +20,7 @@ public class Zone extends UnlockableContent{
|
||||
public Block[] blockRequirements = {};
|
||||
public ItemStack[] itemRequirements = {};
|
||||
public Zone[] zoneRequirements = {};
|
||||
public Item[] resources = {};
|
||||
public Supplier<Rules> rules = Rules::new;
|
||||
public boolean alwaysUnlocked;
|
||||
public int conditionWave = Integer.MAX_VALUE;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.type.Item.Icon;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.arc.function.Supplier;
|
||||
import io.anuke.arc.scene.ui.Image;
|
||||
@@ -18,7 +19,7 @@ public class ItemImage extends Stack{
|
||||
}
|
||||
|
||||
public ItemImage(ItemStack stack){
|
||||
add(new Image(stack.item.region));
|
||||
add(new Image(stack.item.icon(Icon.large)));
|
||||
|
||||
if(stack.amount != 0){
|
||||
Table t = new Table().left().bottom();
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.anuke.arc.collection.ObjectIntMap;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.Item.Icon;
|
||||
import io.anuke.mindustry.type.ItemType;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
@@ -30,7 +31,7 @@ public class ItemsDisplay extends Table{
|
||||
for(Item item : content.items()){
|
||||
if(item.type == ItemType.material && data.isUnlocked(item)){
|
||||
t.label(() -> format.format(items.get(item, 0))).left();
|
||||
t.addImage(item.region).size(8*3).padLeft(4).padRight(4);
|
||||
t.addImage(item.icon(Icon.medium)).size(8*3).padLeft(4).padRight(4);
|
||||
t.add(item.localizedName()).color(Color.LIGHT_GRAY).left();
|
||||
t.row();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package io.anuke.mindustry.ui.dialogs;
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.Lines;
|
||||
import io.anuke.arc.scene.Group;
|
||||
@@ -17,19 +16,17 @@ import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.game.Saves.SaveSlot;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.io.SaveIO.SaveException;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
import io.anuke.mindustry.ui.ItemsDisplay;
|
||||
import io.anuke.mindustry.ui.TreeLayout;
|
||||
import io.anuke.mindustry.ui.TreeLayout.TreeNode;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Block.Icon;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class DeployDialog extends FloatingDialog{
|
||||
private final float nodeSize = Unit.dp.scl(250f);
|
||||
private final float nodeSize = Unit.dp.scl(210f);
|
||||
private ObjectSet<ZoneNode> nodes = new ObjectSet<>();
|
||||
private ZoneInfoDialog info = new ZoneInfoDialog();
|
||||
|
||||
public DeployDialog(){
|
||||
super("");
|
||||
@@ -37,7 +34,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
ZoneNode root = new ZoneNode(Zones.groundZero, null);
|
||||
|
||||
TreeLayout layout = new TreeLayout();
|
||||
layout.gapBetweenLevels = layout.gapBetweenNodes = Unit.dp.scl(40f);
|
||||
layout.gapBetweenLevels = layout.gapBetweenNodes = Unit.dp.scl(50f);
|
||||
layout.layout(root);
|
||||
|
||||
addCloseButton();
|
||||
@@ -49,7 +46,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
public void setup(){
|
||||
cont.clear();
|
||||
titleTable.remove();
|
||||
marginTop(0f);
|
||||
margin(0f).marginBottom(8);
|
||||
|
||||
cont.stack(control.saves.getZoneSlot() == null ? new View() : new Table(){{
|
||||
SaveSlot slot = control.saves.getZoneSlot();
|
||||
@@ -109,53 +106,23 @@ public class DeployDialog extends FloatingDialog{
|
||||
drawDefaultBackground(x, y);
|
||||
}
|
||||
|
||||
boolean canUnlock(Zone zone){
|
||||
if(data.isUnlocked(zone)){
|
||||
return true;
|
||||
}
|
||||
|
||||
for(Zone other : zone.zoneRequirements){
|
||||
if(!data.isCompleted(other)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(Block other : zone.blockRequirements){
|
||||
if(!data.isUnlocked(other)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return data.hasItems(zone.itemRequirements);
|
||||
}
|
||||
|
||||
void buildButton(Zone zone, TextButton button){
|
||||
button.setDisabled(() -> !canUnlock(zone) || !data.hasItems(zone.deployCost));
|
||||
button.clicked(() -> {
|
||||
if(!data.isUnlocked(zone)){
|
||||
data.removeItems(zone.itemRequirements);
|
||||
data.unlockContent(zone);
|
||||
setup();
|
||||
}else{
|
||||
data.removeItems(zone.deployCost);
|
||||
hide();
|
||||
world.playZone(zone);
|
||||
}
|
||||
});
|
||||
button.setDisabled(() -> hidden(zone));
|
||||
button.clicked(() -> info.show(zone));
|
||||
|
||||
if(zone.unlocked()){
|
||||
button.table(title -> {
|
||||
title.addImage("icon-zone").padRight(3);
|
||||
title.add(zone.localizedName());
|
||||
});
|
||||
button.row();
|
||||
//button.table(title -> {
|
||||
button.addImage("icon-zone").padRight(3);
|
||||
button.labelWrap(zone.localizedName()).width(140).growX();
|
||||
//});
|
||||
|
||||
if(data.getWaveScore(zone) > 0){
|
||||
button.add(Core.bundle.format("bestwave", data.getWaveScore(zone)));
|
||||
}
|
||||
|
||||
button.row();
|
||||
//if(data.getWaveScore(zone) > 0){
|
||||
// button.add(Core.bundle.format("bestwave", data.getWaveScore(zone)));
|
||||
//}
|
||||
|
||||
/*
|
||||
button.add("$launch").color(Color.LIGHT_GRAY).pad(4);
|
||||
button.row();
|
||||
button.table(req -> {
|
||||
@@ -163,8 +130,13 @@ public class DeployDialog extends FloatingDialog{
|
||||
req.addImage(stack.item.region).size(8 * 3);
|
||||
req.add(stack.amount + "").left();
|
||||
}
|
||||
}).pad(3).growX();
|
||||
}).pad(3).growX();*/
|
||||
}else{
|
||||
button.addImage("icon-zone-locked");
|
||||
button.row();
|
||||
button.add("$locked");
|
||||
|
||||
/*else{
|
||||
button.addImage("icon-zone-locked");
|
||||
button.row();
|
||||
button.add("$locked").padBottom(6);
|
||||
@@ -220,6 +192,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
}
|
||||
}).growX();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +204,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
{
|
||||
for(ZoneNode node : nodes){
|
||||
TextButton button = new TextButton("", "node");
|
||||
button.setSize(nodeSize);
|
||||
button.setSize(node.width, node.height);
|
||||
button.update(() -> {
|
||||
button.setPosition(node.x + panX + width/2f, node.y + panY + height/2f, Align.center);
|
||||
});
|
||||
@@ -270,6 +243,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
this.zone = zone;
|
||||
this.parent = parent;
|
||||
this.width = this.height = nodeSize;
|
||||
this.height /= 2f;
|
||||
nodes.add(this);
|
||||
|
||||
arr.selectFrom(content.zones(), other -> Structs.contains(other.zoneRequirements, zone));
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.anuke.arc.Core;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.Item.Icon;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@@ -60,7 +61,7 @@ public class GameOverDialog extends FloatingDialog{
|
||||
if(state.stats.itemsDelivered.get(item, 0) > 0){
|
||||
cont.table(items -> {
|
||||
items.add(" [LIGHT_GRAY]" + state.stats.itemsDelivered.get(item, 0));
|
||||
items.addImage(item.region).size(8 *3).pad(4);
|
||||
items.addImage(item.icon(Icon.medium)).size(8 *3).pad(4);
|
||||
}).left();
|
||||
cont.row();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
@@ -16,8 +15,6 @@ import io.anuke.arc.scene.ui.ImageButton;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.arc.scene.ui.layout.Unit;
|
||||
import io.anuke.arc.util.Align;
|
||||
import io.anuke.arc.util.Log;
|
||||
import io.anuke.arc.util.Structs;
|
||||
import io.anuke.mindustry.content.TechTree;
|
||||
import io.anuke.mindustry.content.TechTree.TechNode;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
@@ -25,7 +22,6 @@ import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.ui.ItemsDisplay;
|
||||
import io.anuke.mindustry.ui.TreeLayout;
|
||||
import io.anuke.mindustry.ui.TreeLayout.TreeNode;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Block.Icon;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
@@ -45,23 +41,9 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
layout.layout(root);
|
||||
|
||||
titleTable.remove();
|
||||
margin(0f);
|
||||
margin(0f).marginBottom(8);
|
||||
cont.stack(new View(), items = new ItemsDisplay()).grow();
|
||||
|
||||
{ //debug code; TODO remove
|
||||
ObjectSet<Block> used = new ObjectSet<Block>().select(t -> true);
|
||||
for(TechTreeNode node : nodes){
|
||||
used.add(node.node.block);
|
||||
}
|
||||
Array<Block> recipes = content.blocks().select(r -> r.isVisible() && !used.contains(r));
|
||||
recipes.sort(Structs.comparing(r -> r.buildCost));
|
||||
|
||||
if(recipes.size > 0){
|
||||
Log.info("Missing recipe tree items! ");
|
||||
recipes.forEach(r -> Log.info("> {0}", r));
|
||||
}
|
||||
}
|
||||
|
||||
shown(() -> checkNodes(root));
|
||||
hidden(ui.deploy::setup);
|
||||
addCloseButton();
|
||||
|
||||
142
core/src/io/anuke/mindustry/ui/dialogs/ZoneInfoDialog.java
Normal file
142
core/src/io/anuke/mindustry/ui/dialogs/ZoneInfoDialog.java
Normal file
@@ -0,0 +1,142 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.scene.ui.Button;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Block.Icon;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class ZoneInfoDialog extends FloatingDialog{
|
||||
|
||||
public ZoneInfoDialog(){
|
||||
super("");
|
||||
|
||||
titleTable.remove();
|
||||
addCloseButton();
|
||||
}
|
||||
|
||||
public void show(Zone zone){
|
||||
setup(zone);
|
||||
show();
|
||||
}
|
||||
|
||||
private void setup(Zone zone){
|
||||
cont.clear();
|
||||
|
||||
cont.table(cont -> {
|
||||
if(zone.locked()){
|
||||
cont.addImage("icon-zone-locked");
|
||||
cont.row();
|
||||
cont.add("$locked").padBottom(6);
|
||||
cont.row();
|
||||
|
||||
cont.table(req -> {
|
||||
req.defaults().left();
|
||||
|
||||
if(zone.zoneRequirements.length > 0){
|
||||
req.table(r -> {
|
||||
r.add("$complete").colspan(2).left();
|
||||
r.row();
|
||||
for(Zone other : zone.zoneRequirements){
|
||||
r.addImage("icon-zone").padRight(4);
|
||||
r.add(other.localizedName()).color(Color.LIGHT_GRAY);
|
||||
r.addImage(data.isCompleted(other) ? "icon-check-2" : "icon-cancel-2")
|
||||
.color(data.isCompleted(other) ? Color.LIGHT_GRAY : Color.SCARLET).padLeft(3);
|
||||
r.row();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
req.row();
|
||||
|
||||
if(zone.blockRequirements.length > 0){
|
||||
req.table(r -> {
|
||||
r.add("$research.list").colspan(2).left();
|
||||
r.row();
|
||||
for(Block block : zone.blockRequirements){
|
||||
r.addImage(block.icon(Icon.small)).size(8 * 3).padRight(4);
|
||||
r.add(block.formalName).color(Color.LIGHT_GRAY);
|
||||
r.addImage(data.isUnlocked(block) ? "icon-check-2" : "icon-cancel-2")
|
||||
.color(data.isUnlocked(block) ? Color.LIGHT_GRAY : Color.SCARLET).padLeft(3);
|
||||
r.row();
|
||||
}
|
||||
|
||||
}).padTop(10);
|
||||
}
|
||||
}).growX();
|
||||
|
||||
}else{
|
||||
cont.add(zone.localizedName()).color(Pal.accent).growX().center();
|
||||
cont.row();
|
||||
cont.addImage("white").color(Pal.accent).height(3).pad(6).growX();
|
||||
cont.row();
|
||||
cont.table(res -> {
|
||||
res.add("$zone.resources").padRight(6);
|
||||
if(zone.resources.length > 0){
|
||||
for(Item item : zone.resources){
|
||||
res.addImage(item.icon(Item.Icon.medium)).size(8 * 3);
|
||||
}
|
||||
}else{
|
||||
res.add("$none");
|
||||
}
|
||||
});
|
||||
|
||||
if(data.getWaveScore(zone) > 0){
|
||||
cont.row();
|
||||
cont.add(Core.bundle.format("bestwave", data.getWaveScore(zone)));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cont.row();
|
||||
|
||||
Button button = cont.addButton(zone.locked() ? "$uncover" : "$launch", () -> {
|
||||
if(!data.isUnlocked(zone)){
|
||||
data.removeItems(zone.itemRequirements);
|
||||
data.unlockContent(zone);
|
||||
ui.deploy.setup();
|
||||
setup(zone);
|
||||
}else{
|
||||
ui.deploy.hide();
|
||||
data.removeItems(zone.deployCost);
|
||||
hide();
|
||||
world.playZone(zone);
|
||||
}
|
||||
}).size(300f, 70f).padTop(5).disabled(b -> zone.locked() ? !canUnlock(zone) : !data.hasItems(zone.deployCost)).get();
|
||||
|
||||
button.row();
|
||||
button.table(r -> {
|
||||
ItemStack[] stacks = zone.unlocked() ? zone.deployCost : zone.itemRequirements;
|
||||
for(ItemStack stack : stacks){
|
||||
r.addImage(stack.item.icon(Item.Icon.medium)).size(8*3).padRight(1);
|
||||
r.add(stack.amount + "").color(Color.LIGHT_GRAY).padRight(5);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean canUnlock(Zone zone){
|
||||
if(data.isUnlocked(zone)){
|
||||
return true;
|
||||
}
|
||||
|
||||
for(Zone other : zone.zoneRequirements){
|
||||
if(!data.isCompleted(other)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(Block other : zone.blockRequirements){
|
||||
if(!data.isUnlocked(other)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return data.hasItems(zone.itemRequirements);
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import io.anuke.mindustry.entities.type.Player;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.Item.Icon;
|
||||
import io.anuke.mindustry.ui.ItemImage;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
@@ -135,7 +136,7 @@ public class BlockInventoryFragment extends Fragment{
|
||||
HandCursorListener l = new HandCursorListener();
|
||||
l.setEnabled(canPick);
|
||||
|
||||
ItemImage image = new ItemImage(item.region, () -> {
|
||||
ItemImage image = new ItemImage(item.icon(Icon.large), () -> {
|
||||
if(tile == null || tile.entity == null){
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.input.Binding;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.type.Category;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Block.Icon;
|
||||
@@ -209,7 +210,7 @@ public class PlacementFragment extends Fragment{
|
||||
for(ItemStack stack : lastDisplay.buildRequirements){
|
||||
req.table(line -> {
|
||||
line.left();
|
||||
line.addImage(stack.item.region).size(8 * 2);
|
||||
line.addImage(stack.item.icon(Item.Icon.small)).size(8 * 2);
|
||||
line.add(stack.item.localizedName()).color(Color.LIGHT_GRAY).padLeft(2).left();
|
||||
line.labelWrap(() -> {
|
||||
TileEntity core = players[0].getClosestCore();
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.anuke.arc.scene.style.TextureRegionDrawable;
|
||||
import io.anuke.arc.scene.ui.ButtonGroup;
|
||||
import io.anuke.arc.scene.ui.ImageButton;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.mindustry.type.Item.Icon;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@@ -29,7 +30,7 @@ public interface SelectionTrait{
|
||||
|
||||
ImageButton button = cont.addImageButton("white", "clear-toggle", 24, () -> {}).group(group).get();
|
||||
button.changed(() -> consumer.accept(button.isChecked() ? item : null));
|
||||
button.getStyle().imageUp = new TextureRegionDrawable(item.region);
|
||||
button.getStyle().imageUp = new TextureRegionDrawable(item.icon(Icon.medium));
|
||||
button.update(() -> button.setChecked(holder.get() == item));
|
||||
|
||||
if(i++ % 4 == 3){
|
||||
|
||||
@@ -140,7 +140,7 @@ public class Conveyor extends Block{
|
||||
tr1.trns(rotation * 90, tilesize, 0);
|
||||
tr2.trns(rotation * 90, -tilesize / 2f, pos.x * tilesize / 2f);
|
||||
|
||||
Draw.rect(pos.item.region,
|
||||
Draw.rect(pos.item.icon(Item.Icon.medium),
|
||||
(tile.x * tilesize + tr1.x * pos.y + tr2.x),
|
||||
(tile.y * tilesize + tr1.y * pos.y + tr2.y), itemSize, itemSize);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks.sandbox;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.scene.style.TextureRegionDrawable;
|
||||
import io.anuke.arc.scene.ui.ButtonGroup;
|
||||
@@ -12,7 +13,9 @@ import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.entities.type.Player;
|
||||
import io.anuke.mindustry.entities.type.TileEntity;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.ui.Bar;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
@@ -34,6 +37,14 @@ public class LiquidSource extends Block{
|
||||
outputsLiquid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayBars(Tile tile, Table bars){
|
||||
TileEntity entity = tile.entity;
|
||||
|
||||
bars.add(new Bar("blocks.health", Pal.health, entity::healthf).blink(Color.WHITE));
|
||||
bars.row();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
LiquidSourceEntity entity = tile.entity();
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.world.consumers;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.mindustry.entities.type.TileEntity;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.Item.Icon;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.meta.BlockStat;
|
||||
import io.anuke.mindustry.world.meta.BlockStats;
|
||||
@@ -28,7 +29,7 @@ public class ConsumeItemFilter extends Consume{
|
||||
|
||||
for(int i = 0; i < list.size; i++){
|
||||
Item item = list.get(i);
|
||||
table.addImage(item.region).size(8 * 4).padRight(2).padLeft(2);
|
||||
table.addImage(item.icon(Icon.large)).size(8 * 4).padRight(2).padLeft(2);
|
||||
if(i != list.size - 1){
|
||||
table.add("/");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user