TechWar v1.6.8版本的 MD5 值为:513ba4241f5234b566380e05da0f1813
以下内容为反编译后的 p865521ea.java 源代码,内容仅作参考
package p54109b83.p7d5c009e.pee74e2d6;
import arc.Core;
import arc.Events;
import arc.files.Fi;
import arc.func.Boolf;
import arc.func.Boolp;
import arc.func.Cons;
import arc.func.ConsT;
import arc.func.Floatc;
import arc.func.Floatp;
import arc.func.Func;
import arc.func.Prov;
import arc.graphics.Color;
import arc.graphics.Pixmap;
import arc.graphics.Texture;
import arc.graphics.g2d.TextureAtlas;
import arc.graphics.g2d.TextureRegion;
import arc.input.KeyCode;
import arc.scene.event.ClickListener;
import arc.scene.style.TextureRegionDrawable;
import arc.scene.ui.Button;
import arc.scene.ui.ImageButton;
import arc.scene.ui.Label;
import arc.scene.ui.ScrollPane;
import arc.scene.ui.TextButton;
import arc.scene.ui.Tooltip;
import arc.scene.ui.layout.Cell;
import arc.scene.ui.layout.Scl;
import arc.scene.ui.layout.Table;
import arc.struct.ObjectMap;
import arc.struct.ObjectSet;
import arc.struct.Seq;
import arc.util.ArcRuntimeException;
import arc.util.Http;
import arc.util.Log;
import arc.util.Nullable;
import arc.util.Strings;
import arc.util.Time;
import arc.util.io.Streams;
import arc.util.serialization.Jval;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import mindustry.ctype.UnlockableContent;
import p54109b83.p0cc9cc73.p0cd255f8;
import p54109b83.p0cc9cc73.pf15c1cae;
import p54109b83.p5aee9dbd.p7c3ed04b$pd41d8cd9$pa463fbf7;
import p54109b83.p73b0472d.p1a578e9c;
import p54109b83.p7d5c009e.p4653c3b1;
import p54109b83.p7d5c009e.p4c1c7d94;
import p54109b83.p7d5c009e.pee74e2d6.p865521ea;
import p54109b83.pa74ad8df.p34b6cd75;
import p54109b83.pa74ad8df.p71ff7152$pd41d8cd9$p91056bf3;
import p54109b83.pad148a3c.p198df8d2;
import p54109b83.pad148a3c.pc75a612b;
import p54109b83.pb68187da;
import p54109b83.pc8d46d34.p4b959763;
import p54109b83.pdaffed34.p2abb5076;
import p54109b83.pdaffed34.p81743429;
import p54109b83.pf98ed07a.p222910b5;
public class p865521ea extends p90d3e634 {
private p90d3e634 browser;
private Table browserTable;
private p90d3e634 currentContent;
private float modImportProgress;
@Nullable
private Seq<pc75a612b> modList;
private boolean orderDate;
private float scroll;
private String searchtxt;
private ObjectMap<String, TextureRegion> textureCache;
public p865521ea() {
super("@mods");
this.textureCache = new ObjectMap<>();
this.searchtxt = "";
this.orderDate = true;
this.scroll = 0.0f;
addCloseButton();
p90d3e634 p90d3e634Var = new p90d3e634("@mods.browser");
this.browser = p90d3e634Var;
p90d3e634Var.cont.table(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$new$5((Table) obj);
}
}).fillX().padBottom(4.0f);
this.browser.cont.row();
this.browser.cont.pane(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$new$6((Table) obj);
}
}).scrollX(false);
this.browser.addCloseButton();
this.browser.onResize(new Runnable() {
@Override
public final void run() {
p865521ea.this.rebuildBrowser();
}
});
this.buttons.button("@mods.guide", p81743429.link, new Runnable() {
@Override
public final void run() {
p865521ea.lambda$new$7();
}
}).size(210.0f, 64.0f);
if (!pb68187da.mobile) {
this.buttons.button("@mods.openfolder", p81743429.link, new Runnable() {
@Override
public final void run() {
p865521ea.lambda$new$8();
}
});
}
shown(new Runnable() {
@Override
public final void run() {
p865521ea.this.setup();
}
});
onResize(new Runnable() {
@Override
public final void run() {
p865521ea.this.setup();
}
});
Events.on(p4b959763.p4cb3ff87.class, new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$new$9((p4b959763.p4cb3ff87) obj);
}
});
hidden(new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$new$10();
}
});
}
public void lambda$new$5(Table table) {
table.left();
table.image(p81743429.zoom);
table.field(this.searchtxt, new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$new$0((String) obj);
}
}).growX().get();
table.button(p81743429.list, p4c1c7d94.emptyi, 32.0f, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$new$1();
}
}).update(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$new$2((ImageButton) obj);
}
}).size(40.0f).get().addListener(new Tooltip(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$new$4((Table) obj);
}
}));
}
public void lambda$new$0(String res) {
this.searchtxt = res;
rebuildBrowser();
}
public void lambda$new$1() {
this.orderDate = !this.orderDate;
rebuildBrowser();
}
public void lambda$new$2(ImageButton b) {
b.getStyle().imageUp = this.orderDate ? p81743429.list : p81743429.star;
}
public CharSequence lambda$new$3() {
return this.orderDate ? "@mods.browser.sortdate" : "@mods.browser.sortstars";
}
public void lambda$new$4(Table tip) {
tip.label(new Prov() {
@Override
public final Object get() {
CharSequence lambda$new$3;
lambda$new$3 = p865521ea.this.lambda$new$3();
return lambda$new$3;
}
}).left();
}
public void lambda$new$6(Table tablebrow) {
tablebrow.margin(10.0f).top();
this.browserTable = tablebrow;
}
public static void lambda$new$7() {
Core.app.openURI(pb68187da.modGuideURL);
}
public static void lambda$new$8() {
Core.app.openFolder(pb68187da.modDirectory.absolutePath());
}
public void lambda$new$9(p4b959763.p4cb3ff87 event) {
p90d3e634 p90d3e634Var = this.currentContent;
if (p90d3e634Var != null) {
p90d3e634Var.hide();
this.currentContent = null;
}
}
public void lambda$new$10() {
if (pb68187da.mods.requiresReload()) {
reload();
}
}
public void lambda$importFail$75(Throwable error) {
pb68187da.ui.loadfrag.hide();
if ((error instanceof NoSuchMethodError) || Strings.getCauses(error).contains(new Boolf() {
@Override
public final boolean get(Object obj) {
boolean lambda$modError$11;
lambda$modError$11 = p865521ea.lambda$modError$11((Throwable) obj);
return lambda$modError$11;
}
})) {
pb68187da.ui.showErrorMessage("@feature.unsupported");
} else if (error instanceof Http.HttpStatusException) {
Http.HttpStatusException st = (Http.HttpStatusException) error;
pb68187da.ui.showErrorMessage(Core.bundle.format("connectfail", Strings.capitalize(st.status.toString().toLowerCase())));
} else {
pb68187da.ui.showException(error);
}
}
public static boolean lambda$modError$11(Throwable t) {
return t.getMessage() != null && (t.getMessage().contains("trust anchor") || t.getMessage().contains("SSL") || t.getMessage().contains("protocol"));
}
void getModList(final Cons<Seq<pc75a612b>> cons) {
Seq<pc75a612b> seq = this.modList;
if (seq == null) {
Http.get("https://raw.githubusercontent.com/Anuken/MindustryMods/master/mods.json", new ConsT() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$getModList$15(cons, (Http.HttpResponse) obj);
}
}, new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$getModList$17((Throwable) obj);
}
});
} else {
cons.get(seq);
}
}
public void lambda$getModList$15(final Cons listener, Http.HttpResponse response) throws Exception {
final String strResult = response.getResultAsString();
Core.app.post(new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$getModList$14(strResult, listener);
}
});
}
public void lambda$getModList$14(String strResult, Cons listener) {
try {
this.modList = (Seq) p222910b5.json.fromJson(Seq.class, pc75a612b.class, strResult);
final SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
final Func<String, Date> parser = new Func() {
@Override
public final Object get(Object obj) {
Date lambda$getModList$12;
lambda$getModList$12 = p865521ea.lambda$getModList$12(d, (String) obj);
return lambda$getModList$12;
}
};
this.modList.sortComparing(new Func() {
@Override
public final Object get(Object obj) {
Date lambda$getModList$13;
lambda$getModList$13 = p865521ea.lambda$getModList$13(Func.this, (pc75a612b) obj);
return lambda$getModList$13;
}
}).reverse();
listener.get(this.modList);
} catch (Exception e) {
e.printStackTrace();
pb68187da.ui.showException(e);
}
}
public static Date lambda$getModList$12(SimpleDateFormat d, String text) {
try {
return d.parse(text);
} catch (Exception e) {
return new Date();
}
}
public static Date lambda$getModList$13(Func parser, pc75a612b m) {
return (Date) parser.get(m.lastUpdated);
}
public void lambda$getModList$17(final Throwable error) {
Core.app.post(new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$getModList$16(error);
}
});
}
public void setup() {
final float h = 110.0f;
final float w = Math.min(Core.graphics.getWidth() / Scl.scl(1.05f), 520.0f);
this.cont.clear();
this.cont.defaults().width(Math.min(Core.graphics.getWidth() / Scl.scl(1.05f), 556.0f)).pad(4.0f);
Cell<Label> add = this.cont.add("@mod.reloadrequired");
final p198df8d2 p198df8d2Var = pb68187da.mods;
p198df8d2Var.getClass();
add.visible(new Boolp() {
@Override
public final boolean get() {
return p198df8d2.this.requiresReload();
}
}).center().get().setAlignment(1);
this.cont.row();
this.cont.table(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$setup$24((Table) obj);
}
}).width(w);
this.cont.row();
if (!pb68187da.mods.list().isEmpty()) {
final boolean[] anyDisabled = {false};
final Table[] pane = {null};
final Cons<String> rebuild = new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$setup$35(pane, anyDisabled, h, w, (String) obj);
}
};
if (!pb68187da.mobile || Core.graphics.isPortrait()) {
this.cont.table(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.lambda$setup$36(Cons.this, (Table) obj);
}
}).fillX().padBottom(4.0f);
}
this.cont.row();
this.cont.pane(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.lambda$setup$37(pane, rebuild, (Table) obj);
}
}).scrollX(false).update(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$setup$38((ScrollPane) obj);
}
}).get().setScrollYForce(this.scroll);
} else {
this.cont.table(p4c1c7d94.black6, new Cons() {
@Override
public final void get(Object obj) {
((Table) obj).add("@mods.none");
}
}).height(80.0f);
}
this.cont.row();
}
public void lambda$setup$24(Table buttons) {
buttons.left().defaults().growX().height(60.0f).uniformX();
TextButton.TextButtonStyle style = p4c1c7d94.flatBordert;
buttons.button("@mod.import", p81743429.add, style, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$setup$23();
}
}).margin(12.0f);
buttons.button("@mods.browser", p81743429.menu, style, new Runnable() {
@Override
public final void run() {
p865521ea.this.showModBrowser();
}
}).margin(12.0f);
}
public void lambda$setup$23() {
final p90d3e634 dialog = new p90d3e634("@mod.import");
final TextButton.TextButtonStyle bstyle = p4c1c7d94.flatt;
dialog.cont.table(p2abb5076.button, new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$setup$22(bstyle, dialog, (Table) obj);
}
});
dialog.addCloseButton();
dialog.show();
}
public void lambda$setup$22(TextButton.TextButtonStyle bstyle, final p90d3e634 dialog, Table t) {
t.defaults().size(300.0f, 70.0f);
t.margin(12.0f);
t.button("@mod.import.file", p81743429.file, bstyle, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$setup$19(dialog);
}
}).margin(12.0f);
t.row();
t.button("@mod.import.github", p81743429.github, bstyle, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$setup$21(dialog);
}
}).margin(12.0f);
}
public void lambda$setup$19(p90d3e634 dialog) {
dialog.hide();
pb68187da.platform.showMultiFileChooser(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$setup$18((Fi) obj);
}
}, "zip", "jar");
}
public void lambda$setup$18(Fi file) {
try {
pb68187da.mods.importMod(file);
setup();
} catch (Exception e) {
pb68187da.ui.showException(e);
Log.err(e);
}
}
public void lambda$setup$21(p90d3e634 dialog) {
dialog.hide();
pb68187da.ui.showTextInput("@mod.import.github", "", 64, Core.settings.getString("lastmod", ""), new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$setup$20((String) obj);
}
});
}
public void lambda$setup$20(String text) {
String text2 = text.trim().replace(" ", "");
if (text2.startsWith("https://github.com/")) {
text2 = text2.substring("https://github.com/".length());
}
Core.settings.put("lastmod", text2);
githubImportMod(text2, false, null);
}
public void lambda$setup$35(Table[] pane, boolean[] anyDisabled, final float h, float w, String query) {
pane[0].clear();
boolean any = false;
Iterator<p198df8d2.p0ae2bbc6> it = pb68187da.mods.list().iterator();
while (it.hasNext()) {
final p198df8d2.p0ae2bbc6 item = it.next();
if (Strings.matches(query, item.meta.displayName)) {
any = true;
if (!item.enabled() && !anyDisabled[0] && pb68187da.mods.list().size > 0) {
anyDisabled[0] = true;
pane[0].row();
pane[0].image().growX().height(4.0f).pad(6.0f).color(p1a578e9c.gray).row();
}
pane[0].button(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$setup$33(item, h, (Button) obj);
}
}, p4c1c7d94.flatBordert, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$setup$34(item);
}
}).size(w, h).growX().pad(4.0f);
pane[0].row();
}
}
if (!any) {
pane[0].add("@none.found").color(Color.lightGray).pad(4.0f);
}
}
public void lambda$setup$33(final p198df8d2.p0ae2bbc6 item, final float h, Button t) {
t.top().left();
t.margin(12.0f);
final String stateDetails = getStateDetails(item);
if (stateDetails != null) {
t.addListener(new Tooltip(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.lambda$setup$25(stateDetails, (Table) obj);
}
}));
}
t.defaults().left().top();
t.table(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$setup$27(item, h, (Table) obj);
}
}).growX().growY().left();
t.table(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$setup$32(item, (Table) obj);
}
}).growX().right().padRight(-8.0f).padTop(-8.0f);
}
public static void lambda$setup$25(String stateDetails, Table f) {
f.background(p4c1c7d94.black8).margin(4.0f).add(stateDetails).growX().width(400.0f).wrap();
}
public void lambda$setup$27(final p198df8d2.p0ae2bbc6 item, float h, Table title1) {
title1.left();
title1.add((Table) new p4653c3b1(item) {
final p198df8d2.p0ae2bbc6 val$item;
AnonymousClass1(final p198df8d2.p0ae2bbc6 item2) {
this.val$item = item2;
Texture texture = item2.iconTexture;
if (texture != null) {
setDrawable(new TextureRegion(texture));
} else {
setDrawable(p2abb5076.nomap);
}
border(p1a578e9c.accent);
}
}).size(h - 8.0f).padTop(-8.0f).padLeft(-8.0f).padRight(8.0f);
title1.table(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$setup$26(item2, (Table) obj);
}
}).top().growX();
title1.add().growX();
}
public class AnonymousClass1 extends p4653c3b1 {
final p198df8d2.p0ae2bbc6 val$item;
AnonymousClass1(final p198df8d2.p0ae2bbc6 item2) {
this.val$item = item2;
Texture texture = item2.iconTexture;
if (texture != null) {
setDrawable(new TextureRegion(texture));
} else {
setDrawable(p2abb5076.nomap);
}
border(p1a578e9c.accent);
}
}
public void lambda$setup$26(p198df8d2.p0ae2bbc6 item, Table text) {
String str;
boolean hideDisabled = !item.isSupported() || item.hasUnmetDependencies() || item.hasContentErrors();
String shortDesc = item.meta.shortDescription();
StringBuilder sb = new StringBuilder();
sb.append("[accent]");
sb.append(Strings.stripColors(item.meta.displayName));
sb.append("\n");
String str2 = "";
if (shortDesc.length() > 0) {
str = "[lightgray]" + shortDesc + "\n";
} else {
str = "";
}
sb.append(str);
if (!item.enabled() && !hideDisabled) {
str2 = Core.bundle.get("mod.disabled") + "";
}
sb.append(str2);
text.add(sb.toString()).wrap().top().width(300.0f).growX().left();
text.row();
String state = getStateText(item);
if (state != null) {
text.labelWrap(state).growX().row();
}
}
public void lambda$setup$32(final p198df8d2.p0ae2bbc6 item, Table right) {
right.right();
right.button(item.enabled() ? p81743429.downOpen : p81743429.upOpen, p4c1c7d94.clearNonei, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$setup$28(item);
}
}).size(50.0f).disabled(!item.isSupported());
right.button(item.hasSteamID() ? p81743429.link : p81743429.trash, p4c1c7d94.clearNonei, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$setup$30(item);
}
}).size(50.0f);
if (pb68187da.steam && !item.hasSteamID()) {
right.row();
right.button(p81743429.export, p4c1c7d94.clearNonei, new Runnable() {
@Override
public final void run() {
p865521ea.lambda$setup$31(p198df8d2.p0ae2bbc6.this);
}
}).size(50.0f);
}
}
public void lambda$setup$28(p198df8d2.p0ae2bbc6 item) {
pb68187da.mods.setEnabled(item, !item.enabled());
setup();
}
public void lambda$setup$30(final p198df8d2.p0ae2bbc6 item) {
if (!item.hasSteamID()) {
pb68187da.ui.showConfirm("@confirm", "@mod.remove.confirm", new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$setup$29(item);
}
});
} else {
pb68187da.platform.viewListing(item);
}
}
public void lambda$setup$29(p198df8d2.p0ae2bbc6 item) {
pb68187da.mods.removeMod(item);
setup();
}
public static void lambda$setup$31(p198df8d2.p0ae2bbc6 item) {
pb68187da.platform.publish(item);
}
public static void lambda$setup$36(Cons rebuild, Table search) {
search.image(p81743429.zoom).padRight(8.0f);
search.field("", rebuild).growX();
}
public static void lambda$setup$37(Table[] pane, Cons rebuild, Table table1) {
pane[0] = table1.margin(10.0f).top();
rebuild.get("");
}
public void lambda$setup$38(ScrollPane s) {
this.scroll = s.getScrollY();
}
@Nullable
private String getStateText(p198df8d2.p0ae2bbc6 item) {
if (item.isOutdated()) {
return "@mod.incompatiblemod";
}
if (item.isBlacklisted()) {
return "@mod.blacklisted";
}
if (!item.isSupported()) {
return "@mod.incompatiblegame";
}
p198df8d2.p513f488b p513f488bVar = item.state;
if (p513f488bVar == p198df8d2.p513f488b.circularDependencies) {
return "@mod.circulardependencies";
}
if (p513f488bVar == p198df8d2.p513f488b.incompleteDependencies) {
return "@mod.incompletedependencies";
}
if (item.hasUnmetDependencies()) {
return "@mod.unmetdependencies";
}
if (item.hasContentErrors()) {
return "@mod.erroredcontent";
}
if (item.meta.hidden) {
return "@mod.multiplayer.compatible";
}
return null;
}
@Nullable
private String getStateDetails(p198df8d2.p0ae2bbc6 item) {
if (item.isOutdated()) {
return "@mod.outdatedv7.details";
}
if (item.isBlacklisted()) {
return "@mod.blacklisted.details";
}
if (!item.isSupported()) {
return Core.bundle.format("mod.requiresversion.details", item.meta.minGameVersion);
}
p198df8d2.p513f488b p513f488bVar = item.state;
if (p513f488bVar == p198df8d2.p513f488b.circularDependencies) {
return "@mod.circulardependencies.details";
}
if (p513f488bVar == p198df8d2.p513f488b.incompleteDependencies) {
return Core.bundle.format("mod.incompletedependencies.details", item.missingDependencies.toString(", "));
}
if (item.hasUnmetDependencies()) {
return Core.bundle.format("mod.missingdependencies.details", item.missingDependencies.toString(", "));
}
if (item.hasContentErrors()) {
return "@mod.erroredcontent.details";
}
return null;
}
private void reload() {
pb68187da.ui.showInfoOnHidden("@mods.reloadexit", new Runnable() {
@Override
public final void run() {
p865521ea.lambda$reload$40();
}
});
}
public static void lambda$reload$40() {
Log.info("Exiting to reload mods.");
Core.app.exit();
}
public void lambda$setup$34(final p198df8d2.p0ae2bbc6 mod) {
p90d3e634 dialog = new p90d3e634(mod.meta.displayName);
dialog.addCloseButton();
if (!pb68187da.mobile) {
dialog.buttons.button("@mods.openfolder", p81743429.link, new Runnable() {
@Override
public final void run() {
p865521ea.lambda$showMod$41(p198df8d2.p0ae2bbc6.this);
}
});
}
if (mod.getRepo() != null) {
boolean showImport = !mod.hasSteamID();
dialog.buttons.button("@mods.github.open", p81743429.link, new Runnable() {
@Override
public final void run() {
p865521ea.lambda$showMod$42(p198df8d2.p0ae2bbc6.this);
}
});
if (pb68187da.mobile && showImport) {
dialog.buttons.row();
}
if (showImport) {
dialog.buttons.button("@mods.browser.reinstall", p81743429.download, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$showMod$43(mod);
}
});
}
}
dialog.cont.pane(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$showMod$44(mod, (Table) obj);
}
}).width(400.0f);
final Seq<UnlockableContent> all = Seq.with(pb68187da.content.getContentMap()).flatten().select(new Boolf() {
@Override
public final boolean get(Object obj) {
boolean lambda$showMod$45;
lambda$showMod$45 = p865521ea.lambda$showMod$45(p198df8d2.p0ae2bbc6.this, (pf15c1cae) obj);
return lambda$showMod$45;
}
}).as();
if (all.any()) {
dialog.cont.row();
dialog.cont.button("@mods.viewcontent", p81743429.book, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$showMod$50(mod, all);
}
}).size(300.0f, 50.0f).pad(4.0f);
}
dialog.show();
}
public static void lambda$showMod$41(p198df8d2.p0ae2bbc6 mod) {
Core.app.openFolder(mod.file.absolutePath());
}
public static void lambda$showMod$42(p198df8d2.p0ae2bbc6 mod) {
Core.app.openURI("https://github.com/" + mod.getRepo());
}
public void lambda$showMod$43(p198df8d2.p0ae2bbc6 mod) {
githubImportMod(mod.getRepo(), mod.isJava(), null);
}
public void lambda$showMod$44(p198df8d2.p0ae2bbc6 mod, Table desc) {
desc.center();
desc.defaults().padTop(10.0f).left();
Cell<Label> padRight = desc.add("@editor.name").padRight(10.0f);
Color color = Color.gray;
padRight.color(color).padTop(0.0f);
desc.row();
desc.add(mod.meta.displayName).growX().wrap().padTop(2.0f);
desc.row();
if (mod.meta.author != null) {
desc.add("@editor.author").padRight(10.0f).color(color);
desc.row();
desc.add(mod.meta.author).growX().wrap().padTop(2.0f);
desc.row();
}
if (mod.meta.description != null) {
desc.add("@editor.description").padRight(10.0f).color(color).top();
desc.row();
desc.add(mod.meta.description).growX().wrap().padTop(2.0f);
desc.row();
}
String state = getStateDetails(mod);
if (state != null) {
desc.add("@mod.disabled").padTop(13.0f).padBottom(-6.0f).row();
desc.add(state).growX().wrap().row();
}
}
public static boolean lambda$showMod$45(p198df8d2.p0ae2bbc6 mod, pf15c1cae c) {
if (c.minfo.mod == mod && (c instanceof p0cd255f8)) {
p0cd255f8 u = (p0cd255f8) c;
if (!u.isHidden()) {
return true;
}
}
return false;
}
public void lambda$showMod$50(p198df8d2.p0ae2bbc6 mod, final Seq all) {
p90d3e634 d = new p90d3e634(mod.meta.displayName);
d.cont.pane(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.lambda$showMod$49(Seq.this, (Table) obj);
}
}).grow();
d.addCloseButton();
d.show();
this.currentContent = d;
}
public static void lambda$showMod$49(Seq all, Table cs) {
int i = 0;
Iterator it = all.iterator();
while (it.hasNext()) {
final p0cd255f8 c = (p0cd255f8) it.next();
cs.button(new TextureRegionDrawable(c.uiIcon), p4c1c7d94.flati, 32.0f, new Runnable() {
@Override
public final void run() {
p865521ea.lambda$showMod$46(p0cd255f8.this);
}
}).size(50.0f).with(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.lambda$showMod$48((ImageButton) obj);
}
}).tooltip(c.localizedName);
i++;
if (i % ((int) Math.min(Core.graphics.getWidth() / Scl.scl(110.0f), 14.0f)) == 0) {
cs.row();
}
}
}
public static void lambda$showMod$46(p0cd255f8 c) {
pb68187da.ui.content.show(c);
}
public static void lambda$showMod$48(final ImageButton im) {
final ClickListener click = im.getClickListener();
im.update(new Runnable() {
@Override
public final void run() {
p865521ea.lambda$showMod$47(ImageButton.this, click);
}
});
}
public static void lambda$showMod$47(ImageButton im, ClickListener click) {
im.getImage().color.lerp(!click.isOver() ? Color.lightGray : Color.white, Time.delta * 0.4f);
}
public void showModBrowser() {
rebuildBrowser();
this.browser.show();
}
public void rebuildBrowser() {
final ObjectSet<String> installed = pb68187da.mods.list().map(new Func() {
@Override
public final Object get(Object obj) {
String repo;
repo = ((p198df8d2.p0ae2bbc6) obj).getRepo();
return repo;
}
}).asSet();
this.browserTable.clear();
this.browserTable.add("@loading");
final int cols = (int) Math.max(Core.graphics.getWidth() / Scl.scl(480.0f), 1.0f);
getModList(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$rebuildBrowser$71(installed, cols, (Seq) obj);
}
});
}
public void lambda$rebuildBrowser$71(final ObjectSet installed, int cols, Seq rlistings) {
this.browserTable.clear();
int i = 0;
Seq seq = rlistings;
if (!this.orderDate) {
seq = rlistings.copy();
seq.sortComparing(new Func() {
@Override
public final Object get(Object obj) {
Integer lambda$rebuildBrowser$52;
lambda$rebuildBrowser$52 = p865521ea.lambda$rebuildBrowser$52((pc75a612b) obj);
return lambda$rebuildBrowser$52;
}
});
}
Iterator it = seq.iterator();
while (it.hasNext()) {
final pc75a612b mod = (pc75a612b) it.next();
if ((!mod.hasJava && !mod.hasScripts) || !pb68187da.ios) {
if (Strings.matches(this.searchtxt, mod.name) || Strings.matches(this.searchtxt, mod.repo)) {
if (!p34b6cd75.isAtLeast(135, 10, mod.minGameVersion)) {
final float s = 64.0f;
this.browserTable.button(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$rebuildBrowser$53(mod, installed, s, (Button) obj);
}
}, p4c1c7d94.flatBordert, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$rebuildBrowser$70(mod);
}
}).width(438.0f).pad(4.0f).growX().left().height(16.0f + 64.0f).fillY();
i++;
if (i % cols == 0) {
this.browserTable.row();
}
}
}
}
}
}
public static Integer lambda$rebuildBrowser$52(pc75a612b m1) {
return Integer.valueOf(-m1.stars);
}
public void lambda$rebuildBrowser$53(pc75a612b mod, ObjectSet installed, float s, Button con) {
String str;
con.margin(0.0f);
con.left();
String repo = mod.repo;
con.add((Button) new AnonymousClass2(installed, repo)).size(s).pad(8.0f);
StringBuilder sb = new StringBuilder();
sb.append("[accent]");
String str2 = "";
sb.append(mod.name.replace("\n", ""));
if (installed.contains(mod.repo)) {
str = "\n[lightgray]" + Core.bundle.get("mod.installed");
} else {
str = "";
}
sb.append(str);
sb.append("\n[lightgray]\ue809 ");
sb.append(mod.stars);
if (!p34b6cd75.isAtLeast(mod.minGameVersion)) {
str2 = "\n" + Core.bundle.format("mod.requiresversion", mod.minGameVersion);
}
sb.append(str2);
con.add(sb.toString()).width(358.0f).wrap().grow().pad(4.0f, 2.0f, 4.0f, 6.0f).top().left().labelAlign(10);
}
public class AnonymousClass2 extends p4653c3b1 {
TextureRegion last;
final ObjectSet val$installed;
final String val$repo;
AnonymousClass2(ObjectSet objectSet, String str) {
this.val$installed = objectSet;
this.val$repo = str;
border(objectSet.contains(str) ? p1a578e9c.accent : Color.lightGray);
setDrawable(p2abb5076.nomap);
this.pad = Scl.scl(4.0f);
}
@Override
public void draw() {
super.draw();
if (!p865521ea.this.textureCache.containsKey(this.val$repo)) {
ObjectMap objectMap = p865521ea.this.textureCache;
String str = this.val$repo;
TextureAtlas.AtlasRegion find = Core.atlas.find("nomap");
this.last = find;
objectMap.put(str, find);
String str2 = "https://raw.githubusercontent.com/Anuken/MindustryMods/master/icons/" + this.val$repo.replace("/", "_");
final String str3 = this.val$repo;
Http.get(str2, new ConsT() {
@Override
public final void get(Object obj) {
p865521ea.AnonymousClass2.this.lambda$draw$1(str3, (Http.HttpResponse) obj);
}
}, new Cons() {
@Override
public final void get(Object obj) {
p865521ea.AnonymousClass2.lambda$draw$2((Throwable) obj);
}
});
}
TextureRegion next = (TextureRegion) p865521ea.this.textureCache.get(this.val$repo);
if (this.last != next) {
this.last = next;
setDrawable(next);
}
}
public void lambda$draw$1(final String repo, Http.HttpResponse res) throws Exception {
final Pixmap pix = new Pixmap(res.getResult());
Core.app.post(new Runnable() {
@Override
public final void run() {
p865521ea.AnonymousClass2.this.lambda$draw$0(pix, repo);
}
});
}
public void lambda$draw$0(Pixmap pix, String repo) {
try {
Texture tex = new Texture(pix);
tex.setFilter(Texture.TextureFilter.linear);
p865521ea.this.textureCache.put(repo, new TextureRegion(tex));
pix.dispose();
} catch (Exception e) {
Log.err(e);
}
}
public static void lambda$draw$2(Throwable err) {
}
}
public void lambda$rebuildBrowser$70(final pc75a612b mod) {
final p90d3e634 sel = new p90d3e634(mod.name);
sel.cont.pane(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.lambda$rebuildBrowser$54(pc75a612b.this, (Table) obj);
}
}).grow();
sel.buttons.defaults().size(150.0f, 54.0f).pad(2.0f);
sel.buttons.button("@back", p81743429.left, new Runnable() {
@Override
public final void run() {
p865521ea.lambda$rebuildBrowser$55(p90d3e634.this);
}
});
p198df8d2.p0ae2bbc6 found = pb68187da.mods.list().find(new Boolf() {
@Override
public final boolean get(Object obj) {
boolean lambda$rebuildBrowser$56;
lambda$rebuildBrowser$56 = p865521ea.lambda$rebuildBrowser$56(pc75a612b.this, (p198df8d2.p0ae2bbc6) obj);
return lambda$rebuildBrowser$56;
}
});
sel.buttons.button(found == null ? "@mods.browser.add" : "@mods.browser.reinstall", p81743429.download, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$rebuildBrowser$57(sel, mod);
}
});
if (Core.graphics.isPortrait()) {
sel.buttons.row();
}
sel.buttons.button("@mods.github.open", p81743429.link, new Runnable() {
@Override
public final void run() {
p865521ea.lambda$rebuildBrowser$58(pc75a612b.this);
}
});
sel.buttons.button("@mods.browser.view-releases", p81743429.zoom, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$rebuildBrowser$69(mod, sel);
}
});
KeyCode keyCode = KeyCode.escape;
sel.getClass();
sel.keyDown(keyCode, new p71ff7152$pd41d8cd9$p91056bf3(sel));
KeyCode keyCode2 = KeyCode.back;
sel.getClass();
sel.keyDown(keyCode2, new p71ff7152$pd41d8cd9$p91056bf3(sel));
sel.show();
}
public static void lambda$rebuildBrowser$54(pc75a612b mod, Table p) {
p.add(mod.description + "\n\n[accent]" + Core.bundle.get("editor.author") + "[lightgray] " + mod.author).width(pb68187da.mobile ? 400.0f : 500.0f).wrap().pad(4.0f).labelAlign(1, 8);
}
public static void lambda$rebuildBrowser$55(p90d3e634 sel) {
sel.clear();
sel.hide();
}
public static boolean lambda$rebuildBrowser$56(pc75a612b mod, p198df8d2.p0ae2bbc6 l) {
String str = mod.repo;
return str != null && str.equals(l.getRepo());
}
public void lambda$rebuildBrowser$57(p90d3e634 sel, pc75a612b mod) {
sel.hide();
githubImportMod(mod.repo, mod.hasJava, null);
}
public static void lambda$rebuildBrowser$58(pc75a612b mod) {
Core.app.openURI("https://github.com/" + mod.repo);
}
public void lambda$rebuildBrowser$69(final pc75a612b mod, final p90d3e634 sel) {
final p90d3e634 load = new p90d3e634("");
load.cont.add("[accent]Fetching Releases...");
load.show();
Http.get("https://api.github.com/repos/" + mod.repo + "/releases", new ConsT() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$rebuildBrowser$66(load, sel, mod, (Http.HttpResponse) obj);
}
}, new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$rebuildBrowser$68(load, (Throwable) obj);
}
});
}
public void lambda$rebuildBrowser$66(final p90d3e634 load, final p90d3e634 sel, final pc75a612b mod, Http.HttpResponse res) throws Exception {
Jval json = Jval.read(res.getResultAsString());
final Jval.JsonArray releases = json.asArray();
Core.app.post(new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$rebuildBrowser$65(load, releases, sel, mod);
}
});
}
public void lambda$rebuildBrowser$65(p90d3e634 load, final Jval.JsonArray releases, final p90d3e634 sel, final pc75a612b mod) {
load.hide();
if (releases.size == 0) {
pb68187da.ui.showInfo("@mods.browser.noreleases");
return;
}
sel.hide();
final p90d3e634 downloads = new p90d3e634("@mods.browser.releases");
downloads.cont.pane(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$rebuildBrowser$63(releases, mod, (Table) obj);
}
}).width(500.0f).scrollX(false).fillY();
downloads.buttons.button("@back", p81743429.left, new Runnable() {
@Override
public final void run() {
p865521ea.lambda$rebuildBrowser$64(p90d3e634.this, sel);
}
}).size(150.0f, 54.0f).pad(2.0f);
KeyCode keyCode = KeyCode.escape;
downloads.getClass();
downloads.keyDown(keyCode, new p71ff7152$pd41d8cd9$p91056bf3(downloads));
KeyCode keyCode2 = KeyCode.back;
downloads.getClass();
downloads.keyDown(keyCode2, new p71ff7152$pd41d8cd9$p91056bf3(downloads));
sel.getClass();
downloads.hidden(new p7c3ed04b$pd41d8cd9$pa463fbf7(sel));
downloads.show();
}
public void lambda$rebuildBrowser$63(Jval.JsonArray releases, final pc75a612b mod, Table p) {
for (int j = 0; j < releases.size; j++) {
final Jval release = releases.get(j);
final int index = j;
p.table(((TextureRegionDrawable) p2abb5076.whiteui).tint(p1a578e9c.darkestGray), new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$rebuildBrowser$62(release, index, mod, (Table) obj);
}
}).margin(5.0f).growX().pad(5.0f);
if (j < releases.size - 1) {
p.row();
}
}
}
public void lambda$rebuildBrowser$62(final Jval release, int index, final pc75a612b mod, Table t) {
String str;
StringBuilder sb = new StringBuilder();
sb.append("[accent]");
sb.append(release.getString("name"));
if (index == 0) {
str = " " + Core.bundle.get("mods.browser.latest");
} else {
str = "";
}
sb.append(str);
t.add(sb.toString()).top().left().growX().wrap().pad(5.0f);
t.row();
t.add(release.getString("published_at").substring(0, 10).replaceAll("-", "/")).top().left().growX().wrap().pad(5.0f).color(Color.gray);
t.row();
t.table(new Cons() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$rebuildBrowser$61(release, mod, (Table) obj);
}
}).right();
}
public void lambda$rebuildBrowser$61(final Jval release, final pc75a612b mod, Table b) {
b.defaults().size(150.0f, 54.0f).pad(2.0f);
b.button("@mods.github.open-release", p81743429.link, new Runnable() {
@Override
public final void run() {
p865521ea.lambda$rebuildBrowser$59(Jval.this);
}
});
b.button("@mods.browser.add", p81743429.download, new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$rebuildBrowser$60(release, mod);
}
});
}
public static void lambda$rebuildBrowser$59(Jval release) {
Core.app.openURI(release.getString("html_url"));
}
public void lambda$rebuildBrowser$60(Jval release, pc75a612b mod) {
String releaseUrl = release.getString("url");
githubImportMod(mod.repo, mod.hasJava, releaseUrl.substring(releaseUrl.lastIndexOf("/") + 1));
}
public static void lambda$rebuildBrowser$64(p90d3e634 downloads, p90d3e634 sel) {
downloads.clear();
downloads.hide();
sel.show();
}
public void lambda$rebuildBrowser$68(final p90d3e634 load, final Throwable t) {
Core.app.post(new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$rebuildBrowser$67(t, load);
}
});
}
public void lambda$rebuildBrowser$67(Throwable t, p90d3e634 load) {
lambda$importFail$75(t);
load.hide();
}
public void lambda$githubImportJavaMod$80(String repo, Http.HttpResponse result) {
try {
Fi file = pb68187da.tmpDirectory.child(repo.replace("/", "") + ".zip");
long len = result.getContentLength();
Floatc cons = len <= 0 ? new Floatc() {
@Override
public final void get(float f) {
p865521ea.lambda$handleMod$72(f);
}
} : new Floatc() {
@Override
public final void get(float f) {
p865521ea.this.lambda$handleMod$73(f);
}
};
OutputStream stream = file.write(false);
try {
Streams.copyProgress(result.getResultAsStream(), stream, len, Streams.defaultBufferSize, cons);
if (stream != null) {
stream.close();
}
p198df8d2.p0ae2bbc6 mod = pb68187da.mods.importMod(file);
mod.setRepo(repo);
file.delete();
Core.app.post(new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$handleMod$74();
}
});
} catch (Throwable th) {
if (stream != null) {
try {
stream.close();
} catch (Throwable th2) {
}
}
throw th;
}
} catch (Throwable e) {
lambda$importFail$75(e);
}
}
public static void lambda$handleMod$72(float f) {
}
public void lambda$handleMod$73(float p) {
this.modImportProgress = p;
}
public void lambda$handleMod$74() {
try {
setup();
pb68187da.ui.loadfrag.hide();
} catch (Throwable e) {
pb68187da.ui.showException(e);
}
}
public void importFail(final Throwable t) {
Core.app.post(new Runnable() {
@Override
public final void run() {
p865521ea.this.lambda$importFail$75(t);
}
});
}
public void githubImportMod(String repo, boolean isJava) {
githubImportMod(repo, isJava, null);
}
public void githubImportMod(final String repo, boolean isJava, @Nullable final String release) {
this.modImportProgress = 0.0f;
pb68187da.ui.loadfrag.show("@downloading");
pb68187da.ui.loadfrag.setProgress(new Floatp() {
@Override
public final float get() {
float lambda$githubImportMod$76;
lambda$githubImportMod$76 = p865521ea.this.lambda$githubImportMod$76();
return lambda$githubImportMod$76;
}
});
if (isJava) {
githubImportJavaMod(repo, release);
return;
}
Http.get("https://api.github.com/repos/" + repo, new ConsT() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$githubImportMod$77(repo, release, (Http.HttpResponse) obj);
}
}, new p865521ea$pd41d8cd9$pf4c01451(this));
}
public float lambda$githubImportMod$76() {
return this.modImportProgress;
}
public void lambda$githubImportMod$77(String repo, String release, Http.HttpResponse res) throws Exception {
Jval json = Jval.read(res.getResultAsString());
String mainBranch = json.getString("default_branch");
String language = json.getString("language", "<none>");
if (language.equals("Java") || language.equals("Kotlin")) {
githubImportJavaMod(repo, release);
} else {
githubImportBranch(mainBranch, repo, release);
}
}
private void githubImportJavaMod(final String repo, @Nullable String release) {
StringBuilder sb = new StringBuilder();
sb.append("https://api.github.com/repos/");
sb.append(repo);
sb.append("/releases/");
sb.append(release == null ? "latest" : release);
Http.get(sb.toString(), new ConsT() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$githubImportJavaMod$81(repo, (Http.HttpResponse) obj);
}
}, new p865521ea$pd41d8cd9$pf4c01451(this));
}
public void lambda$githubImportJavaMod$81(final String repo, Http.HttpResponse res) throws Exception {
Jval json = Jval.read(res.getResultAsString());
Jval.JsonArray assets = json.get("assets").asArray();
Jval dexedAsset = assets.find(new Boolf() {
@Override
public final boolean get(Object obj) {
boolean lambda$githubImportJavaMod$78;
lambda$githubImportJavaMod$78 = p865521ea.lambda$githubImportJavaMod$78((Jval) obj);
return lambda$githubImportJavaMod$78;
}
});
Jval asset = dexedAsset == null ? assets.find(new Boolf() {
@Override
public final boolean get(Object obj) {
boolean lambda$githubImportJavaMod$79;
lambda$githubImportJavaMod$79 = p865521ea.lambda$githubImportJavaMod$79((Jval) obj);
return lambda$githubImportJavaMod$79;
}
}) : dexedAsset;
if (asset != null) {
String url = asset.getString("browser_download_url");
Http.get(url, new ConsT() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$githubImportJavaMod$80(repo, (Http.HttpResponse) obj);
}
}, new p865521ea$pd41d8cd9$pf4c01451(this));
return;
}
throw new ArcRuntimeException("No JAR file found in releases. Make sure you have a valid jar file in the mod's latest Github Release.");
}
public static boolean lambda$githubImportJavaMod$78(Jval j) {
return j.getString("name").startsWith("dexed") && j.getString("name").endsWith(".jar");
}
public static boolean lambda$githubImportJavaMod$79(Jval j) {
return j.getString("name").endsWith(".jar");
}
private void githubImportBranch(String branch, final String repo, @Nullable String release) {
if (release != null) {
Http.get("https://api.github.com/repos/" + repo + "/releases/" + release, new ConsT() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$githubImportBranch$84(repo, (Http.HttpResponse) obj);
}
});
return;
}
Http.get("https://api.github.com/repos/" + repo + "/zipball/" + branch, new ConsT() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$githubImportBranch$86(repo, (Http.HttpResponse) obj);
}
}, new p865521ea$pd41d8cd9$pf4c01451(this));
}
public void lambda$githubImportBranch$84(final String repo, Http.HttpResponse res) throws Exception {
String zipUrl = Jval.read(res.getResultAsString()).getString("zipball_url");
Http.get(zipUrl, new ConsT() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$githubImportBranch$83(repo, (Http.HttpResponse) obj);
}
}, new p865521ea$pd41d8cd9$pf4c01451(this));
}
public void lambda$githubImportBranch$83(final String repo, Http.HttpResponse loc) throws Exception {
if (loc.getHeader("Location") != null) {
Http.get(loc.getHeader("Location"), new ConsT() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$githubImportBranch$82(repo, (Http.HttpResponse) obj);
}
}, new p865521ea$pd41d8cd9$pf4c01451(this));
} else {
lambda$githubImportJavaMod$80(repo, loc);
}
}
public void lambda$githubImportBranch$86(final String repo, Http.HttpResponse loc) throws Exception {
if (loc.getHeader("Location") != null) {
Http.get(loc.getHeader("Location"), new ConsT() {
@Override
public final void get(Object obj) {
p865521ea.this.lambda$githubImportBranch$85(repo, (Http.HttpResponse) obj);
}
}, new p865521ea$pd41d8cd9$pf4c01451(this));
} else {
lambda$githubImportJavaMod$80(repo, loc);
}
}
}