コード例 #1
0
ファイル: SheetDataEditor.cs プロジェクト: shazi129/Unity
        private void createGridUIs()
        {
            _allGridUIs.Clear();

            for (int rowIndex = 0; rowIndex < editorData.rowCount; rowIndex++)
            {
                Dictionary <string, IGridData> rowData = editorData.getRow(rowIndex);
                if (rowData.Count > 0)
                {
                    List <IGridUI> row = new List <IGridUI>();

                    for (int colIndex = 0; colIndex < editorData.columnCount; colIndex++)
                    {
                        string  titleName          = editorData.getTitle(colIndex);
                        int     mayBeModifiedIndex = rowIndex;
                        IGridUI grid = GridGUIManager.getInstance().createGridUI(rowData[titleName]);
                        grid.dataChangeAction = () =>
                        {
                            editorData.modify(titleName, mayBeModifiedIndex, grid.getData());
                            EditorUtility.SetDirty(target);
                        };
                        grid.title = titleName;
                        row.Add(grid);
                    }

                    _allGridUIs.Add(row);
                }
            }
        }
コード例 #2
0
ファイル: GridGUI.cs プロジェクト: shazi129/USheet
        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);
        }