From 88e1770f2ef21104cb35b62ba63480fb6f248d38 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 18 Oct 2019 19:31:01 -0400 Subject: [PATCH] Bugfixes --- core/assets/sprites/schematic-background.png | Bin 0 -> 1242 bytes .../io/anuke/mindustry/ClientLauncher.java | 3 +- .../io/anuke/mindustry/content/Blocks.java | 3 +- .../io/anuke/mindustry/game/Schematics.java | 4 +- .../ui/dialogs/SchematicsDialog.java | 74 ++++++++++++++---- 5 files changed, 66 insertions(+), 18 deletions(-) create mode 100644 core/assets/sprites/schematic-background.png diff --git a/core/assets/sprites/schematic-background.png b/core/assets/sprites/schematic-background.png new file mode 100644 index 0000000000000000000000000000000000000000..d0085b65d965090fab3a47d43b91fd3220a207a9 GIT binary patch literal 1242 zcmV<01SR{4P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+U=KHmcu3thTpY{E&)l1%W^Q7bGm~rzdx8>0IZ`?7yq+nq?~1>g&iYARZco#? zd-f5*Xa;{OB)hUY+|w9Ep+K`1)QUT+j7}({op4w6k7GyY=3Vg4t-IK{vg~>r3UXm} z2zN1BcD6gao`;beMSL0g<^`(guCJ@u_1;qN`!T!X10oe@P3kn2*+Rz+q15?VK#BMn z+HsbQk}$;zVhuDmluDdg5be&M8yD`p&$@DjL@&EU)FM@M+LA`eQYREY3U`UX(+Dg? zE2x2o%2^A~aq}Fna>B@s(Nh@Ccyhce^vL*|a(2}FNL^-^&ar|n895CZgWR~I7l3eI zF|`@rS?DTn+!a^_L7QPtm|$_+;bJqsTiWtgD$=L=YBkhYQ_ZzBY1**-TWFD5YPpr2ccjwpciY1r z_q6A|bmUss?z{ESV^2Nza;CPZ-csW`a<8fJqBe;6*)LwG!5rhs1&{5-1~U*7&mbNL zfw4IaW-hV!GRO^PE(;cg38=9RIE@D}5cE5Xbw0DZkbB9E%zwm9o{^)0?%yCs1KlF` zPi_yWwK7i>oq)zF95Hp;X^`;7I47|jc(&Z7wz{=A+7b$O8ca?Sl!L;3Pr5h!P*1N> zx;4bM#5h*vcvZ>2>*5D>^nsd}>gZbDH|pqF@IF;X4}y0ZZZ4Y{h@8@>QW<}2Jg!ML z=-S5vvZ@C7oMU)bfBN*crso}|cjV`WG~fKb%S&~1WB5WHy(j-?b@bH5hwA9vVE&|z z-a-40I{Hk_b9M9%+IQ5^r-}C>AwNsJXX@yiW$_{*f3NQUMf+b_w3jo);nBh85$we2 zIF6kAWz9G_=;Yo)Zl{Ay`F&UG1j5;$%a-aP?;CY=E${2b@VKF@2SIoIlX22 z8}WeElEa(Md;kCd32;bRa{vG?BLDy{BLR4&KXw2B00(qQO+^Re0}TQaB1hhY*Z=?k zyh%hsR9M5s*TD(HFc3sh=l5dBDP88^65N(gh7^-D5Fu%1B<;~)c(S##?Bji$->p!e z``S{qKVN^Jqr9Y4=`g7B6awe-B@np(&_$5ANDhM3ZB`K|t(HWf_InC}6FLb5Zt}SZ z67lOGNX-BhL2?i&2$TVmM9>lzBN0tWI1R07*qoM6N<$ Ef)$8IX#fBK literal 0 HcmV?d00001 diff --git a/core/src/io/anuke/mindustry/ClientLauncher.java b/core/src/io/anuke/mindustry/ClientLauncher.java index 527eaa3a68..13e4b5cad3 100644 --- a/core/src/io/anuke/mindustry/ClientLauncher.java +++ b/core/src/io/anuke/mindustry/ClientLauncher.java @@ -119,10 +119,11 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform for(ApplicationListener listener : modules){ listener.init(); } - super.resize(graphics.getWidth(), graphics.getHeight()); mods.each(Mod::init); finished = true; Events.fire(new ClientLoadEvent()); + super.resize(graphics.getWidth(), graphics.getHeight()); + app.post(() -> app.post(() -> app.post(() -> app.post(() -> super.resize(graphics.getWidth(), graphics.getHeight()))))); } }else{ super.update(); diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index 130d56d369..45966da459 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -1344,7 +1344,8 @@ public class Blocks implements ContentList{ Items.pyratite, Bullets.pyraFlame ); recoil = 0f; - reload = 4f; + reload = 5f; + coolantMultiplier = 2f; range = 60f; shootCone = 50f; targetAir = false; diff --git a/core/src/io/anuke/mindustry/game/Schematics.java b/core/src/io/anuke/mindustry/game/Schematics.java index 65bb11022f..ea8fbe54cb 100644 --- a/core/src/io/anuke/mindustry/game/Schematics.java +++ b/core/src/io/anuke/mindustry/game/Schematics.java @@ -103,12 +103,12 @@ public class Schematics implements Loadable{ shadowBuffer.endDraw(); - buffer.beginDraw(Color.orange); + buffer.beginDraw(Color.clear); Draw.proj().setOrtho(0, buffer.getHeight(), buffer.getWidth(), -buffer.getHeight()); for(int x = 0; x < schematic.width + padding; x++){ for(int y = 0; y < schematic.height + padding; y++){ - Draw.rect("metal-floor", x * resolution + resolution/2f, y * resolution + resolution/2f, resolution, resolution); + //Draw.rect("metal-floor", x * resolution + resolution/2f, y * resolution + resolution/2f, resolution, resolution); } } diff --git a/core/src/io/anuke/mindustry/ui/dialogs/SchematicsDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/SchematicsDialog.java index eb1f7e32d2..8bb6d4a9f8 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/SchematicsDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/SchematicsDialog.java @@ -1,7 +1,11 @@ package io.anuke.mindustry.ui.dialogs; +import io.anuke.arc.*; import io.anuke.arc.graphics.*; +import io.anuke.arc.graphics.Texture.*; +import io.anuke.arc.graphics.g2d.*; import io.anuke.arc.scene.ui.*; +import io.anuke.arc.scene.ui.layout.*; import io.anuke.arc.util.*; import io.anuke.mindustry.game.*; import io.anuke.mindustry.game.Schematics.*; @@ -17,7 +21,11 @@ public class SchematicsDialog extends FloatingDialog{ public SchematicsDialog(){ super("$schematics"); + Core.assets.load("sprites/schematic-background.png", Texture.class).loaded = t -> { + ((Texture)t).setWrap(TextureWrap.Repeat); + }; + shouldPause = true; addCloseButton(); shown(this::setup); } @@ -49,25 +57,34 @@ public class SchematicsDialog extends FloatingDialog{ for(Schematic s : schematics.all()){ if(!search.isEmpty() && !s.name().contains(search)) continue; - Button sel = t.addButton(b -> { - Texture tex = schematics.getPreview(s, PreviewRes.high); - b.add(s.name()).center().color(Color.lightGray).fillY().get().setEllipsis(true); + Button[] sel = {null}; + sel[0] = t.addButton(b -> { + b.top(); + b.margin(4f); + b.table(buttons -> { + buttons.left(); + buttons.defaults().size(50f); + buttons.addImageButton(Icon.pencilSmall, Styles.clearPartiali, () -> { + + }); + + buttons.addImageButton(Icon.trash16Small, Styles.clearPartiali, () -> { + + }); + + }).growX().height(50f); b.row(); - b.add(new BorderImage(tex){ - @Override - public void draw(){ - //Draw.blend(Blending.disabled); - super.draw(); - //Draw.blend(); - } - }.setScaling(Scaling.fit).setName("border")); + b.add(s.name()).center().color(Color.lightGray).top().left().get().setEllipsis(true); + b.row(); + b.add(new SchematicImage(s).setScaling(Scaling.fit).setName("border")).size(200f); }, () -> { + if(sel[0].childrenPressed()) return; control.input.useSchematic(s); hide(); - }).size(200f, 230f).pad(2).style(Styles.clearPartiali).get(); + }).pad(4).style(Styles.cleari).get(); - BorderImage image = sel.find("border"); - image.update(() -> image.borderColor = (sel.isOver() ? Pal.accent : Pal.gray)); + //BorderImage image = sel[0].find("border"); + //image.update(() -> image.borderColor = (sel[0].isOver() ? Pal.accent : Pal.gray)); if(++i % 4 == 0){ t.row(); @@ -83,6 +100,35 @@ public class SchematicsDialog extends FloatingDialog{ info.show(schematic); } + public static class SchematicImage extends Image{ + public float scaling = 16f; + public float thickness = 4f; + public Color borderColor = Pal.gray; + + public SchematicImage(Schematic s){ + super(schematics.getPreview(s, PreviewRes.high)); + } + + @Override + public void draw(){ + Texture background = Core.assets.get("sprites/schematic-background.png", Texture.class); + TextureRegion region = Draw.wrap(background); + float xr = width / scaling; + float yr = height / scaling; + region.setU2(xr); + region.setV2(yr); + Draw.rect(region, x + width/2f, y + height/2f, width, height); + + super.draw(); + + Draw.color(borderColor); + Draw.alpha(parentAlpha); + Lines.stroke(Scl.scl(thickness)); + Lines.rect(x, y, width, height); + Draw.reset(); + } + } + public static class SchematicInfoDialog extends FloatingDialog{ SchematicInfoDialog(){