public WGTableViewCell getCacheCellsWithIdentifier(int identifier) { int Count = list_CacheCells.Count; for (int i = 0; i < Count; i++) { WGTableViewCell aCell = list_CacheCells[i]; if (aCell.identifier == identifier) { list_CacheCells.RemoveAt(i); return(aCell); } } return(null); }
public void reloadData() { for (int i = 0; i < I_Hang; i++) { if ((i) < csDelegate.NumberOfTableViewCells()) { WGTableViewCell aCell = csDelegate.WGTableViewCellWithIndex(this, i); dic_ScrollCells.Add(i, aCell); aCell.transform.parent = go_ScrollParent.transform; aCell.transform.localScale = Vector3.one; aCell.transform.localPosition = GetPos(i); } } UpdateHeight(false); }
public WGTableViewCell WGTableViewCellWithIndex(WGTableView scrView, int index) { WGTableViewCell cell = scrView.getCacheCellsWithIdentifier(mIdentifier); CShopScrollCell tCell; if (cell == null) { tCell = CShopScrollCell.CreateShopScrollCell(); cell = tCell as WGTableViewCell; cell.identifier = mIdentifier; } else { tCell = cell as CShopScrollCell; } tCell.index = index; tCell.freshShopItem(index, szShopData[index]); return(cell); }
//一切都重置 public void AllReset() { f_Offset = 0; myState = State.Normal; foreach (int key in dic_ScrollCells.Keys) { WGTableViewCell aCell = dic_ScrollCells[key]; list_CacheCells.Add(aCell); aCell.transform.parent = this.transform; aCell.transform.localPosition = new Vector3(1000f, 0, 0); } dic_ScrollCells.Clear(); if (go_ScrollParent != null) { Destroy(go_ScrollParent); go_ScrollParent = null; } createScrollParent(); f_Offset = 0; list_ScrollItem.Clear(); list_ScrollPosRecorder.Clear(); }
// 根据index获得一个cell,在实现的时候,需要通过 scrView.getCacheCellsWithIdentifier(identifier)获取缓存里面的Cell如果没有,在生成一个新的. public WGTableViewCell WGTableViewCellWithIndex(WGTableView scrView, int index) { WGTableViewCell cell = scrView.getCacheCellsWithIdentifier(1); WGTestCell tCell; if (cell == null) { GameObject go = createCell(); tCell = go.GetComponent <WGTestCell>(); cell = tCell as WGTableViewCell; cell.identifier = 1; } else { tCell = cell as WGTestCell; } tCell.index = index; tCell.freshWithIndex(index); return(cell); }
public WGTableViewCell WGTableViewCellWithIndex(WGTableView scrView, int index) { WGTableViewCell cell = scrView.getCacheCellsWithIdentifier(1); CAchievementCell tCell; if (cell == null) { tCell = CAchievementCell.CreateAchievementCell(); cell = tCell as WGTableViewCell; cell.identifier = 1; tCell.curAchViewManager = this; } else { tCell = cell as CAchievementCell; } tCell.index = index; MDAchievement ach; if (index < szReached.Count) { ach = szReached[index]; } else if (index < szReached.Count + szNoReached.Count) { ach = szNoReached[index - szReached.Count]; } else { ach = szHaveGot[index - szReached.Count - szNoReached.Count]; } tCell.freshUIWithData(ach); return(cell); }
// 刷新当前在视图内能展示的Cell 需要调用SQYScrollView.UpdataCells()函数 public void UpdateShowTableViewCells(WGTableViewCell aCell, int index) { }
// 长按一个cell对象 public void HoldTableViewCell(WGTableViewCell aCell, int index) { Debug.Log("holdScrollViewCellAndIndex==" + index); }
// 选择一个cell对象 public void SelectTableViewCell(WGTableViewCell aCell, int index) { Debug.Log("selectScrollViewCellAndIndex==" + index); }
// 刷新当前在视图内能展示的Cell 需要调用SQYScrollView.UpdataCells()函数 public void UpdateShowTableViewCells(WGTableViewCell aCell, int index) { CShopScrollCell tCell = aCell as CShopScrollCell; tCell.freshShopItem(index, szShopData[index]); }