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