GUI: improved choose creature type dialog - important creature types added to the start of the list and marked as my/opponent (closes #8478)

This commit is contained in:
Oleg Agafonov 2024-07-19 03:17:53 +04:00
parent 7b2e9b390c
commit a974af3c61
41 changed files with 239 additions and 138 deletions

View file

@ -105,12 +105,17 @@ public class PickChoiceDialog extends MageDialog {
}
}
// sorting
// custom sorting
if (choice.isSortEnabled()) {
this.allItems.sort((o1, o2) -> {
Integer n1 = choice.getSortData().get(o1.getKey());
Integer n2 = choice.getSortData().get(o2.getKey());
return Integer.compare(n1, n2);
if (n1.equals(n2)) {
// default sorting by value
return o1.value.compareTo(o2.value);
} else {
return Integer.compare(n1, n2);
}
});
}