private void InitializeDependencyGraph(AssembleController assembleController, string flowString) { this.nodeList = LoadAllToDictionary(assembleController.GetAllNodes <IFlowNode>()); assembleController.ParseAssembleFlowFile(flowString, (a0, a1) => { GraphNode n0; GraphNode n1; if (!this.nodeList.TryGetValue(a0, out n0)) { Debug.LogError("Can't find the item " + a0 + " from the hierarcy."); return; } if (!this.nodeList.TryGetValue(a1, out n1)) { Debug.LogError("Can't find the item " + a1 + " from the hierarcy."); return; } n0.nextNodes.Add(n1); n1.previousNodes.Add(n0); }); // TODO: Check for loops this.headers = new List <GraphNode>(); foreach (var node in nodeList.Values) { if (node.previousNodes.Count == 0) { this.headers.Add(node); } } }
private IEnumerator FlowRender(AssembleController assembleController) { yield return(new WaitForSeconds(1f)); foreach (var node in assembleController.GetDependencyGraph().GetAllNodes().Cast <Node>()) { node.SetInstallationState(InstallationState.NotInstalled); node.gameObject.SetActive(false); } yield return(-1); yield return(StartCoroutine(FlowRenderOneFlow(assembleController, assembleController.GetDependencyGraph().GetHeaders().Cast <Node>()))); Debug.Log("All items are installed"); }
public override void OnInspectorGUI() { DrawDefaultInspector(); AssembleController myController = (AssembleController)target; var style = new GUIStyle(GUI.skin.button); style.normal.textColor = Color.white; GUI.backgroundColor = Color.blue; // TODO: For now, the file is fixed. We should consider make it a generic file and could be changed if (GUILayout.Button("打开装配工序窗口", style)) { var window = EditorWindow.GetWindow <WyzLinkAssembleFlow>(false, "装配工序"); window.LoadContent(myController); //window.Show(); } }
private IEnumerator FlowRenderOneFlow(AssembleController assembleController, IEnumerable <Node> headers) { foreach (var node in headers) { if (assembleController.GetDependencyGraph().IsNodeValidToInstall(node)) { var coroutine = StartCoroutine(AssemblePart(headers, node)); if (node.hasAnimation) { yield return(coroutine); yield return(node.PlayAnimations()); } yield return(new WaitForSeconds(1.4f)); yield return(StartCoroutine(FlowRenderOneFlow(assembleController, assembleController.GetDependencyGraph().GetNextSteps(node).Cast <Node>()))); } } }
public DependencyGraph(AssembleController assembleController, string flowString) { InitializeDependencyGraph(assembleController, flowString); }