mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 04:23:12 +00:00
Show + retain free space sorting index: gen7 items
Closes #3485 PKHeX has ignored gen7 free space since the initial implementation, if I recall correctly -- no more :)
This commit is contained in:
parent
7c8f52cbbf
commit
703a641b4a
1 changed files with 12 additions and 2 deletions
|
@ -29,6 +29,7 @@ namespace PKHeX.WinForms
|
||||||
Pouches = SAV.Inventory;
|
Pouches = SAV.Inventory;
|
||||||
var item0 = Pouches[0].Items[0];
|
var item0 = Pouches[0].Items[0];
|
||||||
HasFreeSpace = item0 is IItemFreeSpace;
|
HasFreeSpace = item0 is IItemFreeSpace;
|
||||||
|
HasFreeSpaceIndex = item0 is IItemFreeSpaceIndex;
|
||||||
HasFavorite = item0 is IItemFavorite;
|
HasFavorite = item0 is IItemFavorite;
|
||||||
HasNew = item0 is IItemNew;
|
HasNew = item0 is IItemNew;
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@ namespace PKHeX.WinForms
|
||||||
|
|
||||||
private readonly IReadOnlyList<InventoryPouch> Pouches;
|
private readonly IReadOnlyList<InventoryPouch> Pouches;
|
||||||
private readonly bool HasFreeSpace;
|
private readonly bool HasFreeSpace;
|
||||||
|
private readonly bool HasFreeSpaceIndex;
|
||||||
private readonly bool HasFavorite;
|
private readonly bool HasFavorite;
|
||||||
private readonly bool HasNew;
|
private readonly bool HasNew;
|
||||||
|
|
||||||
|
@ -46,6 +48,7 @@ namespace PKHeX.WinForms
|
||||||
private int ColumnItem;
|
private int ColumnItem;
|
||||||
private int ColumnCount;
|
private int ColumnCount;
|
||||||
private int ColumnFreeSpace;
|
private int ColumnFreeSpace;
|
||||||
|
private int ColumnFreeSpaceIndex;
|
||||||
private int ColumnFavorite;
|
private int ColumnFavorite;
|
||||||
private int ColumnNEW;
|
private int ColumnNEW;
|
||||||
|
|
||||||
|
@ -88,13 +91,16 @@ namespace PKHeX.WinForms
|
||||||
var item = GetItemColumn(ColumnItem = dgv.Columns.Count);
|
var item = GetItemColumn(ColumnItem = dgv.Columns.Count);
|
||||||
dgv.Columns.Add(item);
|
dgv.Columns.Add(item);
|
||||||
dgv.Columns.Add(GetCountColumn(pouch, Main.HaX, ColumnCount = dgv.Columns.Count));
|
dgv.Columns.Add(GetCountColumn(pouch, Main.HaX, ColumnCount = dgv.Columns.Count));
|
||||||
if (HasFreeSpace)
|
|
||||||
dgv.Columns.Add(GetCheckColumn(ColumnFreeSpace = dgv.Columns.Count, "Free"));
|
|
||||||
if (HasFavorite)
|
if (HasFavorite)
|
||||||
dgv.Columns.Add(GetCheckColumn(ColumnFavorite = dgv.Columns.Count,"Fav"));
|
dgv.Columns.Add(GetCheckColumn(ColumnFavorite = dgv.Columns.Count,"Fav"));
|
||||||
if (HasNew)
|
if (HasNew)
|
||||||
dgv.Columns.Add(GetCheckColumn(ColumnNEW = dgv.Columns.Count, "New"));
|
dgv.Columns.Add(GetCheckColumn(ColumnNEW = dgv.Columns.Count, "New"));
|
||||||
|
|
||||||
|
if (HasFreeSpace)
|
||||||
|
dgv.Columns.Add(GetCheckColumn(ColumnFreeSpace = dgv.Columns.Count, "Free"));
|
||||||
|
if (HasFreeSpaceIndex)
|
||||||
|
dgv.Columns.Add(GetCountColumn(pouch, true, ColumnFreeSpaceIndex = dgv.Columns.Count, "Free"));
|
||||||
|
|
||||||
// Populate with rows
|
// Populate with rows
|
||||||
var itemarr = Main.HaX ? itemlist : GetStringsForPouch(pouch.LegalItems);
|
var itemarr = Main.HaX ? itemlist : GetStringsForPouch(pouch.LegalItems);
|
||||||
item.Items.AddRange(itemarr);
|
item.Items.AddRange(itemarr);
|
||||||
|
@ -200,6 +206,8 @@ namespace PKHeX.WinForms
|
||||||
|
|
||||||
if (item is IItemFreeSpace f)
|
if (item is IItemFreeSpace f)
|
||||||
cells[ColumnFreeSpace].Value = f.IsFreeSpace;
|
cells[ColumnFreeSpace].Value = f.IsFreeSpace;
|
||||||
|
if (item is IItemFreeSpaceIndex fi)
|
||||||
|
cells[ColumnFreeSpaceIndex].Value = fi.FreeSpaceIndex;
|
||||||
if (item is IItemFavorite v)
|
if (item is IItemFavorite v)
|
||||||
cells[ColumnFavorite].Value = v.IsFavorite;
|
cells[ColumnFavorite].Value = v.IsFavorite;
|
||||||
if (item is IItemNew n)
|
if (item is IItemNew n)
|
||||||
|
@ -229,6 +237,8 @@ namespace PKHeX.WinForms
|
||||||
var item = pouch.GetEmpty(itemindex, itemcnt);
|
var item = pouch.GetEmpty(itemindex, itemcnt);
|
||||||
if (item is IItemFreeSpace f)
|
if (item is IItemFreeSpace f)
|
||||||
f.IsFreeSpace = (bool)cells[ColumnFreeSpace].Value;
|
f.IsFreeSpace = (bool)cells[ColumnFreeSpace].Value;
|
||||||
|
if (item is IItemFreeSpaceIndex fi)
|
||||||
|
fi.FreeSpaceIndex = uint.TryParse(cells[ColumnFreeSpaceIndex].Value?.ToString(), out var fsi) ? fsi : 0;
|
||||||
if (item is IItemFavorite v)
|
if (item is IItemFavorite v)
|
||||||
v.IsFavorite = (bool)cells[ColumnFavorite].Value;
|
v.IsFavorite = (bool)cells[ColumnFavorite].Value;
|
||||||
if (item is IItemNew n)
|
if (item is IItemNew n)
|
||||||
|
|
Loading…
Reference in a new issue