public int removeChild(ScrollRectItem item) { int i = getIndex(item); if (i >= 0) { doDataRemove(this.data, i + 1); this.CalcPage(); } return(i); }
public int getIndex(ScrollRectItem item) { int i = this.repositionTileList.IndexOf(item); int j = -1; if (i >= 0) { j = this.currFirstIndex + i; } return(j); }
void render() { if (this.preRenderList.Count > 0) { ScrollRectItem item = preRenderList[0]; currRenderIndex = this.repositionIntList[0]; preRenderList.RemoveAt(0); repositionIntList.RemoveAt(0); if (currRenderIndex + 1 <= recordCount) { if (onItemRender != null) { onItemRender.call(item, currRenderIndex, data[currRenderIndex + 1]); } } } }
void preRightDown(int i) { if (i >= 0 && !repositionIntList.Contains(i) && i + pageSize <= recordCount) //i>pageSize)// { int end1 = repositionTileList.Count - 1; ScrollRectItem tile = repositionTileList[end1]; repositionTileList.RemoveAt(end1); //remove end repositionTileList.Insert(0, tile); //to first this.preRenderList.Add(tile); //add to preRenderList repositionIntList.Add(i); //add data index currFirstIndex--; if (currFirstIndex < 0) { currFirstIndex = 0; } CalcLastEndIndex(); scrollDirection = -1; preRender(tile, i); } }
void preLeftUp(int i) { if (i >= this.pageSize && !repositionIntList.Contains(i) && i < this.recordCount) { ScrollRectItem tile = repositionTileList[0]; repositionTileList.RemoveAt(0); //remove first repositionTileList.Add(tile); //to end this.preRenderList.Add(tile); //add to preRenderList repositionIntList.Add(i); //add data index currFirstIndex++; if (currFirstIndex + pageSize > recordCount) { currFirstIndex = recordCount - this.pageSize; } this.lastEndIndex = i; //recorde last render data index scrollDirection = 1; preRender(tile, i); //call preRender,set Postion } }