Beispiel #1
0
        internal static void RegenerateScriptFiles()
        {
            NodeParamConfig nodeParamConfig = NodeParamConfig.instance;

            if (nodeParamConfig.folder != null)
            {
                string path = AssetDatabase.GetAssetPath(nodeParamConfig.folder);
                if (AssetDatabase.IsValidFolder(path))
                {
                    FileUtil.DeleteFileOrDirectory(path);
                    Directory.CreateDirectory(path);
                    List <NodeParamConfigEntry> entries = new List <NodeParamConfigEntry>();
                    entries.AddRange(nodeParamConfig.defaultTypes);
                    entries.AddRange(nodeParamConfig.extendedTypes);

                    foreach (var entry in entries)
                    {
                        if (IsTypeNameValid(entry.typeName) && entry.willGenerate)
                        {
                            CreateOneFile(path, entry);

                            if (entry.includeArrayType)
                            {
                                CreateOneFile(path, entry.MakeArrayTypeEntry());
                            }
                        }
                    }

                    CreateNodeDefine(path, entries);
                    AssetDatabase.Refresh();
                }
            }
        }
        void OnEnable()
        {
            targetNodeParamConfig = target as NodeParamConfig;

            reorderableListDefault  = InitiReorderableList(serializedObject.FindProperty("defaultTypes"));
            reorderableListExtended = InitiReorderableList(serializedObject.FindProperty("extendedTypes"));

            cachedValidState = new Dictionary <string, bool>();
        }