diff --git a/core/assets-raw/sprites/ui/icons/icon-tree.png b/core/assets-raw/sprites/ui/icons/icon-tree.png new file mode 100644 index 0000000000..6e28a70c13 Binary files /dev/null and b/core/assets-raw/sprites/ui/icons/icon-tree.png differ diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 59c7a938af..61430ed9ab 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -52,6 +52,7 @@ noname = Pick a[accent] player name[] first. filename = File Name: unlocked = New content unlocked! completed = [accent]Completed +techtree = Tech Tree research = Research researched = [LIGHT_GRAY]{0} researched. players = {0} players online diff --git a/core/assets/sprites/sprites.atlas b/core/assets/sprites/sprites.atlas index c6df5e5165..17a44cdfe0 100644 --- a/core/assets/sprites/sprites.atlas +++ b/core/assets/sprites/sprites.atlas @@ -2764,7 +2764,7 @@ bullet-back index: -1 casing rotate: false - xy: 1135, 907 + xy: 847, 891 size: 8, 16 orig: 8, 16 offset: 0, 0 @@ -2834,7 +2834,7 @@ laserfull index: -1 minelaser rotate: false - xy: 2041, 1233 + xy: 847, 841 size: 4, 48 orig: 4, 48 offset: 0, 0 @@ -2925,7 +2925,7 @@ shot index: -1 transfer rotate: false - xy: 2041, 1183 + xy: 847, 791 size: 4, 48 orig: 4, 48 offset: 0, 0 @@ -8784,21 +8784,21 @@ icon-production index: -1 icon-turret rotate: false - xy: 786, 837 + xy: 919, 1005 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 icon-units rotate: false - xy: 993, 919 + xy: 960, 11 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 icon-upgrade rotate: false - xy: 1011, 911 + xy: 1029, 911 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -9155,7 +9155,7 @@ icon-line index: -1 icon-link rotate: false - xy: 1047, 913 + xy: 1065, 913 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -9169,7 +9169,7 @@ icon-liquid-small index: -1 icon-load rotate: false - xy: 1063, 913 + xy: 1081, 913 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -9204,14 +9204,14 @@ icon-locked index: -1 icon-logic rotate: false - xy: 907, 913 + xy: 923, 913 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 icon-map rotate: false - xy: 1079, 913 + xy: 1097, 913 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -9246,28 +9246,28 @@ icon-mission-background index: -1 icon-mission-battle rotate: false - xy: 919, 913 + xy: 618, 1832 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 icon-mission-defense rotate: false - xy: 618, 1832 + xy: 1113, 913 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 icon-mission-done rotate: false - xy: 210, 4 + xy: 1125, 913 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 icon-none rotate: false - xy: 222, 4 + xy: 210, 4 size: 10, 10 orig: 10, 10 offset: 0, 0 @@ -9281,7 +9281,7 @@ icon-paste index: -1 icon-pause rotate: false - xy: 234, 4 + xy: 222, 4 size: 10, 10 orig: 10, 10 offset: 0, 0 @@ -9295,7 +9295,7 @@ icon-pencil index: -1 icon-pencil-small rotate: false - xy: 1095, 913 + xy: 795, 919 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -9309,35 +9309,35 @@ icon-pick index: -1 icon-play rotate: false - xy: 246, 4 + xy: 234, 4 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 icon-play-2 rotate: false - xy: 795, 919 + xy: 795, 903 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 icon-players rotate: false - xy: 636, 1840 + xy: 246, 4 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 icon-power-small rotate: false - xy: 1111, 913 + xy: 636, 1840 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 icon-quit rotate: false - xy: 795, 903 + xy: 811, 925 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -9351,14 +9351,14 @@ icon-redo index: -1 icon-refresh rotate: false - xy: 811, 925 + xy: 827, 925 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 icon-rename rotate: false - xy: 827, 925 + xy: 811, 909 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -9372,35 +9372,35 @@ icon-resize index: -1 icon-rotate rotate: false - xy: 811, 909 + xy: 843, 925 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 icon-rotate-arrow rotate: false - xy: 843, 925 + xy: 827, 909 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 icon-rotate-left rotate: false - xy: 827, 909 + xy: 859, 925 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 icon-rotate-right rotate: false - xy: 859, 925 + xy: 843, 909 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 icon-save rotate: false - xy: 843, 909 + xy: 875, 925 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -9421,7 +9421,7 @@ icon-save-map index: -1 icon-settings rotate: false - xy: 1123, 913 + xy: 811, 897 size: 10, 10 orig: 10, 10 offset: 0, 0 @@ -9435,28 +9435,28 @@ icon-terrain index: -1 icon-tools rotate: false - xy: 875, 925 + xy: 859, 909 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 icon-touch rotate: false - xy: 811, 897 + xy: 823, 897 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 icon-touchDelete rotate: false - xy: 823, 897 + xy: 835, 897 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 icon-trash rotate: false - xy: 859, 909 + xy: 891, 925 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -9468,6 +9468,13 @@ icon-trash-16 orig: 16, 16 offset: 0, 0 index: -1 +icon-tree + rotate: false + xy: 786, 837 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 icon-tree-locked rotate: false xy: 305, 77 @@ -9477,56 +9484,56 @@ icon-tree-locked index: -1 icon-trello rotate: false - xy: 891, 925 + xy: 875, 909 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 icon-tutorial rotate: false - xy: 875, 909 + xy: 907, 925 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 icon-undo rotate: false - xy: 919, 1005 + xy: 993, 919 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 icon-unlocked rotate: false - xy: 960, 11 + xy: 1011, 911 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 icon-unlocks rotate: false - xy: 907, 925 + xy: 891, 909 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 icon-wiki rotate: false - xy: 891, 909 + xy: 923, 925 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 icon-zoom rotate: false - xy: 1029, 911 + xy: 1047, 911 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 icon-zoom-small rotate: false - xy: 923, 925 + xy: 907, 909 size: 14, 14 orig: 14, 14 offset: 0, 0 diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index 32800c6137..f9bbf107f7 100644 Binary files a/core/assets/sprites/sprites.png and b/core/assets/sprites/sprites.png differ diff --git a/core/src/io/anuke/mindustry/type/Zone.java b/core/src/io/anuke/mindustry/type/Zone.java index 18c95b84f7..8bbeaaeb4d 100644 --- a/core/src/io/anuke/mindustry/type/Zone.java +++ b/core/src/io/anuke/mindustry/type/Zone.java @@ -7,6 +7,7 @@ import io.anuke.arc.scene.ui.layout.Table; import io.anuke.mindustry.game.Rules; import io.anuke.mindustry.game.UnlockableContent; import io.anuke.mindustry.maps.generators.Generator; +import io.anuke.mindustry.world.Block; import static io.anuke.mindustry.Vars.state; @@ -15,6 +16,8 @@ public class Zone extends UnlockableContent{ public final Generator generator; public ItemStack[] deployCost = {}; public ItemStack[] startingItems = {}; + public Block[] blockRequirements = {}; + public ItemStack[] itemRequirements = {}; public Supplier rules = Rules::new; public boolean alwaysUnlocked; public int conditionWave = Integer.MAX_VALUE; diff --git a/core/src/io/anuke/mindustry/ui/dialogs/AboutDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/AboutDialog.java index cf77e3f0cd..a10edecfa0 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/AboutDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/AboutDialog.java @@ -48,7 +48,7 @@ public class AboutDialog extends FloatingDialog{ continue; } - Table table = new Table("underline-2"); + Table table = new Table("underline"); table.margin(0); table.table(img -> { img.addImage("white").height(h - 5).width(40f).color(link.color); diff --git a/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java index 052be7517a..d4c6effa9e 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java @@ -26,7 +26,7 @@ public class DeployDialog extends FloatingDialog{ cont.clear(); addCloseButton(); - buttons.addButton("$techtree", () -> ui.tech.show()).size(200f, 60f); + buttons.addImageTextButton("$techtree", "icon-tree", 16 * 2, () -> ui.tech.show()).size(230f, 64f); cont.stack(new Table(){{ top().left().margin(10); diff --git a/core/src/io/anuke/mindustry/ui/dialogs/TechTreeDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/TechTreeDialog.java index 7a208f28c2..3055d221e5 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/TechTreeDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/TechTreeDialog.java @@ -5,10 +5,10 @@ import io.anuke.arc.collection.Array; import io.anuke.arc.collection.ObjectSet; import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.g2d.Lines; -import io.anuke.arc.graphics.g2d.ScissorStack; import io.anuke.arc.input.KeyCode; import io.anuke.arc.math.Interpolation; import io.anuke.arc.math.geom.Rectangle; +import io.anuke.arc.scene.Element; import io.anuke.arc.scene.Group; import io.anuke.arc.scene.actions.Actions; import io.anuke.arc.scene.event.InputEvent; @@ -36,10 +36,11 @@ public class TechTreeDialog extends FloatingDialog{ private ObjectSet nodes = new ObjectSet<>(); private TechTreeNode root = new TechTreeNode(TechTree.root, null); private static final float nodeSize = 60f; - private int toasts; public TechTreeDialog(){ - super("$techtree"); + super(""); + + cont.setFillParent(true); TreeLayout layout = new TreeLayout(); layout.gapBetweenLevels = 60f; @@ -67,6 +68,11 @@ public class TechTreeDialog extends FloatingDialog{ addCloseButton(); } + @Override + protected void drawBackground(float x, float y){ + drawDefaultBackground(x, y); + } + void checkNodes(TechTreeNode node){ boolean locked = locked(node); if(!locked) node.visible = true; @@ -78,14 +84,24 @@ public class TechTreeDialog extends FloatingDialog{ } void showToast(String info){ - toasts ++; - int t = toasts; + int maxIndex = 0; + + for(Element e : Core.scene.root.getChildren()){ + if("toast".equals(e.getName())){ + maxIndex = Math.max(maxIndex, (Integer)e.getUserObject() + 1); + } + } + + int m = maxIndex; + Table table = new Table(); - table.actions(Actions.fadeOut(7f, Interpolation.fade), Actions.run(() -> toasts --), Actions.removeActor()); + table.actions(Actions.fadeOut(7f, Interpolation.fade), Actions.removeActor()); table.top().add(info); + table.setName("toast"); + table.setUserObject(maxIndex); table.update(() -> { table.toFront(); - table.setPosition(Core.graphics.getWidth()/2f, Core.graphics.getHeight() - 21 - t*20f, Align.top); + table.setPosition(Core.graphics.getWidth()/2f, Core.graphics.getHeight() - 21 - m*20f, Align.top); }); Core.scene.add(table); } @@ -117,7 +133,7 @@ public class TechTreeDialog extends FloatingDialog{ } class View extends Group{ - float panX = 0, panY = 0; + float panX = 0, panY = -200; boolean moved = false; Rectangle clip = new Rectangle(); ImageButton hoverNode; @@ -253,10 +269,6 @@ public class TechTreeDialog extends FloatingDialog{ @Override public void draw(){ - if(!ScissorStack.pushScissors(clip.set(x, y, width, height))){ - return; - } - float offsetX = panX + width/2f + x, offsetY = panY + height/2f + y; for(TreeNode node : nodes){ @@ -268,8 +280,6 @@ public class TechTreeDialog extends FloatingDialog{ } super.draw(); - - ScissorStack.popScissors(); } } }