@@ -428,6 +428,7 @@ saveimage = Save Image
|
|||||||
unknown = Unknown
|
unknown = Unknown
|
||||||
custom = Custom
|
custom = Custom
|
||||||
builtin = Built-In
|
builtin = Built-In
|
||||||
|
modded = Modded
|
||||||
map.delete.confirm = Are you sure you want to delete this map? This action cannot be undone!
|
map.delete.confirm = Are you sure you want to delete this map? This action cannot be undone!
|
||||||
map.random = [accent]Random Map
|
map.random = [accent]Random Map
|
||||||
map.nospawn = This map does not have any cores for the player to spawn in! Add a {0} core to this map in the editor.
|
map.nospawn = This map does not have any cores for the player to spawn in! Add a {0} core to this map in the editor.
|
||||||
@@ -488,10 +489,14 @@ editor.center = Center
|
|||||||
editor.search = Search maps...
|
editor.search = Search maps...
|
||||||
editor.filters = Filter Maps
|
editor.filters = Filter Maps
|
||||||
editor.filters.mode = Gamemodes:
|
editor.filters.mode = Gamemodes:
|
||||||
|
editor.filters.priorities = Priorities:
|
||||||
editor.filters.type = Map Type:
|
editor.filters.type = Map Type:
|
||||||
editor.filters.search = Search In:
|
editor.filters.search = Search In:
|
||||||
editor.filters.author = Author
|
editor.filters.author = Author
|
||||||
editor.filters.description = Description
|
editor.filters.description = Description
|
||||||
|
editor.filters.modname = Mod Name
|
||||||
|
editor.filters.prioritizemod = Mod Priority
|
||||||
|
editor.filters.prioritizecustom = Custom Priority
|
||||||
editor.shiftx = Shift X
|
editor.shiftx = Shift X
|
||||||
editor.shifty = Shift Y
|
editor.shifty = Shift Y
|
||||||
workshop = Workshop
|
workshop = Workshop
|
||||||
|
|||||||
@@ -94,7 +94,12 @@ public class Maps{
|
|||||||
|
|
||||||
/** Returns a list of only default maps. */
|
/** Returns a list of only default maps. */
|
||||||
public Seq<Map> defaultMaps(){
|
public Seq<Map> defaultMaps(){
|
||||||
return maps.select(m -> !m.custom);
|
return maps.select(m -> !m.custom && m.mod == null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns a list of only modded maps. */
|
||||||
|
public Seq<Map> moddedMaps(){
|
||||||
|
return maps.select(m -> m.mod != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map byName(String name){
|
public Map byName(String name){
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package mindustry.ui.dialogs;
|
|||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
|
import arc.input.KeyCode;
|
||||||
import arc.scene.style.*;
|
import arc.scene.style.*;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
@@ -27,8 +28,12 @@ public abstract class MapListDialog extends BaseDialog{
|
|||||||
private boolean
|
private boolean
|
||||||
showBuiltIn = Core.settings.getBool("editorshowbuiltinmaps", true),
|
showBuiltIn = Core.settings.getBool("editorshowbuiltinmaps", true),
|
||||||
showCustom = Core.settings.getBool("editorshowcustommaps", true),
|
showCustom = Core.settings.getBool("editorshowcustommaps", true),
|
||||||
|
showModded = Core.settings.getBool("editorshowmoddedmaps", true),
|
||||||
searchAuthor = Core.settings.getBool("editorsearchauthor", false),
|
searchAuthor = Core.settings.getBool("editorsearchauthor", false),
|
||||||
searchDescription = Core.settings.getBool("editorsearchdescription", false),
|
searchDescription = Core.settings.getBool("editorsearchdescription", false),
|
||||||
|
searchModname = Core.settings.getBool("editorsearchmodname", false),
|
||||||
|
prioritizeModded = Core.settings.getBool("editorprioritizemodded", false),
|
||||||
|
prioritizeCustom = Core.settings.getBool("editorprioritizecustom", false),
|
||||||
displayType;
|
displayType;
|
||||||
|
|
||||||
public MapListDialog(String title, boolean displayType){
|
public MapListDialog(String title, boolean displayType){
|
||||||
@@ -88,7 +93,7 @@ public abstract class MapListDialog extends BaseDialog{
|
|||||||
|
|
||||||
cont.add(search).growX();
|
cont.add(search).growX();
|
||||||
cont.row();
|
cont.row();
|
||||||
cont.add(pane).padLeft(28f).uniformX().growY();
|
cont.add(pane).padLeft(28f).uniformX().grow().padBottom(64f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rebuildMaps(){
|
void rebuildMaps(){
|
||||||
@@ -102,11 +107,27 @@ public abstract class MapListDialog extends BaseDialog{
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
Seq<Map> mapList = showCustom ?
|
Seq<Map> mapList = new Seq<>();
|
||||||
showBuiltIn ? maps.all() : maps.customMaps() :
|
|
||||||
showBuiltIn ? maps.defaultMaps() : null;
|
if(showCustom) mapList.addAll(maps.customMaps());
|
||||||
|
if(showBuiltIn) mapList.addAll(maps.defaultMaps());
|
||||||
|
if(showModded) mapList.addAll(maps.moddedMaps());
|
||||||
|
|
||||||
|
mapList = mapList.distinct();
|
||||||
|
|
||||||
if(mapList != null){
|
if(mapList != null){
|
||||||
|
if(prioritizeModded){
|
||||||
|
Seq<Map> ordered = new Seq<>();
|
||||||
|
ordered.addAll(mapList.select(m -> m.mod != null)).sortComparing(m -> m.mod.meta.displayName);
|
||||||
|
ordered.addAll(mapList.select(m -> m.mod == null));
|
||||||
|
mapList = ordered;
|
||||||
|
}
|
||||||
|
if(prioritizeCustom){
|
||||||
|
Seq<Map> ordered = new Seq<>();
|
||||||
|
ordered.addAll(mapList.select(m -> m.custom)).sortComparing(m -> m.plainName());
|
||||||
|
ordered.addAll(mapList.select(m -> !m.custom));
|
||||||
|
mapList = ordered;
|
||||||
|
}
|
||||||
for(Map map : mapList){
|
for(Map map : mapList){
|
||||||
|
|
||||||
boolean invalid = false;
|
boolean invalid = false;
|
||||||
@@ -116,7 +137,8 @@ public abstract class MapListDialog extends BaseDialog{
|
|||||||
if(invalid || (searchString != null
|
if(invalid || (searchString != null
|
||||||
&& !map.plainName().toLowerCase().contains(searchString)
|
&& !map.plainName().toLowerCase().contains(searchString)
|
||||||
&& (!searchAuthor || !map.plainAuthor().toLowerCase().contains(searchString))
|
&& (!searchAuthor || !map.plainAuthor().toLowerCase().contains(searchString))
|
||||||
&& (!searchDescription || !map.plainDescription().toLowerCase().contains(searchString)))){
|
&& (!searchDescription || !map.plainDescription().toLowerCase().contains(searchString))
|
||||||
|
&& (!searchModname || !(map.mod == null ? "" : Strings.stripColors(map.mod.meta.displayName).toLowerCase()).contains(searchString)))){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,29 +191,63 @@ public abstract class MapListDialog extends BaseDialog{
|
|||||||
activeDialog = new BaseDialog("@editor.filters");
|
activeDialog = new BaseDialog("@editor.filters");
|
||||||
activeDialog.addCloseButton();
|
activeDialog.addCloseButton();
|
||||||
activeDialog.cont.table(menu -> {
|
activeDialog.cont.table(menu -> {
|
||||||
menu.add("@editor.filters.mode").width(150f).left();
|
menu.table(tab -> {
|
||||||
menu.table(t -> {
|
// Gamemodes
|
||||||
for(Gamemode mode : Gamemode.all){
|
tab.table(t -> {
|
||||||
TextureRegionDrawable icon = Vars.ui.getIcon("mode" + Strings.capitalize(mode.name()));
|
t.add("@editor.filters.mode").padBottom(6f).row();
|
||||||
if(Core.atlas.isFound(icon.getRegion())){
|
t.table(Tex.button, left -> {
|
||||||
t.button(icon, Styles.emptyTogglei, () -> {
|
for(Gamemode mode : Gamemode.all){
|
||||||
if(modes.contains(mode)){
|
TextureRegionDrawable icon = Vars.ui.getIcon("mode" + Strings.capitalize(mode.name()));
|
||||||
modes.remove(mode);
|
if(Core.atlas.isFound(icon.getRegion())){
|
||||||
}else{
|
left.button(icon, Styles.emptyTogglei, () -> {
|
||||||
modes.add(mode);
|
if(modes.contains(mode)){
|
||||||
|
modes.remove(mode);
|
||||||
|
}else{
|
||||||
|
modes.add(mode);
|
||||||
|
}
|
||||||
|
rebuildMaps();
|
||||||
|
}).left().size(60f).checked(modes.contains(mode)).tooltip("@mode." + mode.name() + ".name");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).pad(5f);
|
||||||
|
tab.add().width(60f);
|
||||||
|
// Priorities
|
||||||
|
tab.table(t -> {
|
||||||
|
t.add("@editor.filters.priorities").padBottom(6f).row();
|
||||||
|
t.table(Tex.button, right ->{
|
||||||
|
right.button(ui.getIcon("players"), Styles.emptyTogglei, () -> {
|
||||||
|
prioritizeCustom = !prioritizeCustom;
|
||||||
|
if(prioritizeModded){
|
||||||
|
prioritizeModded = false;
|
||||||
|
Core.settings.put("editorprioritizemodded", false);
|
||||||
|
}
|
||||||
|
Core.settings.put("editorprioritizecustom", prioritizeCustom);
|
||||||
rebuildMaps();
|
rebuildMaps();
|
||||||
}).size(60f).checked(modes.contains(mode)).tooltip("@mode." + mode.name() + ".name");
|
}).size(60f).checked(b-> showCustom && prioritizeCustom).tooltip("@editor.filters.prioritizecustom").disabled(b -> !showCustom);
|
||||||
}
|
right.button(ui.getIcon("hammer"), Styles.emptyTogglei, () -> {
|
||||||
}
|
prioritizeModded = !prioritizeModded;
|
||||||
|
if(prioritizeCustom){
|
||||||
|
prioritizeCustom = false;
|
||||||
|
Core.settings.put("editorprioritizecustom", false);
|
||||||
|
}
|
||||||
|
Core.settings.put("editorprioritizemodded", prioritizeModded);
|
||||||
|
rebuildMaps();
|
||||||
|
}).size(60f).checked(b-> showModded && prioritizeModded).tooltip("@editor.filters.prioritizemod").disabled(b -> !showModded);
|
||||||
|
});
|
||||||
|
}).expandX().pad(5f);
|
||||||
}).padBottom(10f);
|
}).padBottom(10f);
|
||||||
menu.row();
|
menu.row();
|
||||||
|
|
||||||
menu.add("@editor.filters.type").width(150f).left();
|
menu.add("@editor.filters.type").width(120f).left().row();
|
||||||
menu.table(Tex.button, t -> {
|
menu.table(Tex.button, t -> {
|
||||||
t.button("@custom", Styles.flatTogglet, () -> {
|
t.button("@custom", Styles.flatTogglet, () -> {
|
||||||
showCustom = !showCustom;
|
showCustom = !showCustom;
|
||||||
Core.settings.put("editorshowcustommaps", showCustom);
|
Core.settings.put("editorshowcustommaps", showCustom);
|
||||||
|
if(!showCustom){
|
||||||
|
prioritizeCustom = false;
|
||||||
|
Core.settings.put("editorprioritizecustom", false);
|
||||||
|
}
|
||||||
rebuildMaps();
|
rebuildMaps();
|
||||||
}).size(150f, 60f).checked(showCustom);
|
}).size(150f, 60f).checked(showCustom);
|
||||||
t.button("@builtin", Styles.flatTogglet, () -> {
|
t.button("@builtin", Styles.flatTogglet, () -> {
|
||||||
@@ -199,10 +255,18 @@ public abstract class MapListDialog extends BaseDialog{
|
|||||||
Core.settings.put("editorshowbuiltinmaps", showBuiltIn);
|
Core.settings.put("editorshowbuiltinmaps", showBuiltIn);
|
||||||
rebuildMaps();
|
rebuildMaps();
|
||||||
}).size(150f, 60f).checked(showBuiltIn);
|
}).size(150f, 60f).checked(showBuiltIn);
|
||||||
|
t.button("@modded", Styles.flatTogglet, () -> {
|
||||||
|
showModded = !showModded;
|
||||||
|
Core.settings.put("editorshowmoddedmaps", showModded);
|
||||||
|
if(!showModded){
|
||||||
|
prioritizeModded = false;
|
||||||
|
Core.settings.put("editorprioritizemodded", false);
|
||||||
|
}
|
||||||
|
rebuildMaps();
|
||||||
|
}).size(150f, 60f).checked(showModded);
|
||||||
}).padBottom(10f);
|
}).padBottom(10f);
|
||||||
menu.row();
|
menu.row();
|
||||||
|
menu.add("@editor.filters.search").width(120f).left().row();
|
||||||
menu.add("@editor.filters.search").width(150f).left();
|
|
||||||
menu.table(Tex.button, t -> {
|
menu.table(Tex.button, t -> {
|
||||||
t.button("@editor.filters.author", Styles.flatTogglet, () -> {
|
t.button("@editor.filters.author", Styles.flatTogglet, () -> {
|
||||||
searchAuthor = !searchAuthor;
|
searchAuthor = !searchAuthor;
|
||||||
@@ -214,6 +278,11 @@ public abstract class MapListDialog extends BaseDialog{
|
|||||||
Core.settings.put("editorsearchdescription", searchDescription);
|
Core.settings.put("editorsearchdescription", searchDescription);
|
||||||
rebuildMaps();
|
rebuildMaps();
|
||||||
}).size(150f, 60f).checked(searchDescription);
|
}).size(150f, 60f).checked(searchDescription);
|
||||||
|
t.button("@editor.filters.modname", Styles.flatTogglet, () -> {
|
||||||
|
searchModname = !searchModname;
|
||||||
|
Core.settings.put("editorsearchmodname", searchModname);
|
||||||
|
rebuildMaps();
|
||||||
|
}).size(150f, 60f).checked(searchModname);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user