Пример #1
0
 static int GetStringArray(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         SingleField obj = (SingleField)ToLua.CheckObject(L, 1, typeof(SingleField));
         string[]    o   = obj.GetStringArray();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #2
0
 static int GetBool(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         SingleField obj = (SingleField)ToLua.CheckObject(L, 1, typeof(SingleField));
         bool        o   = obj.GetBool();
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #3
0
 static int GetVector2(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         SingleField         obj = (SingleField)ToLua.CheckObject(L, 1, typeof(SingleField));
         UnityEngine.Vector2 o   = obj.GetVector2();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int ContainsValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         System.Collections.Generic.Dictionary <string, SingleField> obj = (System.Collections.Generic.Dictionary <string, SingleField>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary <string, SingleField>));
         SingleField arg0 = (SingleField)ToLua.CheckObject(L, 2, typeof(SingleField));
         bool        o    = obj.ContainsValue(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int Add(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         System.Collections.Generic.Dictionary <string, SingleField> obj = (System.Collections.Generic.Dictionary <string, SingleField>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary <string, SingleField>));
         string      arg0 = ToLua.CheckString(L, 2);
         SingleField arg1 = (SingleField)ToLua.CheckObject(L, 3, typeof(SingleField));
         obj.Add(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #6
0
    void ResetDataField(DataTable data, string key, FieldType type, string enumType)
    {
        string newContent = new SingleField(type, null, enumType).m_content;

        for (int i = 0; i < data.TableIDs.Count; i++)
        {
            SingleData tmp = data[data.TableIDs[i]];

            if (tmp.ContainsKey(key))
            {
                tmp[key] = newContent;
            }
        }

        data.SetDefault(key, newContent);
    }
 static int _get_this(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         System.Collections.Generic.Dictionary <string, SingleField> obj = (System.Collections.Generic.Dictionary <string, SingleField>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary <string, SingleField>));
         string      arg0 = ToLua.CheckString(L, 2);
         SingleField o    = obj[arg0];
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #8
0
    static int get_m_enumType(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            SingleField obj = (SingleField)o;
            string      ret = obj.m_enumType;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_enumType on a nil value" : e.Message));
        }
    }
Пример #9
0
    static int set_m_enumType(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            SingleField obj  = (SingleField)o;
            string      arg0 = ToLua.CheckString(L, 2);
            obj.m_enumType = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_enumType on a nil value" : e.Message));
        }
    }
Пример #10
0
    void AddFieldGUI(Dictionary <string, SingleField> dict)
    {
        EditorGUI.indentLevel = 1;
        isFold = EditorGUILayout.Foldout(isFold, "新增字段");
        if (isFold)
        {
            EditorGUI.indentLevel = 2;

            fieldName = EditorGUILayout.TextField("字段名", fieldName);
            newType   = (FieldType)EditorGUILayout.EnumPopup("字段类型", content.m_type);

            if (content.m_type != newType)
            {
                content.m_type = newType;
                content.Reset();
            }

            content.m_content = EditorUtilGUI.FieldGUI_Type(content);

            if (!dict.ContainsKey(fieldName) && fieldName != "")
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.Space();

                if (GUILayout.Button("新增", GUILayout.Width(position.width - 60)))
                {
                    m_currentConfig.Add(fieldName, content);

                    fieldName = "";
                    content   = new SingleField();
                    newType   = content.m_type;
                }

                EditorGUILayout.Space();
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                if (dict.ContainsKey(fieldName))
                {
                    EditorGUILayout.LabelField("已存在该字段");
                }
            }
        }
    }
        public async Task ReturnsBreakingWhenReturnTypeChanged()
        {
            var oldCode = new List <CodeSource>
            {
                new(SingleField)
            };
            var newCode = new List <CodeSource>
            {
                new(SingleField.Replace("string MyField", "bool MyField"))
            };

            var options = OptionsFactory.BuildOptions();

            var result = await _calculator.CalculateChanges(oldCode, newCode, options, CancellationToken.None)
                         .ConfigureAwait(false);

            result.ChangeType.Should().Be(SemVerChangeType.Breaking);
        }
Пример #12
0
        private void addNumericField(Document doc, string userField, float fieldValue)
        {
            if (float.IsNaN(fieldValue))
            {
                return;
            }

            userField = userField.ToLower(Str.Culture);

            if (!IsFloatField(userField))
            {
                throw new ArgumentException($"{userField} is not float");
            }

            var field = new SingleField(userField, fieldValue, Field.Store.NO);

            doc.Add(field);
        }
Пример #13
0
        public Response CheckLangVersion(string token, [FromBody] SingleField param)
        {
            Response response = new Response();

            if (string.IsNullOrEmpty(token) || !token.Equals(_token))
            {
                response.code    = "404";
                response.message = "Invild token";
            }
            else
            {
                bool res = LanguageHelper.CheckLangVersion(param.key, param.guid);

                response.content = res;
            }

            return(response);
        }
 static int TryGetValue(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         System.Collections.Generic.Dictionary <string, SingleField> obj = (System.Collections.Generic.Dictionary <string, SingleField>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary <string, SingleField>));
         string      arg0 = ToLua.CheckString(L, 2);
         SingleField arg1 = null;
         bool        o    = obj.TryGetValue(arg0, out arg1);
         LuaDLL.lua_pushboolean(L, o);
         ToLua.PushObject(L, arg1);
         return(2);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #15
0
    private void AddPlayerGUI()
    {
        //当前没有选中角色时时,才显示
        if (m_curPlayerIndex != 0)
        {
            return;
        }

        newPlayerisFold = EditorGUILayout.Foldout(newPlayerisFold, "创建角色");
        if (newPlayerisFold)
        {
            EditorGUI.indentLevel++;

            var fieldData = new SingleField(FieldType.String, playerId, null);
            playerId = EditorUtilGUI.FieldGUI_Type(fieldData, "角色ID");

            if (string.IsNullOrEmpty(playerId))
            {
                EditorGUILayout.LabelField("输入要添加的ID(角色id从101开始)=,,=");
            }
            else if (m_curPlayerDatas.ContainsKey(playerId))
            {
                EditorGUILayout.LabelField("重复啦=..=");
            }

            EditorGUILayout.Space();

            if (!m_curPlayerDatas.ContainsKey(playerId) && !string.IsNullOrEmpty(playerId))
            {
                EditorGUILayout.Space();
                if (GUILayout.Button("创建"))
                {
                    playerContent = new SingleData();
                    playerContent.Add("player_id", playerId);
                    m_curPlayerDatas.AddData(playerContent);
                    DataEditorWindow.SaveData(m_playerCfgName, m_curPlayerDatas);
                    PreparePlayerData();
                }
                EditorGUILayout.Space();
            }

            EditorGUILayout.Space();
        }
    }
        public async Task EvaluatesChangeOfModifiers(string oldModifiers, string newModifiers,
                                                     SemVerChangeType expected)
        {
            var oldCode = new List <CodeSource>
            {
                new(SingleField.Replace("string MyField", oldModifiers + " string MyField"))
            };
            var newCode = new List <CodeSource>
            {
                new(SingleField.Replace("string MyField", newModifiers + " string MyField"))
            };

            var options = OptionsFactory.BuildOptions();

            var result = await _calculator.CalculateChanges(oldCode, newCode, options, CancellationToken.None)
                         .ConfigureAwait(false);

            result.ChangeType.Should().Be(expected);
        }
Пример #17
0
            internal Field GetNumericField(string name, NumericType type)
            {
                Field f;

                if (reuseFields)
                {
                    numericFields.TryGetValue(name, out f);
                }
                else
                {
                    f = null;
                }

                if (f == null)
                {
                    switch (type)
                    {
                    case NumericType.INT32:
                        f = new Int32Field(name, 0, Field.Store.NO);
                        break;

                    case NumericType.INT64:
                        f = new Int64Field(name, 0L, Field.Store.NO);
                        break;

                    case NumericType.SINGLE:
                        f = new SingleField(name, 0.0F, Field.Store.NO);
                        break;

                    case NumericType.DOUBLE:
                        f = new DoubleField(name, 0.0, Field.Store.NO);
                        break;

                    default:
                        throw new InvalidOperationException("Cannot get here");
                    }
                    if (reuseFields)
                    {
                        numericFields[name] = f;
                    }
                }
                return(f);
            }
Пример #18
0
        public void TestAddSingleField_FieldType()
        {
            SingleField field     = null;
            float       value     = 123.456f;
            var         fieldType = new FieldType
            {
                IsIndexed    = true,
                IsTokenized  = true,
                OmitNorms    = false,
                IndexOptions = IndexOptions.DOCS_ONLY,
                NumericType  = NumericType.SINGLE,
                IsStored     = true
            }.Freeze();

            AssertDocumentExtensionAddsToDocument(document => field = document.AddSingleField("theName", value, fieldType));
            Assert.AreEqual("theName", field.Name);
            Assert.AreEqual(value, field.GetSingleValueOrDefault(), 0.0000001f); // We don't really care about precision, just checking to see if the value got passed through
            Assert.AreSame(fieldType, field.FieldType);
        }
Пример #19
0
    public static string FieldGUI_Type(SingleField data, string labelContent = "字段内容")
    {
        string content = "";

        switch (data.m_type)
        {
        case FieldType.String:
            content = EditorGUILayout.TextField(labelContent, data.GetString());
            break;

        case FieldType.Int:
            content = EditorGUILayout.IntField(labelContent, data.GetInt()).ToString();
            break;

        case FieldType.Float:
            content = EditorGUILayout.FloatField(labelContent, data.GetFloat()).ToString();
            break;

        case FieldType.Bool:
            content = EditorGUILayout.Toggle(labelContent, data.GetBool()).ToString();
            break;

        case FieldType.Vector3:
            content = EditorGUILayout.Vector3Field(labelContent, data.GetVector3()).ToSaveString();
            break;

        case FieldType.Vector2:
            content = EditorGUILayout.Vector2Field(labelContent, data.GetVector2()).ToSaveString();
            break;

        case FieldType.Color:
            content = EditorGUILayout.ColorField(labelContent, data.GetColor()).ToSaveString();
            break;
        }

        if (data.m_content != content)
        {
            data.m_content = content;
        }

        return(content);
    }
Пример #20
0
 /// <summary>
 /// 取得至下个工作日的所有日期 + weekday中文
 /// </summary>
 /// <param name="strDate"></param>
 /// <param name="strCostCenterCode"></param>
 /// <returns></returns>
 public static CCMast GetCCMastInfo(SingleField param)
 {
     try
     {
         CCMast ccm = ccmf.GetCCMastInfo(param.code);
         if (ccm == null)
         {
             throw new Exception("DAL.MastData.CalendarFactory.GetCCMastInfo()==null");
         }
         return(ccm);
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(new Log()
         {
             message = ex.Message
         }, "GetCCMastInfoParam");
         return(null);
     }
 }
    void ConfigItemGUI(Dictionary <string, SingleField> dict, string key)
    {
        EditorGUI.indentLevel = 2;
        string      newContent = "";
        SingleField data       = dict[key];

        EditorGUILayout.LabelField(key);

        EditorGUI.indentLevel = 3;

        EditorGUILayout.BeginHorizontal();

        if (data.m_type != FieldType.Enum)
        {
            EditorGUILayout.LabelField("字段类型:", data.m_type.ToString());
        }
        else
        {
            EditorGUILayout.LabelField("字段类型:", data.m_type.ToString() + "/" + data.m_enumType);
        }

        if (GUILayout.Button("删除字段"))
        {
            if (EditorUtility.DisplayDialog("警告", "确定要删除该字段吗!", "是", "取消"))
            {
                dict.Remove(key);
                return;
            }
        }

        EditorGUILayout.EndHorizontal();

        newContent = EditorUtilGUI.FieldGUI_Type(data);

        if (data.GetString() != newContent)
        {
            data.m_content = newContent;
        }

        EditorGUILayout.Space();
    }
Пример #22
0
 /// <summary>
 /// 取得ItemClass维护界面的集合
 /// </summary>
 /// <param name="param">公司代码</param>
 /// <returns></returns>
 public static ItemClassMaintain GetItemClassMaintainData(SingleField param)
 {
     try
     {
         ItemClassMaintain result = cClassSupplierFactory.GetItemClassMaintainData(param);
         if ((result.lstItemClass_x == null || result.lstItemClass_x.Count == 0) ||
             (result.lstItemClass_y == null || result.lstItemClass_y.Count == 0))
         {
             throw new Exception("DAL.MastData.cClassSupplierFactory.GetItemClassMantainData()==null");
         }
         return(result);
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(new Log()
         {
             message = ex.Message
         }, "GetItemClassMantainData");
         return(null);
     }
 }
Пример #23
0
        private T GetData <T>(string costCenterCode, string cardid, string sqltype)
        {
            if (string.IsNullOrWhiteSpace(cardid))
            {
                return(default(T));
            }

            CCMastFactory ccmf = new CCMastFactory();
            // Table CCMast
            CCMast ccm = ccmf.GetCCMastInfo(costCenterCode);
            // Table SqlMast
            SingleField ccObj = new SingleField();

            ccObj.code = costCenterCode;
            List <SingleField> lstCcObj = new List <SingleField>();

            lstCcObj.Add(ccObj);
            SqlMast sm = ccmf.GetSqlMastInfo(lstCcObj, sqltype)[0];
            // Sql文
            string strSql = string.Format(sm.sqlCommand, cardid);

            #region TCP
            if (string.IsNullOrWhiteSpace(ccm.posDBUserName))
            {
                return(NetTcpHelper.GetEntity <T>(ccm.posIp, ccm.posDBName, strSql));
            }
            #endregion

            #region 连数据

            string strConn = string.Format(string.Format(SqlServerHelper.customerAllConn(),
                                                         ccm.posIp, ccm.posDBName, ccm.posDBUserName, ccm.posDBPassword));

            //strConn = "Data Source=192.168.0.97,1433;Initial Catalog=DWPOS;User ID=sa;Password=gladis0083;Persist Security Info=True;Connection Timeout=10";
            // 取得卡信息
            return(SqlServerHelper.GetEntity <T>(strConn, strSql));

            #endregion
        }
Пример #24
0
        private void FillFieldsValues(SingleSelectionField field, BubbleWordValueType valueType)
        {
            if (valueType == BubbleWordValueType.Character)
            {
                List <string> alphabets = GetAlphabets(field.Fields.Count);

                for (int i = 0; i < field.Fields.Count; ++i)
                {
                    SingleField singleField = field.Fields[i];
                    singleField.FieldValue = alphabets[i];
                    field.Fields[i]        = singleField;
                }
            }
            else
            {
                for (int i = 0; i < field.Fields.Count; ++i)
                {
                    SingleField singleField = field.Fields[i];
                    singleField.FieldValue = i.ToString();
                    field.Fields[i]        = singleField;
                }
            }
        }
        public SingleSearchFieldTransformer(SingleField field) : base("field", field.Negate)
        {
            Key = field.Name;
            if (field.TermValue != null)
            {
                Value    = field.TermValue.Value;
                TermType = field.TermValue.TermType;

                if (field.TermValue.BoostValue != DefaultTermValue.NoBoost)
                {
                    Boost = field.TermValue.BoostValue;
                }
                else
                {
                    Boost = null;
                }
            }
            else
            {
                Value     = field.Value;
                FieldType = FieldUtils.DetectFieldType(field.Value);
            }
        }
Пример #26
0
    void Start()
    {
        Respawn();
        birdState = new ByteField(objectName, "birdstate", 0);
        pX        = new SingleField(objectName, "position x", 0);
        pY        = new SingleField(objectName, "position y", 0);
        pZ        = new SingleField(objectName, "position z", 0);

        vX = new SingleField(objectName, "velocity x", 0);
        vY = new SingleField(objectName, "velocity y", 0);
        vZ = new SingleField(objectName, "velocity z", 0);

        rYaw   = new SingleField(objectName, "rotation yaw", 0);
        rPitch = new SingleField(objectName, "rotation pitch", 0);
        rRoll  = new SingleField(objectName, "rotation roll", 0);

        time = new SingleField(objectName, "time", 0);

        animationController.AddAnimation(flap);
        animationController.AddAnimation(soar);
        animationController.AddAnimation(noise);
        animationController.PlayAnimation(soar);
        animationController.PlayAnimation(noise);
    }
        /// <summary>
        /// 取得小程序配置信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public string GetWxPayConfig(SingleField param)
        {
            string value = string.Empty;

            switch (param.code.ToLower())
            {
            case "appid":
                value = wcf.appId;
                break;

            case "mchid":
                value = wcf.mchId;
                break;

            case "key":
                value = wcf.key;
                break;

            case "appsecret":
                value = wcf.appSecret;
                break;
            }
            return(value);
        }
Пример #28
0
        public void GetFieldSettings(List <FlattenedObject> props, Document doc, List <KeyValuePair <string, Analyzer> > analyzers)
        {
            foreach (var p in props)
            {
                if (p == null)
                {
                    continue;
                }
                if (analyzers != null)
                {
                    if (p.Analyzer != null)
                    {
                        analyzers.Add(new KeyValuePair <string, Analyzer>(p.Key, p.Analyzer));
                    }
                }
                if (doc != null)
                {
                    if (p.Value is int || p.Value is int?)
                    {
                        var nf = new Int32Field(p.Key, int.Parse(p.Value.ToString()), p.FieldStoreSetting);
                        doc.Add(nf);
                    }
                    else if (p.Value is long || p.Value is long?)
                    {
                        var nf = new Int64Field(p.Key, long.Parse(p.Value.ToString()), p.FieldStoreSetting);
                        doc.Add(nf);
                    }
                    else if (p.Value is float || p.Value is float?)
                    {
                        var nf = new SingleField(p.Key, float.Parse(p.Value.ToString()), p.FieldStoreSetting);
                        doc.Add(nf);
                    }
                    else if (p.Value is double || p.Value is double?)
                    {
                        var nf = new DoubleField(p.Key, double.Parse(p.Value.ToString()), p.FieldStoreSetting);
                        doc.Add(nf);
                    }
                    else if (p.Spatial)
                    {
                        if (p.Value == null || string.IsNullOrEmpty(p.Value.ToString()))
                        {
                            continue;
                        }
                        var name               = p.Key;// p.Key.IndexOf('.')>-1?p.Key.Substring(0,p.Key.LastIndexOf('.')):p.Key;
                        int maxLevels          = 11;
                        SpatialPrefixTree grid = new GeohashPrefixTree(ctx, maxLevels);
                        var strat              = new RecursivePrefixTreeStrategy(grid, name);

                        //var strat = new PointVectorStrategy(ctx,name);
                        var xyArr = p.Value.ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        if (xyArr.Length != 2)
                        {
                            continue;
                        }
                        double x;
                        double y;
                        if (!double.TryParse(xyArr[0], out x) || !double.TryParse(xyArr[1], out y))
                        {
                            continue;
                        }
                        var point = ctx.MakePoint(x, y);
                        //var point = ctx.ReadShape(p.Value.ToString());
                        var fields = strat.CreateIndexableFields(point);
                        fields.ToList().ForEach(x => doc.Add(x));

                        IPoint pt = (IPoint)point;
                        //doc.Add(new StoredField(strat.FieldName, pt.X.ToString(CultureInfo.InvariantCulture) + " " + pt.Y.ToString(CultureInfo.InvariantCulture)));
                    }
                    else
                    {
                        string value = p.Value == null ? null : (p.KeepValueCasing ? p.Value.ToString() : p.Value.ToString().ToLower());
                        Field  f     = null;
                        if (p.FieldIndexSetting == Field.Index.ANALYZED || p.FieldIndexSetting == Field.Index.ANALYZED_NO_NORMS)
                        {
                            f = new TextField(p.Key, value ?? string.Empty, p.FieldStoreSetting);
                        }
                        else
                        {
                            f = new StringField(p.Key, value ?? string.Empty, p.FieldStoreSetting);
                        }
                        doc.Add(f);
                    }
                }
            }
        }
Пример #29
0
    public static string FieldGUI_Type(FieldType type, string enumType, string content, string labelContent = "字段内容")
    {
        SingleField data = new SingleField(type, content, enumType);

        return(EditorUtilGUI.FieldGUI_Type(data, labelContent));
    }
Пример #30
0
    public static string FieldGUI_TypeValue(FieldType type, string content, string enumType)
    {
        SingleField data = new SingleField(type, content, enumType);

        return(EditorUtilGUI.FieldGUI_TypeValue(data));
    }
    void AddFieldGUI()
    {
        EditorGUILayout.Space();
        m_isAddFoldField = EditorGUILayout.Foldout(m_isAddFoldField, "新增字段");
        EditorGUI.indentLevel ++;

        if (m_isAddFoldField)
        {
            m_newFieldName = EditorGUILayout.TextField("字段名", m_newFieldName);
            FieldType typeTmp = (FieldType)EditorGUILayout.EnumPopup("字段类型", m_newAddType);

            bool isNewFieldType = false;

            if (typeTmp != m_newAddType)
            {
                m_newAddType = typeTmp;
                isNewFieldType = true;
            }

            m_addNoteContent = EditorGUILayout.TextField("注释", m_addNoteContent);

            if (typeTmp == FieldType.Enum)
            {
                int newEnumTypeIndex = EditorGUILayout.Popup("枚举类型", m_newEnumTypeIndex, EditorTool.GetAllEnumType());

                if (newEnumTypeIndex != m_newEnumTypeIndex)
                {
                    m_newEnumTypeIndex = newEnumTypeIndex;
                    isNewFieldType = true;
                }
            }

            //更改字段类型重设初始值
            if (isNewFieldType)
            {
                if (typeTmp == FieldType.Enum)
                {
                    m_newFieldDefaultValue = new SingleField(m_newAddType, null, EditorTool.GetAllEnumType()[m_newEnumTypeIndex]).m_content;
                }
                else
                {
                    m_newFieldDefaultValue = new SingleField(m_newAddType, null, null).m_content;
                }
            }

            //是否是一个合理的字段名
            bool isShowButton = true;

            if (m_newFieldName == "")
            {
                isShowButton = false;
            }

            if (m_currentData.TableKeys.Contains(m_newFieldName))
            {
                isShowButton = false;
                EditorGUILayout.TextField("字段名不能重复!",EditorGUIStyleData.s_WarnMessageLabel);
            }

            m_newFieldDefaultValue = EditorUtilGUI.FieldGUI_Type(m_newAddType, EditorTool.GetAllEnumType()[m_newEnumTypeIndex], m_newFieldDefaultValue, "默认值");

            if (isShowButton)
            {
                if (GUILayout.Button("新增字段"))
                {
                    if (m_newAddType == FieldType.Enum)
                    {
                        AddField(m_currentData, m_newFieldName, m_newAddType, m_newFieldDefaultValue, EditorTool.GetAllEnumType()[m_newEnumTypeIndex], m_addNoteContent);
                    }
                    else
                    {
                        AddField(m_currentData, m_newFieldName, m_newAddType, m_newFieldDefaultValue, null, m_addNoteContent);
                    }

                    m_newFieldName = "";
                    m_newFieldDefaultValue = "";
                    m_addNoteContent = "";
                    m_newAddType = FieldType.String;
                    m_newEnumTypeIndex = 0;
                }
            }

        }
    }
    SingleData EditorDataGUI(DataTable table, SingleData data)
    {
        try
        {
            List<string> keys = table.TableKeys;
            for (int i = 0; i < keys.Count; i++)
            {
                string keyTmp = keys[i];
                FieldType type = table.GetFieldType(keyTmp);

                if (i != 0)
                {
                    bool cancelDefault = false;
                    EditorGUILayout.BeginHorizontal();

                    if (data.ContainsKey(keyTmp))
                    {
                        EditorGUILayout.LabelField("[" + keyTmp + "]");

                        if (GUILayout.Button("使用默认值"))
                        {
                            data.Remove(keyTmp);
                            EditorGUILayout.EndHorizontal();

                            continue;
                        }
                    }
                    else
                    {
                        EditorGUILayout.LabelField("[" + keyTmp + "] (默认值)");
                        if (GUILayout.Button("取消默认值"))
                        {
                            cancelDefault = true;
                        }
                    }

                    EditorGUILayout.EndHorizontal();

                    //EditorGUI.indentLevel++;
                    EditorGUI.indentLevel++;

                    //非默认值情况
                    if (data.ContainsKey(keyTmp))
                    {
                        EditorGUILayout.LabelField("字段名", keyTmp);
                        EditorGUILayout.LabelField("注释", table.GetNote(keyTmp));

                        string newContent = EditorUtilGUI.FieldGUI_TypeValue(type, data[keyTmp], table.GetEnumType(keyTmp));

                        if (newContent != data[keyTmp])
                        {
                            data[keyTmp] = newContent;
                        }
                    }
                    //如果是默认值则走这里
                    else
                    {
                        EditorGUILayout.LabelField("字段名", keyTmp);
                        EditorGUILayout.LabelField("注释", table.GetNote(keyTmp));
                        string newContent = "";

                        if (table.m_defaultValue.ContainsKey(keyTmp))
                        {
                            newContent = new SingleField(type, table.GetDefault(keyTmp), table.GetEnumType(keyTmp)).m_content;
                        }
                        else
                        {
                            newContent = new SingleField(type, null, table.GetEnumType(keyTmp)).m_content;
                        }

                        if (type != FieldType.Enum)
                        {
                            EditorGUILayout.LabelField("字段类型", type.ToString());
                        }
                        else
                        {
                            EditorGUILayout.LabelField("字段类型", type.ToString() + "/" + table.GetEnumType(keyTmp));
                        }

                        EditorGUILayout.LabelField("(默认)字段内容", new SingleField(type, newContent, table.GetEnumType(keyTmp)).GetShowString());

                        if (cancelDefault)
                        {
                            data.Add(keyTmp, newContent);
                        }
                    }

                    EditorGUI.indentLevel--;
                    //EditorGUI.indentLevel--;
                }

                EditorGUILayout.Space();
            }
        }
        catch(Exception e)
        {
            EditorGUILayout.TextArea(e.ToString(),EditorGUIStyleData.s_ErrorMessageLabel);
        }

        return data;
    }
    void ResetDataField(DataTable data,string key,FieldType type,string enumType)
    {
        string newContent = new SingleField(type, null, enumType).m_content;

        for (int i = 0; i < data.TableIDs.Count; i++)
        {
            SingleData tmp = data[data.TableIDs[i]];

            if (tmp.ContainsKey(key))
            {
                tmp[key] = newContent;
            }
        }

        data.SetDefault(key,newContent);
    }
    void AddFieldGUI(Dictionary<string, SingleField> dict)
    {
        EditorGUI.indentLevel = 1;
        isFold = EditorGUILayout.Foldout(isFold,"新增字段");
        if(isFold)
        {
            EditorGUI.indentLevel = 2;

            bool isNewType = false;

            fieldName = EditorGUILayout.TextField("字段名",fieldName);

            newType = (FieldType)EditorGUILayout.EnumPopup("字段类型", content.m_type);

            if (content.m_type != newType)
            {
                isNewType = true;
            }

            if (newType == FieldType.Enum)
            {
                int newIndex = EditorGUILayout.Popup("枚举类型", m_newTypeIndex, EditorTool.GetAllEnumType());

                if (newIndex != m_newTypeIndex)
                {
                    m_newTypeIndex = newIndex;
                    isNewType = true;
                }
            }

            if (isNewType)
            {
                content.m_type = newType;
                content.m_enumType = EditorTool.GetAllEnumType()[m_newTypeIndex];
                content.Reset();
            }

            content.m_content = EditorUtilGUI.FieldGUI_Type(content);

            if (!dict.ContainsKey(fieldName) && fieldName != "")
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.Space();

                if (GUILayout.Button("新增", GUILayout.Width(position.width - 60)))
                {
                    m_currentConfig.Add(fieldName, content);

                    fieldName = "";
                    content = new SingleField();
                    newType = content.m_type;
                    m_newTypeIndex = 0;
                }

                EditorGUILayout.Space();
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                if (dict.ContainsKey(fieldName))
                {
                    EditorGUILayout.LabelField("已存在该字段");
                }
            }
        }
    }