示例#1
0
        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);
                }
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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));
            }
        }
示例#4
0
 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);
     }
 }
示例#5
0
        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);
        }
示例#6
0
 public override void setData(IGridData iData)
 {
     base.setData(_data);
     _data = iData as GridData <T>;
 }
示例#7
0
 public virtual void setData(IGridData data)
 {
 }
示例#8
0
 public virtual void modify(int index, IGridData gridData)
 {
 }
示例#9
0
 public virtual void insert(int index, IGridData gridData)
 {
 }