More browser cleanup
This commit is contained in:
@@ -44,8 +44,8 @@ be.check = Check for updates
|
|||||||
mod.featured.title = Mod browser
|
mod.featured.title = Mod browser
|
||||||
mod.featured.dialog.title = Mod Browser
|
mod.featured.dialog.title = Mod Browser
|
||||||
mods.browser.selected = Selected mod
|
mods.browser.selected = Selected mod
|
||||||
mods.browser.add = Install Mod
|
mods.browser.add = Install
|
||||||
mods.github.open = Open in Github
|
mods.github.open = View
|
||||||
|
|
||||||
schematic = Schematic
|
schematic = Schematic
|
||||||
schematic.add = Save Schematic...
|
schematic.add = Save Schematic...
|
||||||
|
|||||||
@@ -46,6 +46,19 @@ public class Version{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return whether the version is greater than the specified version string, e.g. "120.1"*/
|
||||||
|
public static boolean isAtLeast(String str){
|
||||||
|
if(build <= 0 || str == null || str.isEmpty()) return true;
|
||||||
|
|
||||||
|
int dot = str.indexOf('.');
|
||||||
|
if(dot != -1){
|
||||||
|
int major = Strings.parseInt(str.substring(0, dot)), minor = Strings.parseInt(str.substring(dot + 1));
|
||||||
|
return build >= major && revision >= minor;
|
||||||
|
}else{
|
||||||
|
return build >= Strings.parseInt(str, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static String buildString(){
|
public static String buildString(){
|
||||||
return build < 0 ? "custom" : build + (revision == 0 ? "" : "." + revision);
|
return build < 0 ? "custom" : build + (revision == 0 ? "" : "." + revision);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package mindustry.mod;
|
|||||||
/** Mod listing as a data class. */
|
/** Mod listing as a data class. */
|
||||||
public class ModListing{
|
public class ModListing{
|
||||||
public String repo, name, author, lastUpdated, description, minGameVersion;
|
public String repo, name, author, lastUpdated, description, minGameVersion;
|
||||||
|
public boolean hasScripts, hasJava;
|
||||||
public int stars;
|
public int stars;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -14,6 +15,8 @@ public class ModListing{
|
|||||||
", lastUpdated='" + lastUpdated + '\'' +
|
", lastUpdated='" + lastUpdated + '\'' +
|
||||||
", description='" + description + '\'' +
|
", description='" + description + '\'' +
|
||||||
", minGameVersion='" + minGameVersion + '\'' +
|
", minGameVersion='" + minGameVersion + '\'' +
|
||||||
|
", hasScripts=" + hasScripts +
|
||||||
|
", hasJava=" + hasJava +
|
||||||
", stars=" + stars +
|
", stars=" + stars +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import arc.struct.*;
|
|||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import arc.util.serialization.*;
|
import arc.util.serialization.*;
|
||||||
|
import mindustry.*;
|
||||||
|
import mindustry.core.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
@@ -165,21 +167,22 @@ public class ModsDialog extends BaseDialog{
|
|||||||
tablebrow.clear();
|
tablebrow.clear();
|
||||||
|
|
||||||
for(ModListing mod : listings){
|
for(ModListing mod : listings){
|
||||||
if(!searchtxt.isEmpty() && !mod.repo.contains(searchtxt)) continue;
|
if(!searchtxt.isEmpty() && !mod.repo.contains(searchtxt) || (Vars.ios && (mod.hasScripts || mod.hasJava))) continue;
|
||||||
|
|
||||||
tablebrow.button(btn -> {
|
tablebrow.button(btn -> {
|
||||||
btn.top().left();
|
btn.top().left();
|
||||||
btn.margin(12f);
|
btn.margin(12f);
|
||||||
btn.table(con -> {
|
btn.table(con -> {
|
||||||
con.left();
|
con.left();
|
||||||
con.add("[lightgray]Name:[] " + mod.name + "\n[lightgray]Author:[] " + mod.author + "\n[accent]\uE809 " + mod.stars)
|
con.add("[accent]" + mod.name + "\n[lightgray]Author:[] " + mod.author + "\n[accent]\uE809 " + mod.stars +
|
||||||
|
(Version.isAtLeast(mod.minGameVersion) ? "" : "\n" + Core.bundle.format("mod.requiresversion", mod.minGameVersion)))
|
||||||
.width(388f).wrap().growX().pad(0f, 6f, 0f, 6f).left().labelAlign(Align.left);
|
.width(388f).wrap().growX().pad(0f, 6f, 0f, 6f).left().labelAlign(Align.left);
|
||||||
con.add().growX().pad(0f, 6f, 0f, 6f);
|
con.add().growX().pad(0f, 6f, 0f, 6f);
|
||||||
}).fillY().growX().pad(0f, 6f, 0f, 6f);
|
}).fillY().growX().pad(0f, 6f, 0f, 6f);
|
||||||
}, Styles.modsb, () -> {
|
}, Styles.modsb, () -> {
|
||||||
var sel = new BaseDialog((Core.bundle.get("mods.browser.selected")) + ": " + mod.name);
|
var sel = new BaseDialog(mod.name);
|
||||||
sel.cont.add(mod.description).width(mobile ? 400f : 500f).wrap().pad(4f).labelAlign(Align.center, Align.left);
|
sel.cont.add(mod.description).width(mobile ? 400f : 500f).wrap().pad(4f).labelAlign(Align.center, Align.left);
|
||||||
sel.buttons.defaults().size(200f, 54f).pad(2f);
|
sel.buttons.defaults().size(150f, 54f).pad(2f);
|
||||||
sel.setFillParent(false);
|
sel.setFillParent(false);
|
||||||
sel.buttons.button("@back", Icon.left, () -> {
|
sel.buttons.button("@back", Icon.left, () -> {
|
||||||
sel.clear();
|
sel.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user