/// <summary> /// 渲染视口内的cell /// </summary> /// <param name="showData"></param> public void renderCell(LineData.ShowCellData showData) { LineData.ShowCellData scd = showData; if (scd.itemKey == 0) { if (onCellInitHandler != null) { WllTemplate wt = itemTemplate.GetWllItemTemplate(scd.nType); if (string.IsNullOrEmpty(wt.path)) { Debug.Log("没有Item路径"); return; } scd.itemKey = onCellInitHandler.Invoke(wt.path, scd.nType, content); } else { scd.itemKey = itemTemplate.findItem(scd.nType, content); } } Vector2 vec = scd.calcuatePos(); Debug.Log("render " + scd.dataIndex); onCellRenderHandler.Invoke(scd.dataIndex, scd.nType, scd.itemKey, vec, scd); }
public void renderCell(LineData.ShowCellData showData) { LineData.ShowCellData scd = showData; if (scd.Item == null) { scd.Item = itemTemplate.findItem(scd.nType); scd.Item.transform.SetParent(content); scd.Item.SetActive(true); } scd.renderPos(); GridDataSource gds = dataLocator.source[scd.dataIndex]; scd.render(gds); }
public void OnCellRenderHandler(int dataIndex, int nType, int itemKey, Vector2 pos, LineData.ShowCellData sData) { PooList pl; if (poolMap.TryGetValue(nType, out pl)) { GameObject tmp = pl.keyMap[itemKey]; if (tmp != null) { tmp.transform.localPosition = pos; Text tx = tmp.transform.Find("num").GetComponent <Text>(); tx.text = dataIndex.ToString(); } } }