예제 #1
0
        private static ColumnConfig GetOrNew_ColumnConfig(TableConfig pTableConfig, FieldInfo pFieldInfo)
        {
            ColumnConfig pColumnConfig = pTableConfig.listColumnConfig.FirstOrDefault(p => p.strColumnName == pFieldInfo.Name);

            if (pColumnConfig == null)
            {
                pColumnConfig = new ColumnConfig(pFieldInfo.Name);
                pTableConfig.listColumnConfig.Add(pColumnConfig);
            }

            return(pColumnConfig);
        }
예제 #2
0
        private void DrawFields(TableConfig pTableConfig, FieldInfo[] arrMember, float fScrollHeight)
        {
            EditorGUILayout.BeginScrollView(_vecScroll_ForFields,
                                            GUILayout.ExpandHeight(true), GUILayout.MinHeight(fScrollHeight));

            ColumnConfig pPKColumn = pTableConfig.listColumnConfig.FirstOrDefault(p => p.eTypeFlags == EColumnTypeFlags.PK);

            for (int i = 0; i < arrMember.Length; i++)
            {
                FieldInfo pFieldInfo    = arrMember[i];
                var       pColumnConfig = GetOrNew_ColumnConfig(pTableConfig, pFieldInfo);

                bool bIsPK = (pColumnConfig.eTypeFlags & EColumnTypeFlags.PK) != 0;
                // bool bIsNN = (pColumnConfig.eTypeFlags & EColumnTypeFlags.NN) != 0;
                // bool bIsUQ = (pColumnConfig.eTypeFlags & EColumnTypeFlags.UQ) != 0;

                EditorGUILayout.BeginHorizontal();
                {
                    EditorGUILayout.LabelField(pFieldInfo.FieldType.Name, GUILayout.MaxWidth(const_LabelSize[ELabelName.Type]));
                    EditorGUILayout.LabelField(pFieldInfo.Name, GUILayout.MaxWidth(const_LabelSize[ELabelName.Column]));

                    EColumnTypeFlags eColumnTypeFlags = EColumnTypeFlags.None;

                    bool bIgnoreSet_PK = pPKColumn != null && pPKColumn.strColumnName != pColumnConfig.strColumnName;
                    GUI.enabled = bIgnoreSet_PK == false;
                    {
                        if (EditorGUILayout.Toggle(bIsPK, GUILayout.MaxWidth(const_LabelSize[ELabelName.PK])))
                        {
                            if (bIgnoreSet_PK)
                            {
                                EditorUtility.DisplayDialog("Error", "this table already has PK", "ok");
                                continue;
                            }
                            eColumnTypeFlags |= EColumnTypeFlags.PK;
                        }
                    }
                    GUI.enabled = true;

                    // PK는 반드시 NN을 포함해야 합니다.
                    //if (EditorGUILayout.Toggle(bIsPK || bIsNN, GUILayout.MaxWidth(const_LabelSize[ELabelName.NN])))
                    //    eColumnTypeFlags |= EColumnTypeFlags.NN;

                    //if (EditorGUILayout.Toggle(bIsUQ, GUILayout.MaxWidth(const_LabelSize[ELabelName.UQ])))
                    //    eColumnTypeFlags |= EColumnTypeFlags.UQ;

                    pColumnConfig.eTypeFlags = eColumnTypeFlags;
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.Space();
            EditorGUILayout.EndScrollView();
        }
예제 #3
0
 public ColumnInfo(string strColumnName, ColumnConfig pConfig, FieldInfo pFieldInfo)
 {
     this.strColumnName = strColumnName;
     this.pConfig       = pConfig;
     this.pFieldInfo    = pFieldInfo;
 }