Bugfixes
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
|
||||
import io.anuke.arc.collection.ObjectIntMap;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemType;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
import static io.anuke.mindustry.Vars.data;
|
||||
|
||||
public class ItemsDisplay extends Table{
|
||||
private static final NumberFormat format = NumberFormat.getNumberInstance(Locale.getDefault());
|
||||
|
||||
public ItemsDisplay(){
|
||||
rebuild();
|
||||
}
|
||||
|
||||
public void rebuild(){
|
||||
clear();
|
||||
top().left();
|
||||
|
||||
table("flat", t -> {
|
||||
t.margin(4);
|
||||
ObjectIntMap<Item> items = data.items();
|
||||
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.add("[LIGHT_GRAY]" + item.localizedName()).left();
|
||||
t.row();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.collection.ObjectIntMap;
|
||||
import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Lines;
|
||||
@@ -16,10 +15,9 @@ import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.game.Saves.SaveSlot;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.io.SaveIO.SaveException;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.ItemType;
|
||||
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;
|
||||
@@ -93,20 +91,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
});
|
||||
}).growX().height(50f).pad(-12).padTop(10);
|
||||
|
||||
}}, new Table(){{
|
||||
top().left().margin(10);
|
||||
|
||||
ObjectIntMap<Item> items = data.items();
|
||||
for(Item item : content.items()){
|
||||
if(item.type == ItemType.material && data.isUnlocked(item)){
|
||||
label(() -> items.get(item, 0) + "").left();
|
||||
addImage(item.region).size(8*4).pad(4);
|
||||
add("[LIGHT_GRAY]" + item.localizedName()).left();
|
||||
row();
|
||||
}
|
||||
}
|
||||
|
||||
}}).grow();
|
||||
}}, new ItemsDisplay()).grow();
|
||||
}
|
||||
|
||||
boolean hidden(Zone zone){
|
||||
|
||||
@@ -20,6 +20,7 @@ import io.anuke.mindustry.content.TechTree;
|
||||
import io.anuke.mindustry.content.TechTree.TechNode;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
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;
|
||||
@@ -28,9 +29,10 @@ import io.anuke.mindustry.world.Block.Icon;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class TechTreeDialog extends FloatingDialog{
|
||||
private static final float nodeSize = 60f;
|
||||
private ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
|
||||
private TechTreeNode root = new TechTreeNode(TechTree.root, null);
|
||||
private static final float nodeSize = 60f;
|
||||
private ItemsDisplay items;
|
||||
|
||||
public TechTreeDialog(){
|
||||
super("");
|
||||
@@ -40,8 +42,9 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
layout.gapBetweenNodes = 40f;
|
||||
layout.layout(root);
|
||||
|
||||
cont.setFillParent(true);
|
||||
cont.add(new View()).grow();
|
||||
titleTable.remove();
|
||||
margin(0f);
|
||||
cont.stack(new View(), items = new ItemsDisplay()).grow();
|
||||
|
||||
{ //debug code; TODO remove
|
||||
ObjectSet<Block> used = new ObjectSet<Block>().select(t -> true);
|
||||
@@ -74,6 +77,8 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
l.visible = !locked && l.node.block.isVisible();
|
||||
checkNodes(l);
|
||||
}
|
||||
|
||||
items.rebuild();
|
||||
}
|
||||
|
||||
void showToast(String info){
|
||||
|
||||
@@ -73,8 +73,10 @@ public class PlacementFragment extends Fragment{
|
||||
void rebuild(){
|
||||
currentCategory = Category.turret;
|
||||
Group group = toggler.getParent();
|
||||
int index = toggler.getZIndex();
|
||||
toggler.remove();
|
||||
build(group);
|
||||
toggler.setZIndex(index);
|
||||
}
|
||||
|
||||
boolean gridUpdate(InputHandler input){
|
||||
|
||||
Reference in New Issue
Block a user