Exemple #1
0
        private void OnGUI()
        {
            EditorGUILayout.BeginVertical();
            DynamicObjectEditor.DynamicObjectConfig =
                EditorGUILayout.ObjectField("Config", DynamicObjectEditor.DynamicObjectConfig,
                                            typeof(DynamicObjectConfig)) as
                DynamicObjectConfig;
            EditorGUILayout.Space();
            var beginScrollView = EditorGUILayout.BeginScrollView(_scrollPosition, EditorStyles.helpBox);

            _scrollPosition = beginScrollView;
            if (DynamicObjectEditor.DynamicObjectConfig != null)
            {
                for (int i = 0; i < DynamicObjectEditor.DynamicObjectConfig.datas.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal(EditorStyles.textArea);
                    DynamicObjectData dynamicObjectEditorData =
                        DynamicObjectEditor.DynamicObjectConfig.GetValueByIndex(i);
                    string key = dynamicObjectEditorData.key;
                    GUILayout.Label(key);
                    if (GUILayout.Button("Remove", GUILayout.Width(100)))
                    {
                        DynamicObjectEditor.Remove(key);
                        i--;
                    }

                    EditorGUILayout.EndHorizontal();
                }
            }

            EditorGUILayout.EndScrollView();
            EditorGUILayout.EndVertical();
        }
 protected override List <string> GetStringList()
 {
     return(DynamicObjectEditor.GetKeys());
 }
 protected override void OnAddString(string str)
 {
     DynamicObjectEditor.AddKey(str);
 }