merge
This commit is contained in:
@@ -15,8 +15,8 @@ import mindustry.ui.Links.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class AboutDialog extends BaseDialog{
|
||||
private Seq<String> contributors = new Seq<>();
|
||||
private static ObjectSet<String> bannedItems = ObjectSet.with("google-play", "itch.io", "dev-builds", "f-droid");
|
||||
Seq<String> contributors = new Seq<>();
|
||||
static ObjectSet<String> bannedItems = ObjectSet.with("google-play", "itch.io", "dev-builds", "f-droid");
|
||||
|
||||
public AboutDialog(){
|
||||
super("@about.button");
|
||||
|
||||
@@ -8,7 +8,7 @@ import mindustry.graphics.*;
|
||||
|
||||
public class ColorPicker extends BaseDialog{
|
||||
private Cons<Color> cons = c -> {};
|
||||
private Color current = new Color();
|
||||
Color current = new Color();
|
||||
|
||||
public ColorPicker(){
|
||||
super("@pickcolor");
|
||||
|
||||
@@ -20,7 +20,7 @@ import static mindustry.Vars.*;
|
||||
|
||||
public class CustomRulesDialog extends BaseDialog{
|
||||
private Table main;
|
||||
private Rules rules;
|
||||
Rules rules;
|
||||
private Prov<Rules> resetter;
|
||||
private LoadoutDialog loadoutDialog;
|
||||
private BaseDialog banDialog;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class DatabaseDialog extends BaseDialog{
|
||||
for(int i = 0; i < array.size; i++){
|
||||
UnlockableContent unlock = (UnlockableContent)array.get(i);
|
||||
|
||||
Image image = unlocked(unlock) ? new Image(unlock.icon(Cicon.medium)) : new Image(Icon.lockOpen, Pal.gray);
|
||||
Image image = unlocked(unlock) ? new Image(unlock.icon(Cicon.medium)) : new Image(Icon.lock, Pal.gray);
|
||||
list.add(image).size(8*4).pad(3);
|
||||
ClickListener listener = new ClickListener();
|
||||
image.addListener(listener);
|
||||
|
||||
@@ -17,10 +17,10 @@ import java.util.*;
|
||||
|
||||
public class FileChooser extends BaseDialog{
|
||||
private static final Fi homeDirectory = Core.files.absolute(Core.files.getExternalStoragePath());
|
||||
private static Fi lastDirectory = homeDirectory;
|
||||
static Fi lastDirectory = homeDirectory;
|
||||
|
||||
private Table files;
|
||||
private Fi directory = lastDirectory;
|
||||
Fi directory = lastDirectory;
|
||||
private ScrollPane pane;
|
||||
private TextField navigation, filefield;
|
||||
private TextButton ok;
|
||||
@@ -163,7 +163,7 @@ public class FileChooser extends BaseDialog{
|
||||
return handles;
|
||||
}
|
||||
|
||||
private void updateFiles(boolean push){
|
||||
void updateFiles(boolean push){
|
||||
if(push) stack.push(directory);
|
||||
navigation.setText(directory.toString());
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.ui.dialogs;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.input.*;
|
||||
import arc.math.*;
|
||||
import arc.scene.ui.*;
|
||||
@@ -233,6 +234,10 @@ public class JoinDialog extends BaseDialog{
|
||||
t.add("[lightgray]" + (Core.bundle.format("players" + (host.players == 1 && host.playerLimit <= 0 ? ".single" : ""), (host.players == 0 ? "[lightgray]" : "[accent]") + host.players + (host.playerLimit > 0 ? "[lightgray]/[accent]" + host.playerLimit : "")+ "[lightgray]"))).left();
|
||||
t.row();
|
||||
t.add("[lightgray]" + Core.bundle.format("save.map", host.mapname) + "[lightgray] / " + (host.modeName == null ? host.mode.toString() : host.modeName)).width(targetWidth() - 10f).left().get().setEllipsis(true);
|
||||
if(host.ping > 0){
|
||||
t.row();
|
||||
t.add(Iconc.chartBar + " " + host.ping + "ms").color(Color.gray).left();
|
||||
}
|
||||
}).expand().left().bottom().padLeft(12f).padBottom(8);
|
||||
}
|
||||
|
||||
@@ -434,9 +439,13 @@ public class JoinDialog extends BaseDialog{
|
||||
defaultServers.clear();
|
||||
val.asArray().each(child -> defaultServers.add(child.getString("address", "<invalid>")));
|
||||
Log.info("Fetched @ global servers.", defaultServers.size);
|
||||
}catch(Throwable ignored){}
|
||||
}catch(Throwable ignored){
|
||||
Log.err("Failed to parse community servers.");
|
||||
}
|
||||
});
|
||||
}catch(Throwable ignored){}
|
||||
}catch(Throwable e){
|
||||
Log.err("Failed to fetch community servers.");
|
||||
}
|
||||
}, t -> {});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.ui.dialogs;
|
||||
import arc.*;
|
||||
import arc.Net.*;
|
||||
import arc.files.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.scene.ui.TextButton.*;
|
||||
@@ -106,31 +107,13 @@ public class ModsDialog extends BaseDialog{
|
||||
Core.settings.put("lastmod", text);
|
||||
|
||||
ui.loadfrag.show();
|
||||
Core.net.httpGet("http://api.github.com/repos/" + text + "/zipball/master", loc -> {
|
||||
Core.net.httpGet(loc.getHeader("Location"), result -> {
|
||||
if(result.getStatus() != HttpStatus.OK){
|
||||
ui.showErrorMessage(Core.bundle.format("connectfail", result.getStatus()));
|
||||
ui.loadfrag.hide();
|
||||
}else{
|
||||
try{
|
||||
Fi file = tmpDirectory.child(text.replace("/", "") + ".zip");
|
||||
Streams.copy(result.getResultAsStream(), file.write(false));
|
||||
mods.importMod(file);
|
||||
file.delete();
|
||||
Core.app.post(() -> {
|
||||
try{
|
||||
setup();
|
||||
ui.loadfrag.hide();
|
||||
}catch(Throwable e){
|
||||
ui.showException(e);
|
||||
}
|
||||
});
|
||||
}catch(Throwable e){
|
||||
modError(e);
|
||||
}
|
||||
}
|
||||
}, t2 -> Core.app.post(() -> modError(t2)));
|
||||
}, t2 -> Core.app.post(() -> modError(t2)));
|
||||
// Try to download the 6.0 branch first, but if it doesnt exist try master.
|
||||
githubImport("6.0", text, e1 -> {
|
||||
githubImport("master", text, e2 -> {
|
||||
ui.showErrorMessage(Core.bundle.format("connectfail", e2));
|
||||
ui.loadfrag.hide();
|
||||
});
|
||||
});
|
||||
});
|
||||
}).margin(12f);
|
||||
});
|
||||
@@ -178,8 +161,22 @@ public class ModsDialog extends BaseDialog{
|
||||
border(Pal.accent);
|
||||
}}).size(h - 8f).padTop(-8f).padLeft(-8f).padRight(8f);
|
||||
|
||||
title.add("" + mod.meta.displayName() + "\n[lightgray]v" + mod.meta.version + (mod.enabled() ? "" : "\n" + Core.bundle.get("mod.disabled") + ""))
|
||||
.wrap().top().width(170f).growX().left();
|
||||
title.table(text -> {
|
||||
text.add("" + mod.meta.displayName() + "\n[lightgray]v" + mod.meta.version + (mod.enabled() ? "" : "\n" + Core.bundle.get("mod.disabled") + ""))
|
||||
.wrap().top().width(300f).growX().left();
|
||||
|
||||
text.row();
|
||||
if(!mod.isSupported()){
|
||||
text.labelWrap(Core.bundle.format("mod.requiresversion", mod.meta.minGameVersion)).growX();
|
||||
text.row();
|
||||
}else if(mod.hasUnmetDependencies()){
|
||||
text.labelWrap(Core.bundle.format("mod.missingdependencies", mod.missingDependencies.toString(", "))).growX();
|
||||
t.row();
|
||||
}else if(mod.hasContentErrors()){
|
||||
text.labelWrap("@mod.erroredcontent").growX();
|
||||
text.row();
|
||||
}
|
||||
}).top().growX();
|
||||
|
||||
title.add().growX();
|
||||
}).growX().growY().left();
|
||||
@@ -210,17 +207,7 @@ public class ModsDialog extends BaseDialog{
|
||||
}
|
||||
}).growX().right().padRight(-8f).padTop(-8f);
|
||||
|
||||
t.row();
|
||||
if(!mod.isSupported()){
|
||||
t.labelWrap(Core.bundle.format("mod.requiresversion", mod.meta.minGameVersion)).growX();
|
||||
t.row();
|
||||
}else if(mod.hasUnmetDependencies()){
|
||||
t.labelWrap(Core.bundle.format("mod.missingdependencies", mod.missingDependencies.toString(", "))).growX();
|
||||
t.row();
|
||||
}else if(mod.hasContentErrors()){
|
||||
t.labelWrap("@mod.erroredcontent").growX();
|
||||
t.row();
|
||||
}
|
||||
|
||||
}, Styles.clearPartialt, () -> showMod(mod)).size(w, h).growX().pad(4f);
|
||||
table.row();
|
||||
}
|
||||
@@ -288,8 +275,33 @@ public class ModsDialog extends BaseDialog{
|
||||
}*/
|
||||
}).width(400f);
|
||||
|
||||
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void githubImport(String branch, String repo, Cons<HttpStatus> err){
|
||||
Core.net.httpGet("http://api.github.com/repos/" + repo + "/zipball/" + branch, loc -> {
|
||||
Core.net.httpGet(loc.getHeader("Location"), result -> {
|
||||
if(result.getStatus() != HttpStatus.OK){
|
||||
err.get(result.getStatus());
|
||||
}else{
|
||||
try{
|
||||
Fi file = tmpDirectory.child(repo.replace("/", "") + ".zip");
|
||||
Streams.copy(result.getResultAsStream(), file.write(false));
|
||||
mods.importMod(file);
|
||||
file.delete();
|
||||
Core.app.post(() -> {
|
||||
try{
|
||||
setup();
|
||||
ui.loadfrag.hide();
|
||||
}catch(Throwable e){
|
||||
ui.showException(e);
|
||||
}
|
||||
});
|
||||
}catch(Throwable e){
|
||||
modError(e);
|
||||
}
|
||||
}
|
||||
}, t2 -> Core.app.post(() -> modError(t2)));
|
||||
}, t2 -> Core.app.post(() -> modError(t2)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,16 +44,7 @@ public class PausedDialog extends BaseDialog{
|
||||
float dw = 220f;
|
||||
cont.defaults().width(dw).height(55).pad(5f);
|
||||
|
||||
cont.button("@back", Icon.left, this::hide).colspan(2).width(dw * 2 + 20f);
|
||||
|
||||
cont.row();
|
||||
//if(state.isCampaign()){
|
||||
// cont.button("@techtree", Icon.tree, ui.tech::show);
|
||||
//}else{
|
||||
// cont.button("@database", Icon.book, ui.database::show);
|
||||
//}
|
||||
//TODO remove
|
||||
cont.button("nothing", Icon.warning, () -> ui.showInfo("no"));
|
||||
cont.button("@back", Icon.left, this::hide);
|
||||
cont.button("@settings", Icon.settings, ui.settings::show);
|
||||
|
||||
if(!state.rules.tutorial){
|
||||
@@ -93,6 +84,18 @@ public class PausedDialog extends BaseDialog{
|
||||
cont.row();
|
||||
|
||||
cont.buttonRow("@load", Icon.download, load::show).disabled(b -> net.active());
|
||||
}else if(state.isCampaign()){
|
||||
cont.buttonRow("@launchcore", Icon.up, () -> {
|
||||
hide();
|
||||
ui.planet.show(state.getSector(), player.team().core());
|
||||
}).disabled(b -> player.team().core() == null || !player.team().core().items.has(player.team().core().block.requirements));
|
||||
|
||||
cont.row();
|
||||
|
||||
cont.buttonRow("@planetmap", Icon.map, () -> {
|
||||
hide();
|
||||
ui.planet.show();
|
||||
});
|
||||
}else{
|
||||
cont.row();
|
||||
}
|
||||
|
||||
@@ -30,15 +30,15 @@ import static mindustry.ui.dialogs.PlanetDialog.Mode.*;
|
||||
|
||||
public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
private final FrameBuffer buffer = new FrameBuffer(2, 2, true);
|
||||
private final PlanetRenderer planets = renderer.planets;
|
||||
final PlanetRenderer planets = renderer.planets;
|
||||
private final LaunchLoadoutDialog loadouts = new LaunchLoadoutDialog();
|
||||
private final Table stable = new Table().background(Styles.black3);
|
||||
|
||||
private int launchRange;
|
||||
private float zoom = 1f, selectAlpha = 1f;
|
||||
private @Nullable Sector selected, hovered, launchSector;
|
||||
@Nullable Sector selected, hovered, launchSector;
|
||||
private CoreBuild launcher;
|
||||
private Mode mode = look;
|
||||
Mode mode = look;
|
||||
private boolean launching;
|
||||
|
||||
public PlanetDialog(){
|
||||
@@ -291,7 +291,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
}
|
||||
|
||||
//TODO localize
|
||||
private void updateSelected(){
|
||||
void updateSelected(){
|
||||
Sector sector = selected;
|
||||
|
||||
if(sector == null){
|
||||
|
||||
@@ -32,14 +32,14 @@ import java.util.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class ResearchDialog extends BaseDialog{
|
||||
private final float nodeSize = Scl.scl(60f);
|
||||
private ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
|
||||
private TechTreeNode root = new TechTreeNode(TechTree.root, null);
|
||||
private Rect bounds = new Rect();
|
||||
private ItemsDisplay itemDisplay;
|
||||
private View view;
|
||||
final float nodeSize = Scl.scl(60f);
|
||||
ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
|
||||
TechTreeNode root = new TechTreeNode(TechTree.root, null);
|
||||
Rect bounds = new Rect();
|
||||
ItemsDisplay itemDisplay;
|
||||
View view;
|
||||
|
||||
private ItemSeq items;
|
||||
ItemSeq items;
|
||||
|
||||
public ResearchDialog(){
|
||||
super("");
|
||||
@@ -134,7 +134,7 @@ public class ResearchDialog extends BaseDialog{
|
||||
}
|
||||
});
|
||||
|
||||
addListener(new ElementGestureListener(){
|
||||
view.addListener(new ElementGestureListener(){
|
||||
@Override
|
||||
public void zoom(InputEvent event, float initialDistance, float distance){
|
||||
if(view.lastZoom < 0){
|
||||
@@ -233,7 +233,7 @@ public class ResearchDialog extends BaseDialog{
|
||||
}
|
||||
|
||||
boolean selectable(TechNode node){
|
||||
return !node.objectives.contains(i -> !i.complete());
|
||||
return node.content.unlocked() || !node.objectives.contains(i -> !i.complete());
|
||||
}
|
||||
|
||||
void showToast(String info){
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SchematicsDialog extends BaseDialog{
|
||||
|
||||
t.clear();
|
||||
int i = 0;
|
||||
String regex = "[`~!@#$%^&*()-_=+[{]}|;:'\",<.>/?]";
|
||||
String regex = "[`~!@#$%^&*()-_=+{}|;:'\",<.>/?]";
|
||||
String searchString = search.toLowerCase().replaceAll(regex, " ");
|
||||
|
||||
firstSchematic = null;
|
||||
|
||||
Reference in New Issue
Block a user