public void insert(List <String> titles, List <object> values, int index = -1) { if (titles.Count != values.Count) { Debug.LogError("SheetData insert error, param error"); return; } foreach (var item in _table) { if (titles.Contains(item.Key)) { object value = values[titles.IndexOf(item.Key)]; if (value == null) { item.Value.insert(index, null); } else { Type gridClassType = typeof(GridData <>); gridClassType = gridClassType.MakeGenericType(value.GetType()); IGridData gridData = (IGridData)Activator.CreateInstance(gridClassType, new object[] { value }); item.Value.insert(index, gridData); } } else { item.Value.insert(index, null); } } }
public override void insert(int index, IGridData gridData) { T value = defaultValue; if (gridData != null) { if (gridData.dataType != typeof(T)) { Debug.LogError(string.Format("Column insert error, try to insert{0} to {1}", gridData.dataType, typeof(T))); return; } value = (gridData as GridData <T>).data; } if (_data == null) { _data = new List <T>(); } if (isOutRange(index)) { _data.Add(value); } else { _data.Insert(index, value); } }
public override void modify(int index, IGridData gridData) { T value = defaultValue; if (gridData != null) { if (gridData.dataType != typeof(T)) { Debug.LogError(string.Format("Column modify error, try to use {1} to modify {0}", gridData.dataType, typeof(T))); return; } value = (gridData as GridData <T>).data; } else { Debug.LogError("modify error, gridData is null"); } if (!isOutRange(index)) { _data[index] = value; } else { Debug.LogError(string.Format("modify error, index{0} out of range", index)); } }
public void modify(string title, int rowIndex, IGridData iData) { if (_table.ContainsKey(title)) { IColumnData columnData = _table[title]; columnData.modify(rowIndex, iData); } else { Debug.LogError("Modify SheetData error: no that title:" + title); } }
public IGridUI createGridUI(IGridData iData) { IGridUI gridUI = null; if (_createDic.ContainsKey(iData.dataType)) { Type gridType = _createDic[iData.dataType]; gridUI = (IGridUI)Activator.CreateInstance(gridType, new object[] { }); } if (gridUI != null) { gridUI.setData(iData); } return(gridUI); }
public override void setData(IGridData iData) { base.setData(_data); _data = iData as GridData <T>; }
public virtual void setData(IGridData data) { }
public virtual void modify(int index, IGridData gridData) { }
public virtual void insert(int index, IGridData gridData) { }