mirror of
https://github.com/edgegamers/Jailbreak.git
synced 2025-12-06 04:42:57 -08:00
Improve sorting
This commit is contained in:
@@ -17,17 +17,18 @@ public class BombIconMenu(IServiceProvider provider, BombPerkData data)
|
||||
private int CompareBombIcons(BombIcon a, BombIcon b) {
|
||||
// If the icon is equipped, it should be first
|
||||
if (a == data.Equipped) return -1;
|
||||
if (b == data.Equipped) return 1;
|
||||
|
||||
// If icon is unlocked, it should be next
|
||||
// If both are unlocked, sort by cost (highest first)
|
||||
if (a == data.Unlocked) {
|
||||
if (b == data.Equipped) return 1;
|
||||
return b == data.Unlocked ? a.GetCost().CompareTo(b.GetCost()) : -1;
|
||||
if (data.Unlocked.HasFlag(a)) {
|
||||
if (data.Unlocked.HasFlag(b)) return a.GetCost().CompareTo(b.GetCost());
|
||||
return -1;
|
||||
}
|
||||
|
||||
// If both are locked, sort by cost (lowest first)
|
||||
if (b == data.Equipped) return 1;
|
||||
return b == data.Unlocked ? 1 : a.GetCost().CompareTo(b.GetCost());
|
||||
if (data.Unlocked.HasFlag(b)) return 1;
|
||||
return a.GetCost().CompareTo(b.GetCost());
|
||||
}
|
||||
|
||||
override protected Task<List<BombIcon>> GetItems(PlayerWrapper player) {
|
||||
|
||||
Reference in New Issue
Block a user