//实现TableViewDataSource接口 //初始化/刷新每个格子 public TableViewCell tableCellAtIndex(UIGridView table, TableViewCell cell, int idx) { BagItemTableViewCell itemCell = cell as BagItemTableViewCell; ItemInventory item = null; if (itemCell == null) { itemCell = new BagItemTableViewCell(); item = ItemInventory.Create(m_equipInfos[idx]); itemCell._ItemInventory = item; } else { item = itemCell._ItemInventory; item.Flush(m_equipInfos[idx]); } EventTriggerClick.Get(item.gameObject).onClick = (o) => { SelectItem(table, item, itemCell.Idx); }; if (m_selectIdx == -1 || (m_selectIdx >= 0 && m_selectIdx == idx)) { SelectItem(table, item, idx); } return(itemCell); }