Ejemplo n.º 1
0
    private void DrawFieldData(TableConfigOtherInfo info)
    {
        pos1 = GUILayout.BeginScrollView(pos1, "CurveEditorBackground");
        List <TableConfigFieldInfo> list = new List <TableConfigFieldInfo>(info.fieldInfoDic.Values);

        for (int i = 0; i < list.Count; i++)
        {
            TableConfigFieldInfo temp = list[i];
            temp = (TableConfigFieldInfo)EditorDrawGUIUtil.DrawBaseValue("◆", temp);
            Type tempType = TableConfigTool.ConfigFieldValueType2Type(temp.fieldValueType);
            if (temp.defultValue == null || tempType.FullName != temp.defultValue.GetType().FullName)
            {
                temp.defultValue = ReflectionUtils.CreateDefultInstance(tempType);
            }
            GUILayout.Space(3);
            if (GUILayout.Button("Delete"))
            {
                if (EditorUtility.DisplayDialog("警告", "是否删除字段", "OK", "Cancel"))
                {
                    // info.fieldInfoDic.Remove(temp.fieldName);
                    list.Remove(temp);
                }
            }

            GUILayout.Space(6);
        }
        GUILayout.EndScrollView();
        info.fieldInfoDic.Clear();
        for (int i = 0; i < list.Count; i++)
        {
            TableConfigFieldInfo temp = list[i];
            info.fieldInfoDic.Add(temp.fieldName, temp);
        }
    }
Ejemplo n.º 2
0
    private void CheckEditConfigData()
    {
        TableConfigOtherInfo infos = TableConfigBase.tableConfigOtherInfo[chooseFileName];
        List <ConfigRowData> datas = currentEditConfigData.configRowDataList[index];
        List <string>        fs    = new List <string>(infos.fieldInfoDic.Keys);

        foreach (var item in fs)
        {
            if (!currentEditConfigData.IsHaveRow(item))
            {
                currentEditConfigData.AddRow(item, infos.fieldInfoDic[item].defultValue);
                return;
            }
        }

        for (int i = 0; i < datas.Count; i++)
        {
            ConfigRowData d = datas[i];
            if (!infos.fieldInfoDic.ContainsKey(d.fieldName))
            {
                currentEditConfigData.RemoveFieldValue(d.fieldName);
                break;
            }
            TableConfigFieldInfo field = infos.fieldInfoDic[d.fieldName];
            Type tempType = TableConfigTool.ConfigFieldValueType2Type(field.fieldValueType);
            if (d.value == null || tempType.FullName != d.value.GetType().FullName)
            {
                d.value = field.defultValue;
                break;
            }
        }
    }