private void AddSelected(int line, UITableLayout.Arrangement orientation) { GameObject[] objs = new GameObject[Selection.gameObjects.Length]; Array.Copy(Selection.gameObjects, objs, objs.Length); Array.Sort(objs, new HVComparer(orientation)); if (orientation == UITableLayout.Arrangement.Horizontal) { for (int c = 0; c < Math.Min(objs.Length, table.maxPerLine); c++) { SetCell(line + c / table.maxPerLine, c % table.maxPerLine, objs[c].GetComponent <UITableCell>()); } } else { for (int r = 0; r < Math.Min(objs.Length, table.maxPerLine); r++) { SetCell(r % table.maxPerLine, line + r / table.maxPerLine, objs[r].GetComponent <UITableCell>()); } } }
public HVComparer(UITableLayout.Arrangement arrangement) { this.arrangement = arrangement; }