Esempio n. 1
0
 static int Reset(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         SingleField obj = (SingleField)ToLua.CheckObject(L, 1, typeof(SingleField));
         obj.Reset();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 2
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("已存在该字段");
                }
            }
        }
    }
    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("已存在该字段");
                }
            }
        }
    }