diff --git a/core/assets/sprites/schematic-background.png b/core/assets/sprites/schematic-background.png new file mode 100644 index 0000000000..d0085b65d9 Binary files /dev/null and b/core/assets/sprites/schematic-background.png differ 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(){