public void Spawn(List <BuildingItemData> items, string filter, BuildingMenuSorting sorting) { DestroySpawned(); if (items == null || items.Count == 0) { return; } Filter(items, filter); Spawn(items, sorting); }
public void Spawn(List <BuildingItemData> items, BuildingMenuSorting sorting) { DestroySpawned(); if (items == null || items.Count == 0) { return; } switch (sorting) { case BuildingMenuSorting.NONE: break; case BuildingMenuSorting.ALPHA: var s = from x in items orderby x.Name ascending select x; items = s.ToList(); break; case BuildingMenuSorting.ALPHA_REVERSE: s = from x in items orderby x.Name descending select x; items = s.ToList(); break; case BuildingMenuSorting.RARITY: s = from x in items orderby x.Rarity descending select x; items = s.ToList(); break; case BuildingMenuSorting.RARITY_REVERSE: s = from x in items orderby x.Rarity ascending select x; items = s.ToList(); break; case BuildingMenuSorting.COUNT: s = from x in items orderby x.Count descending select x; items = s.ToList(); break; case BuildingMenuSorting.COUNT_REVERSE: s = from x in items orderby x.Count ascending select x; items = s.ToList(); break; } Spawn(items); }