From b180462c4515a4626f577f277f2f07e43bfd8ddb Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 25 Jul 2020 10:25:48 -0400 Subject: [PATCH] Better tree layout --- core/src/mindustry/content/TechTree.java | 165 +++++++++--------- .../mindustry/ui/dialogs/ResearchDialog.java | 6 +- 2 files changed, 87 insertions(+), 84 deletions(-) diff --git a/core/src/mindustry/content/TechTree.java b/core/src/mindustry/content/TechTree.java index 1850cc8869..a05bad0db2 100644 --- a/core/src/mindustry/content/TechTree.java +++ b/core/src/mindustry/content/TechTree.java @@ -73,6 +73,12 @@ public class TechTree implements ContentList{ }); }); + node(coreFoundation, () -> { + node(coreNucleus, () -> { + + }); + }); + node(mechanicalDrill, () -> { node(mechanicalPump, () -> { @@ -255,85 +261,38 @@ public class TechTree implements ContentList{ }); }); + }); + }); + }); + }); - node(groundFactory, () -> { - node(dagger, () -> { - node(mace, () -> { - node(fortress, () -> { + node(duo, () -> { + node(copperWall, () -> { + node(copperWallLarge, () -> { + node(titaniumWall, () -> { + node(titaniumWallLarge); - }); - }); + node(door, () -> { + node(doorLarge); + }); + node(plastaniumWall, () -> { + node(plastaniumWallLarge, () -> { - node(nova, () -> { - node(pulsar, () -> { - node(quasar, () -> { - - }); - }); - }); - - node(crawler, () -> { - node(atrax, () -> { - node(spiroct, () -> { - - }); - }); - }); }); - - node(airFactory, () -> { - node(flare, () -> { - node(horizon, () -> { - node(zenith, () -> { - node(antumbra, () -> { - node(eclipse, () -> { - - }); - }); - }); - }); - - node(mono, () -> { - node(poly, () -> { - node(mega, () -> { - - }); - }); - }); - }); - - node(navalFactory, () -> { - node(risso, () -> { - node(minke, () -> { - node(bryde, () -> { - - }); - }); - }); - }); - }); - - node(additiveReconstructor, () -> { - node(multiplicativeReconstructor, () -> { - node(exponentialReconstructor, () -> { - node(tetrativeReconstructor, () -> { - }); - }); + }); + node(thoriumWall, () -> { + node(thoriumWallLarge); + node(surgeWall, () -> { + node(surgeWallLarge); + node(phaseWall, () -> { + node(phaseWallLarge); }); }); }); }); }); }); - }); - node(coreFoundation, () -> { - node(coreNucleus, () -> { - - }); - }); - - node(duo, () -> { node(scatter, () -> { node(hail, () -> { @@ -376,31 +335,71 @@ public class TechTree implements ContentList{ }); }); }); + }); + node(groundFactory, () -> { + node(dagger, () -> { + node(mace, () -> { + node(fortress, () -> { - node(copperWall, () -> { - node(copperWallLarge, () -> { - node(titaniumWall, () -> { - node(titaniumWallLarge); + }); + }); + + node(nova, () -> { + node(pulsar, () -> { + node(quasar, () -> { - node(door, () -> { - node(doorLarge); }); - node(plastaniumWall, () -> { - node(plastaniumWallLarge, () -> { + }); + }); + + node(crawler, () -> { + node(atrax, () -> { + node(spiroct, () -> { - }); }); - node(thoriumWall, () -> { - node(thoriumWallLarge); - node(surgeWall, () -> { - node(surgeWallLarge); - node(phaseWall, () -> { - node(phaseWallLarge); + }); + }); + }); + + node(airFactory, () -> { + node(flare, () -> { + node(horizon, () -> { + node(zenith, () -> { + node(antumbra, () -> { + node(eclipse, () -> { + }); }); }); }); + + node(mono, () -> { + node(poly, () -> { + node(mega, () -> { + + }); + }); + }); + }); + + node(navalFactory, () -> { + node(risso, () -> { + node(minke, () -> { + node(bryde, () -> { + + }); + }); + }); + }); + }); + + node(additiveReconstructor, () -> { + node(multiplicativeReconstructor, () -> { + node(exponentialReconstructor, () -> { + node(tetrativeReconstructor, () -> { + }); + }); }); }); }); diff --git a/core/src/mindustry/ui/dialogs/ResearchDialog.java b/core/src/mindustry/ui/dialogs/ResearchDialog.java index 126096d565..c455c72612 100644 --- a/core/src/mindustry/ui/dialogs/ResearchDialog.java +++ b/core/src/mindustry/ui/dialogs/ResearchDialog.java @@ -416,13 +416,16 @@ public class ResearchDialog extends BaseDialog{ public void drawChildren(){ clamp(); float offsetX = panX + width / 2f, offsetY = panY + height / 2f; + Draw.sort(true); for(TechTreeNode node : nodes){ if(!node.visible) continue; for(TechTreeNode child : node.children){ if(!child.visible) continue; + boolean lock = locked(node.node) || locked(child.node); + Draw.z(lock ? 1f : 2f); - Lines.stroke(Scl.scl(4f), locked(node.node) || locked(child.node) ? Pal.gray : Pal.accent); + Lines.stroke(Scl.scl(4f), lock ? Pal.gray : Pal.accent); Draw.alpha(parentAlpha); if(Mathf.equal(Math.abs(node.y - child.y), Math.abs(node.x - child.x), 1f) && Mathf.dstm(node.x, node.y, child.x, child.y) <= node.width*3){ Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY); @@ -433,6 +436,7 @@ public class ResearchDialog extends BaseDialog{ } } + Draw.sort(false); Draw.reset(); super.drawChildren(); }