Exemplo n.º 1
0
        public static bool GenerateScript(string folderPath, string filename, IScriptGenerator generator)
        {
            try
            {
                string path = folderPath + Path.AltDirectorySeparatorChar + filename;
                if (!File.Exists(path))
                {
                    using (var streamW = new StreamWriter(path))
                    {
                        generator.Generate(streamW);
                    }

                    AssetDatabase.Refresh();
                    return(true);
                }
                else
                {
                    Debug.LogError("Script with the same name already exists at path " + path);
                }
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
            return(false);
        }
Exemplo n.º 2
0
        new public void FileInsertNewSingleFileScript(string filename, string file)
        {
            CSScriptFile csfile = new CSScriptFile(filename, file);

            SingleFileScriptPackage package   = new SingleFileScriptPackage(csfile);
            IScriptGenerator        generator = package.ExecuteCompiler(new SingleFileProjectCompiler());

            ArrayList simulators = MetaverseController.Singleton.GetSimulators();
            ISim      sim        = (ISim)simulators[0];

            SimController.Singleton.InsertScript(sim, generator.Generate());

            return;
        }