From 764ec34ff5ef5f71374deba22ee259b149c1ae6d Mon Sep 17 00:00:00 2001 From: Goobrr <73060700+Goobrr@users.noreply.github.com> Date: Sun, 17 Jul 2022 20:21:31 +0700 Subject: [PATCH] Objective Editor UI Rework, Part 1 (#7179) * Objective tile ui * Fancier connectors * New ninepatches * Button styles --- .../sprites/ui/button-side-left-down.9.png | Bin 0 -> 278 bytes .../sprites/ui/button-side-left-over.9.png | Bin 0 -> 272 bytes .../sprites/ui/button-side-left.9.png | Bin 0 -> 273 bytes .../sprites/ui/button-side-right-down.9.png | Bin 0 -> 280 bytes .../sprites/ui/button-side-right-over.9.png | Bin 0 -> 277 bytes .../sprites/ui/button-side-right.9.png | Bin 0 -> 276 bytes .../mindustry/editor/MapObjectivesCanvas.java | 76 +++++++++++++----- 7 files changed, 56 insertions(+), 20 deletions(-) create mode 100644 core/assets-raw/sprites/ui/button-side-left-down.9.png create mode 100644 core/assets-raw/sprites/ui/button-side-left-over.9.png create mode 100644 core/assets-raw/sprites/ui/button-side-left.9.png create mode 100644 core/assets-raw/sprites/ui/button-side-right-down.9.png create mode 100644 core/assets-raw/sprites/ui/button-side-right-over.9.png create mode 100644 core/assets-raw/sprites/ui/button-side-right.9.png diff --git a/core/assets-raw/sprites/ui/button-side-left-down.9.png b/core/assets-raw/sprites/ui/button-side-left-down.9.png new file mode 100644 index 0000000000000000000000000000000000000000..77135c13a714eda84f8fad16a5b76e12109f1263 GIT binary patch literal 278 zcmV+x0qOpUP)Px#&`Cr=R9J=0*WnF=AP|P(7vegO!Wvz}xJK8wQ5=Z=Xf=&;0%^nD_fNs($;I43 zpd%?I07N8reiwT7iwMmh1ogIQ_O5_eS08!n2-@!$z}`NzEAw9apiyS*h@9j&XkB&~8IQtkX!xTcY0 cSvhxk0f&28hAFll=l}o!07*qoM6N<$f-sJD?EnA( literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/ui/button-side-left-over.9.png b/core/assets-raw/sprites/ui/button-side-left-over.9.png new file mode 100644 index 0000000000000000000000000000000000000000..344289a29f8874a4e32c34f37f407af854732247 GIT binary patch literal 272 zcmV+r0q_2aP)Px#%1J~)R9J=0*U=5bFbGA_OVsteMu+Me3`jrPR8<18tyYHjnb^`1vA_`~(pm#R zRc&&g%&b>chBuhm6y}$Rh-@PZSEBZGVHqgsz_L&Px9CNL5|PKh5oUHjK65L!5*6hH ztAGO7_TB__Q1Df;N+@{4s-fVbU1XvlfMufq1m{bxh8_FZ@T|;8U6^-Q@Px#%Sl8*R9J=0*TD_LAPj}!AJo-2vPOsM8a{fs_RuDZ8XQ2au-`3#NT008hQvf_ ztpJF~bMm`1vtL9Q{-BgHh503_n)1lTm8dOUm!QE zH!j2bVAfjn#O)P}hRY(dKSaWv{;?=HtMj|#E^kR*N9*n_$*SCnbUVKnZfGQVRxVs# XpXpcx|MWZE00000NkvXXu0mjf3GaF( literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/ui/button-side-right-down.9.png b/core/assets-raw/sprites/ui/button-side-right-down.9.png new file mode 100644 index 0000000000000000000000000000000000000000..aa34b5e53f7a314de1e849d0cabd4e91a955a2d6 GIT binary patch literal 280 zcmV+z0q6dSP)Px#(n&-?R9J=0m(dNwAPhv$?2}QvM%SpaM%G}I4wQbhsnjUOw$k`|-yk05z=r^U zsv@J_`ndapJklP`E z;kmMkS(~*gS9+8gxN?t0;V9;hz|n4{2S)<~#<#y^`{b`>!L@8dt`hYqNBUo|Ei18P zwJK`GEGXb*{z{gQyr#~|V{X!5B-l{=DFw@9vNEu2P%Qr?eJwutF)`D{@cm@vG51kt eBv@*vIjtue?OHQvDrTPm0000Px#&q+iQE7t$@g+XQgFqSwZT1YqL+G;*0L%;-wbpuO zy_xZ|FT95U(0flE^h6{XS$FIPxhookaxfqUCjkT2aKjuU`Q8BX8Ui>uR~9kvvR>p$ zpE3hio?}rsN%BYFWL3F>lYs&A>OZn`^4IdKf`QKelul3I`jqKc!$9PgVw&HHziGq_4v#KPIKSnD$SVA6qtcg@ct& bn#Vc;Bxqro*17+300000NkvXXu0mjfEdFiL literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/ui/button-side-right.9.png b/core/assets-raw/sprites/ui/button-side-right.9.png new file mode 100644 index 0000000000000000000000000000000000000000..32123ba7d987446d5fbfd08589a180426faabe24 GIT binary patch literal 276 zcmV+v0qg#WP)Px#&PhZ;R9J=0mrD-AAPhtY?#9yB=%IQImOfmv=tor*V_RuFon-{##SD0803agB zXwJE1#*0XM&I`|J05HZ#Ep$ez+9Kon)ga%B7NHyrh`~|703YtqW2$<;0OWS`-SS*n z#jKyTDp$Id8MtzfMd2vskHFDRr3Xg?1J { + float pad = (unitSize - 32f) / 2f - 4f; + t.margin(pad); + t.touchable(() -> Touchable.enabled); + t.setColor(Pal.gray); - row().table(Tex.buttonSelectTrans, t -> { - t.labelWrap(obj.typeName()).grow() - .style(Styles.outlineLabel) - .color(Pal.accent).align(Align.left).padLeft(6f) - .ellipsis(true).get().setAlignment(Align.left); + t.labelWrap(obj.typeName()) + .style(Styles.outlineLabel) + .left().grow().get() + .setAlignment(Align.left); + + t.row(); t.table(b -> { - b.right().defaults().size(32f).pad((unitSize - 32f) / 2f - 4f); + b.left().defaults().size(40f); + b.button(Icon.pencilSmall, () -> { BaseDialog dialog = new BaseDialog("@editor.objectives"); dialog.cont.pane(Styles.noBarPane, list -> list.top().table(e -> { @@ -406,8 +424,9 @@ public class MapObjectivesCanvas extends WidgetGroup{ dialog.show(); }); b.button(Icon.trashSmall, () -> removeTile(this)); - }).growY().fillX(); - }).grow().colspan(3); + }).left().grow(); + }).growX().height(unitSize * 2).get().addCaptureListener(mover = new Mover()); + add(conChildren = new Connector(false)).size(unitSize, unitSize * 2); setSize(getPrefWidth(), getPrefHeight()); pos(x, y); @@ -496,14 +515,15 @@ public class MapObjectivesCanvas extends WidgetGroup{ public Connector(boolean findParent){ super(new ButtonStyle(){{ - down = findParent ? Tex.buttonEdgeDown1 : Tex.buttonEdgeDown3; - up = findParent ? Tex.buttonEdge1 : Tex.buttonEdge3; - over = findParent ? Tex.buttonEdgeOver1 : Tex.buttonEdgeOver3; + down = findParent ? Tex.buttonSideLeftDown : Tex.buttonSideRightDown; + up = findParent ? Tex.buttonSideLeft : Tex.buttonSideRight; + over = findParent ? Tex.buttonSideLeftOver : Tex.buttonSideRightOver; }}); this.findParent = findParent; clearChildren(); + addCaptureListener(new InputListener(){ int conPointer = -1; @@ -552,6 +572,22 @@ public class MapObjectivesCanvas extends WidgetGroup{ tile() != other.tile(); } + @Override + public void draw(){ + super.draw(); + float cx = x + width / 2f; + float cy = y + height / 2f; + + // these are all magic numbers tweaked until they looked good in-game, don't mind them. + Lines.stroke(3f, Pal.accent); + if(findParent){ + Lines.line(cx, cy + 9f, cx + 9f, cy); + Lines.line(cx + 9f, cy, cx, cy - 9f); + }else{ + Lines.square(cx, cy, 9f, 45f); + } + } + public ObjectiveTile tile(){ return ObjectiveTile.this; }