public void SaveToAsset() { if (assembleController.GetAssembleFlowAsset() == null) { var filePath = EditorUtility.SaveFilePanel("把装配工序保存到文件", "Assets", "AssembleFlow.txt", "txt"); if (filePath.Length != 0) { var relativeFilePath = GerRelativePath(filePath); if (filePath == null) { Debug.LogError("The file has to be saved within the Unity project path."); } else { Debug.Log("Path0" + filePath); SaveToAsset(filePath); assembleController.SetAssembleFlowAsset(AssetDatabase.LoadAssetAtPath <TextAsset>(relativeFilePath)); } } } else { var assetFilePath = AssetDatabase.GetAssetPath(assembleController.GetAssembleFlowAsset()); assetFilePath = Application.dataPath + "/../" + assetFilePath; SaveToAsset(assetFilePath); } }
private void ApplyAssembleFlow(IDictionary <int, WindowItem <T> > windowList, INodeLoader assembleController) { var flowString = assembleController.GetAssembleFlowAsset() == null ? "" : assembleController.GetAssembleFlowAsset().text; assembleController.ParseAssembleFlowFile(flowString, (int step0, int step1) => { WindowItem <T> w0; WindowItem <T> w1; if (windowList.TryGetValue(step0, out w0) && windowList.TryGetValue(step1, out w1)) { w1.AddPreviousStep(w0); } else { Debug.LogError("Failed to create flow nodes of " + step0 + "->" + step1); } }); }