Schematic search button
This commit is contained in:
@@ -223,6 +223,7 @@ loading = [accent]Loading...
|
|||||||
reloading = [accent]Reloading Mods...
|
reloading = [accent]Reloading Mods...
|
||||||
saving = [accent]Saving...
|
saving = [accent]Saving...
|
||||||
cancelbuilding = [accent][[{0}][] to clear plan
|
cancelbuilding = [accent][[{0}][] to clear plan
|
||||||
|
selectschematic = [accent][[{0}][] to select+copy
|
||||||
pausebuilding = [accent][[{0}][] to pause building
|
pausebuilding = [accent][[{0}][] to pause building
|
||||||
resumebuilding = [scarlet][[{0}][] to resume building
|
resumebuilding = [scarlet][[{0}][] to resume building
|
||||||
wave = [accent]Wave {0}
|
wave = [accent]Wave {0}
|
||||||
@@ -632,6 +633,7 @@ keybind.press.axis = Press an axis or key...
|
|||||||
keybind.screenshot.name = Map Screenshot
|
keybind.screenshot.name = Map Screenshot
|
||||||
keybind.move_x.name = Move x
|
keybind.move_x.name = Move x
|
||||||
keybind.move_y.name = Move y
|
keybind.move_y.name = Move y
|
||||||
|
keybind.schematic.name = Select Region
|
||||||
keybind.schematic_flip_x.name = Flip Schematic X
|
keybind.schematic_flip_x.name = Flip Schematic X
|
||||||
keybind.schematic_flip_y.name = Flip Schematic Y
|
keybind.schematic_flip_y.name = Flip Schematic Y
|
||||||
keybind.fullscreen.name = Toggle Fullscreen
|
keybind.fullscreen.name = Toggle Fullscreen
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ public class DesktopInput extends InputHandler{
|
|||||||
b.label(() -> Core.bundle.format(!player.isBuilding ? "resumebuilding" : "pausebuilding", Core.keybinds.get(Binding.pause_building).key.name())).style(Styles.outlineLabel);
|
b.label(() -> Core.bundle.format(!player.isBuilding ? "resumebuilding" : "pausebuilding", Core.keybinds.get(Binding.pause_building).key.name())).style(Styles.outlineLabel);
|
||||||
b.row();
|
b.row();
|
||||||
b.add(Core.bundle.format("cancelbuilding", Core.keybinds.get(Binding.clear_building).key.name())).style(Styles.outlineLabel);
|
b.add(Core.bundle.format("cancelbuilding", Core.keybinds.get(Binding.clear_building).key.name())).style(Styles.outlineLabel);
|
||||||
|
b.row();
|
||||||
|
b.add(Core.bundle.format("selectschematic", Core.keybinds.get(Binding.schematic).key.name())).style(Styles.outlineLabel);
|
||||||
}).margin(10f);
|
}).margin(10f);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -69,6 +71,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
lastSchematic.tags.put("name", text);
|
lastSchematic.tags.put("name", text);
|
||||||
schematics.add(lastSchematic);
|
schematics.add(lastSchematic);
|
||||||
ui.showInfoFade("$schematic.saved");
|
ui.showInfoFade("$schematic.saved");
|
||||||
|
ui.schematics.showInfo(lastSchematic);
|
||||||
});
|
});
|
||||||
}).colspan(2).size(250f, 50f);
|
}).colspan(2).size(250f, 50f);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
if(request.breaking){
|
if(request.breaking){
|
||||||
drawBreaking(request.x, request.y);
|
drawBreaking(request.x, request.y);
|
||||||
}else{
|
}else{
|
||||||
drawSelected(request.x, request.y, request.tile().block(), Pal.remove);
|
drawSelected(request.x, request.y, request.block, Pal.remove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,15 @@ import io.anuke.arc.scene.ui.*;
|
|||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.game.*;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.game.Schematics.*;
|
import io.anuke.mindustry.game.Schematics.*;
|
||||||
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.ui.*;
|
import io.anuke.mindustry.ui.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class SchematicsDialog extends FloatingDialog{
|
public class SchematicsDialog extends FloatingDialog{
|
||||||
|
private SchematicInfoDialog info = new SchematicInfoDialog();
|
||||||
|
private String search = "";
|
||||||
|
|
||||||
public SchematicsDialog(){
|
public SchematicsDialog(){
|
||||||
super("$schematics");
|
super("$schematics");
|
||||||
@@ -20,37 +23,82 @@ public class SchematicsDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
|
search = "";
|
||||||
|
Runnable[] rebuildPane = {null};
|
||||||
|
|
||||||
|
cont.top();
|
||||||
cont.clear();
|
cont.clear();
|
||||||
|
|
||||||
|
cont.table(s -> {
|
||||||
|
s.left();
|
||||||
|
s.addImage(Icon.zoom).color(Pal.gray);
|
||||||
|
s.addField(search, res -> {
|
||||||
|
search = res;
|
||||||
|
rebuildPane[0].run();
|
||||||
|
}).growX();
|
||||||
|
}).fillX().padBottom(4);
|
||||||
|
|
||||||
|
cont.row();
|
||||||
|
|
||||||
cont.pane(t -> {
|
cont.pane(t -> {
|
||||||
t.top();
|
t.top();
|
||||||
t.margin(20f);
|
t.margin(20f);
|
||||||
int i = 0;
|
rebuildPane[0] = () -> {
|
||||||
for(Schematic s : schematics.all()){
|
t.clear();
|
||||||
Button sel = t.addButton(b -> {
|
int i = 0;
|
||||||
Texture tex = schematics.getPreview(s, PreviewRes.high);
|
for(Schematic s : schematics.all()){
|
||||||
b.add(s.name()).center().color(Color.lightGray).fillY().get().setEllipsis(true);
|
if(!search.isEmpty() && !s.name().contains(search)) continue;
|
||||||
b.row();
|
|
||||||
b.add(new BorderImage(tex){
|
|
||||||
@Override
|
|
||||||
public void draw(){
|
|
||||||
//Draw.blend(Blending.disabled);
|
|
||||||
super.draw();
|
|
||||||
//Draw.blend();
|
|
||||||
}
|
|
||||||
}.setScaling(Scaling.fit).setName("border"));
|
|
||||||
}, () -> {
|
|
||||||
control.input.useSchematic(s);
|
|
||||||
hide();
|
|
||||||
}).size(200f, 230f).pad(2).style(Styles.clearPartiali).get();
|
|
||||||
|
|
||||||
BorderImage image = sel.find("border");
|
Button sel = t.addButton(b -> {
|
||||||
image.update(() -> image.borderColor = (sel.isOver() ? Pal.accent : Pal.gray));
|
Texture tex = schematics.getPreview(s, PreviewRes.high);
|
||||||
|
b.add(s.name()).center().color(Color.lightGray).fillY().get().setEllipsis(true);
|
||||||
|
b.row();
|
||||||
|
b.add(new BorderImage(tex){
|
||||||
|
@Override
|
||||||
|
public void draw(){
|
||||||
|
//Draw.blend(Blending.disabled);
|
||||||
|
super.draw();
|
||||||
|
//Draw.blend();
|
||||||
|
}
|
||||||
|
}.setScaling(Scaling.fit).setName("border"));
|
||||||
|
}, () -> {
|
||||||
|
control.input.useSchematic(s);
|
||||||
|
hide();
|
||||||
|
}).size(200f, 230f).pad(2).style(Styles.clearPartiali).get();
|
||||||
|
|
||||||
if(++i % 4 == 0){
|
BorderImage image = sel.find("border");
|
||||||
t.row();
|
image.update(() -> image.borderColor = (sel.isOver() ? Pal.accent : Pal.gray));
|
||||||
|
|
||||||
|
if(++i % 4 == 0){
|
||||||
|
t.row();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
rebuildPane[0].run();
|
||||||
}).get().setScrollingDisabled(true, false);
|
}).get().setScrollingDisabled(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showInfo(Schematic schematic){
|
||||||
|
info.show(schematic);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SchematicInfoDialog extends FloatingDialog{
|
||||||
|
|
||||||
|
SchematicInfoDialog(){
|
||||||
|
super("");
|
||||||
|
setFillParent(false);
|
||||||
|
addCloseButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show(Schematic schem){
|
||||||
|
cont.clear();
|
||||||
|
title.setText(schem.name());
|
||||||
|
|
||||||
|
cont.add(new BorderImage(schematics.getPreview(schem, PreviewRes.high))).maxSize(400f);
|
||||||
|
cont.row();
|
||||||
|
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=795ded7ccae9aeb15ee480e3b9f6d6af57148ea0
|
archash=3bd01eb4c67d11e36be2bd56f71e6928bf291345
|
||||||
|
|||||||
Reference in New Issue
Block a user