Пример #1
0
        void DoInit()
        {
            CreateConfig config = null;

            if (File.Exists(CreateConfig.configPath))
            {
                string text = File.ReadAllText(CreateConfig.configPath);
                config = JsonUtility.FromJson <CreateConfig>(text);
            }
            else
            {
                config = new CreateConfig();
            }
            _savePath        = config.savePath;
            _classSuffix     = config.classSuffix;
            _varPrefix       = config.varPrefix;
            _scriptSuffix    = config.scriptSuffix;
            _namespaceSuffix = config.namespaceSuffix;
            _addNamespaces   = config.addNamespaces;
        }
Пример #2
0
        void DoSaveSet()
        {
            CreateConfig config = new CreateConfig();

            config.savePath        = _savePath;
            config.classSuffix     = _classSuffix;
            config.varPrefix       = _varPrefix;
            config.scriptSuffix    = _scriptSuffix;
            config.namespaceSuffix = _namespaceSuffix;
            config.addNamespaces   = _addNamespaces;

            string dir = Path.GetDirectoryName(CreateConfig.configPath);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            File.WriteAllText(CreateConfig.configPath, JsonUtility.ToJson(config));
            AssetDatabase.Refresh();
            Close();
        }
Пример #3
0
        public static void ReadConfig()
        {
            string       configPath = CreateConfig.configPath;
            CreateConfig config     = null;

            if (!File.Exists(configPath))
            {
                config = new CreateConfig();
            }
            else
            {
                config = JsonUtility.FromJson <CreateConfig>(File.ReadAllText(configPath));
            }

            _scriptsPath     = Application.dataPath + config.savePath;
            _classSuffix     = config.classSuffix;
            _varPrefix       = config.varPrefix;
            _scriptSuffix    = config.scriptSuffix;
            _namespaceSuffix = config.namespaceSuffix;
            _addNamespaces   = config.addNamespaces;
        }