private static void ParseTask(AIRuntimeTaskData task) { if (task.mode == Mode.Custom) { //避免不同task 生成同一份代码 加速生成 if (!maker_list.Contains(task.type)) { GenerateTaskCode(task); AICppMaker.GenerateTaskCode(task); } } if (task.children != null) { for (int i = 0, max = task.children.Count; i < max; i++) { ParseTask(task.children[i]); } } }
public static void MakeRuntimeCode() { DirectoryInfo dir = new DirectoryInfo(unity_AI_path); FileInfo[] files = dir.GetFiles("*.txt"); maker_list.Clear(); for (int i = 0, max = files.Length; i < max; i++) { EditorUtility.DisplayProgressBar(string.Format("{0}-{1}/{2}", "ai auto code", (i + 1), max), files[i].FullName, (float)(i + 1) / max); string name = files[i].Name.Split('.')[0]; string content = File.ReadAllText(files[i].FullName); Parse(content, name); } GenerateFactoryCode(); AICppMaker.GenerateFactoryCode(); EditorUtility.ClearProgressBar(); AssetDatabase.Refresh(); EditorUtility.DisplayDialog("AI Auto Code", "AI Code Make Finish!", "OK"); }