public void ToggleActiveDrugWindow(bool clear = true) { if (clear) { newDrugPanel.GetComponent <DrugSetup>().ClearAttributes(); } bool selected = !newDrugPanel.activeInHierarchy; if (selected) { drugWindow1.SetActive(selected); newDrugPanel.SetActive(selected); conditionWindow.SetActive(!selected); if (LerpFromView.onEnd != null) { LerpFromView.onEnd(); } } else { drugWindow1.SetActive(selected); newDrugPanel.SetActive(selected); conditionWindow.SetActive(!selected); if (LerpFromView.onEnd != null) { LerpFromView.onEnd(); } } }
private void SaveChanges() { // clear the message for saving from the screen Error.instance.boolPanel.SetActive(false); Error.instance.boolMessageText.text = ""; Error.instance.boolLeftButton.onClick.RemoveAllListeners(); Error.instance.boolRightButton.onClick.RemoveAllListeners(); // find the original graphs in condition and drug windows and retract their resizing delegates Transform originalVitalGraph = ConditionSetup.Instance.tabManager.contentArea.transform.FindChild(vitalGraph.name); if (originalVitalGraph != null) { print("found the original vital graph"); LerpFromView.onEnd -= originalVitalGraph.GetComponent <Graph>().ResizeGraph; } Transform originalDrugGraph = DrugSetup.Instance.tabManager.contentArea.transform.FindChild(vitalGraph.name); if (originalVitalGraph != null) { print("found the original drug graph"); LerpFromView.onEnd -= originalDrugGraph.GetComponent <Graph>().ResizeGraph; } // make sure the drug graphs name is set to the vital it is effecting and not the name of the drug drugGraph.name = DrugSetup.Instance.graph.name; // exchange the toggles for the original graphs and attach them to the newly edited graphs Transform toggleObject = ConditionSetup.Instance.tabManager.activeTabs.transform.FindChild(vitalGraph.name); if (toggleObject != null) { ConditionSetup.Instance.tabManager.tabGraphs[toggleObject.GetComponent <Toggle>()] = vitalGraph.gameObject; } toggleObject = DrugSetup.Instance.tabManager.activeTabs.transform.FindChild(drugGraph.name); if (toggleObject != null) { DrugSetup.Instance.tabManager.tabGraphs[toggleObject.GetComponent <Toggle>()] = drugGraph.gameObject; } // have the new edited graphs take their position vitalGraph.transform.SetParent(ConditionSetup.Instance.tabManager.contentArea.transform); drugGraph.transform.SetParent(DrugSetup.Instance.tabManager.contentArea.transform); // ensure the toggles are active and ready to be used for (int i = 0; i < ConditionSetup.Instance.tabManager.activeTabs.transform.childCount; i++) { ConditionSetup.Instance.tabManager.activeTabs.transform.GetChild(i).gameObject.SetActive(true); } // close down the visualisation window and open the drug window WindowManager.instance.drug.SetActive(true); WindowManager.instance.visualise.SetActive(false); // make sure the drug graph is resized in the drug window LerpFromView.onEnd(); // remove the original graphs Destroy(originalVitalGraph.gameObject); Destroy(originalDrugGraph.gameObject); }
public void ToggleActiveVisualizeWindow() { WindowManager.instance.drug.SetActive(!WindowManager.instance.drug.activeInHierarchy); WindowManager.instance.visualise.SetActive(!WindowManager.instance.visualise.activeInHierarchy); if (WindowManager.instance.visualise.activeInHierarchy) { VisualizationSetup.instance.SetVisualization(); } else { LerpFromView.onEnd(); } }
private void GetGraphs() { GameObject originalVitalGraph = ConditionSetup.Instance.tabManager.contentArea.transform.FindChild(DrugSetup.Instance.graph.name).gameObject; GameObject originalDrugGraph = DrugSetup.Instance.tabManager.contentArea.transform.FindChild(DrugSetup.Instance.graph.name).gameObject; vitalGraph = Instantiate(originalVitalGraph, vitalPanel).GetComponent <Graph>(); drugGraph = Instantiate(originalDrugGraph, drugPanel).GetComponent <Graph>(); vitalGraph.name = originalVitalGraph.name; drugGraph.name = DrugSetup.Instance.drugName.text; vitalGraph.GetComponent <RectTransform>().offsetMin = new Vector2(0, 0); vitalGraph.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0); drugGraph.GetComponent <RectTransform>().offsetMin = new Vector2(0, 0); drugGraph.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0); vitalGraph.sortedGraphPointsList = originalVitalGraph.GetComponent <Graph>().sortedGraphPointsList; vitalGraph.pointsUpperThreshold = originalVitalGraph.GetComponent <Graph>().pointsUpperThreshold; vitalGraph.pointsLowerThreshold = originalVitalGraph.GetComponent <Graph>().pointsLowerThreshold; drugGraph.sortedGraphPointsList = originalDrugGraph.GetComponent <Graph>().sortedGraphPointsList; drugGraph.pointsUpperThreshold = originalDrugGraph.GetComponent <Graph>().pointsUpperThreshold; drugGraph.pointsLowerThreshold = originalDrugGraph.GetComponent <Graph>().pointsLowerThreshold; LerpFromView.onEnd(); drugGraph.overlayPointChange += SetOverlay; vitalGraph.overlayPointChange += SetOverlay; }