mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-12-26 19:29:27 +00:00
Sort scripts alphabetically now
This commit is contained in:
parent
7541cf4a52
commit
71f20dcf1b
@ -28,7 +28,6 @@ import javafx.scene.input.ScrollEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.FillRule;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
import javafx.stage.Stage;
|
||||
import static org.badvision.outlaweditor.Application.currentPlatform;
|
||||
|
@ -225,6 +225,7 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
|
||||
mapWrapAround.setDisable(true);
|
||||
setCurrentEditor(null);
|
||||
} else {
|
||||
sortScripts(m);
|
||||
if (m.getHeight() == null) {
|
||||
m.setHeight(512);
|
||||
}
|
||||
@ -367,6 +368,7 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
|
||||
mapScriptsList.getItems().clear();
|
||||
} else {
|
||||
if (mapScriptsList.getItems() != null && getCurrentMap().getScripts() != null) {
|
||||
sortScripts(getCurrentMap());
|
||||
mapScriptsList.getItems().setAll(getCurrentMap().getScripts().getScript());
|
||||
} else {
|
||||
mapScriptsList.getItems().clear();
|
||||
@ -395,4 +397,15 @@ public class MapEditorTabControllerImpl extends MapEditorTabController {
|
||||
visibilityIcon.setImage(VISIBLE_IMAGE);
|
||||
}
|
||||
}
|
||||
|
||||
private void sortScripts(Map m) {
|
||||
m.getScripts().getScript().sort((a,b)-> {
|
||||
if (a.getName().equalsIgnoreCase("init")) {
|
||||
return -1;
|
||||
} else if (b.getName().equalsIgnoreCase("init")) {
|
||||
return 1;
|
||||
}
|
||||
return a.getName().compareTo(b.getName());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user