// Set to a given set of settings public void SetTo(PermanentObjectsManager pom) { for (int i = 0; i < 4; i++) { namesDimsIF [i].text = pom.names [i].ToString(); minDimsIF [i].text = pom.mins [i].ToString(); maxDimsIF [i].text = pom.maxs [i].ToString(); resolutionDimsIF[i].text = pom.resolutions[i].ToString(); namesDimsIF [i].ActivateInputField(); minDimsIF [i].ActivateInputField(); maxDimsIF [i].ActivateInputField(); resolutionDimsIF [i].ActivateInputField(); } interaction3DToggle.text = pom.interaction3D ? "x" : ""; OnApply(); }
void Start() { // If initialization is incomplete if (GameObject.Find ("PermanentObjects") == null) { SceneManager.LoadScene ("sc0_pom"); return; } pom = GameObject.Find ("PermanentObjects").GetComponent <PermanentObjectsManager> (); drawingArea = GameObject.Find ("DrawingCanvas").GetComponentsInChildren <Transform>()[2]; foreach (Transform child in drawingArea) { if (child.name == "Background") background = child; if (child.name == "MainPanel") mainPanel = child; if (child.name == "ComputeSettingsPanel") computeSettingsPanel = child; if (child.name == "LoadSettingsPanel") loadSettingsPanel = child; if (child.name == "LoadingBarPanel") loadingBarPanel = child; } mainTabManager = mainPanel.GetComponent <TabManager>(); computeSettingsManager = computeSettingsPanel.GetComponent <ComputeSettingsManager>(); loadSettingsManager = loadSettingsPanel.GetComponent <LoadSettingsManager>(); loadingBarManager = loadingBarPanel.GetComponent <LoadingBarManager>(); mainTabManager.Initialize (); computeSettingsManager.Initialize (); loadSettingsManager.Initialize (); loadingBarManager.Initialize (); tab1 = mainTabManager.GetTab (1); tab2 = mainTabManager.GetTab (2); foreach (Transform child in tab1) { if (child.name == "Formula_dropdown") formula_dropdown = child.GetComponent <Dropdown> (); if (child.name == "FooterButtonsSection") dropdownComputeFooter = child; if (child.name == "FooterVisualizationSection") { visualizationComputeFooter = child; foreach (Transform child2 in visualizationComputeFooter) { if (child2.name == "DisplayArea") formula_text = child2.GetComponentsInChildren <Text> () [0]; } } } foreach (Transform child in tab2) { if (child.name == "FileName") fileName_text = child.GetComponentsInChildren <Text> () [0]; } mainPanel.gameObject.SetActive (true); computeSettingsPanel.gameObject.SetActive (false); loadSettingsPanel.gameObject.SetActive (false); loadingBarPanel.gameObject.SetActive (false); dropdownComputeFooter.gameObject.SetActive (true); visualizationComputeFooter.gameObject.SetActive (false); state_onSettings = false; state_onLoadingBar = false; state_onVisualization = false; foreach (string name in Enum.GetNames(typeof(Formula.Function))) { if (name != "None") { formula_dropdown.options.Add (new Dropdown.OptionData () { text = name }); } } if (pom.names.Length != 0) { computeSettingsManager.SetTo (pom); formula_dropdown.value = ((int)pom.function == 0) ? 1 : 0; formula_dropdown.value = (int)pom.function; loadSettingsManager.SetTo (pom); } else { formula_dropdown.value = 1; formula_dropdown.value = 0; } OnUpdateFormulaText (); }
// Start function void Start() { // If initialization is incomplete if (GameObject.Find("PermanentObjects") == null) { SceneManager.LoadScene("sc0_pom"); return; } pom = GameObject.Find("PermanentObjects").GetComponent <PermanentObjectsManager> (); cameraManager = GameObject.Find("Camera").GetComponent <CameraManager> (); grapher = GameObject.Find("Grapher").transform; drawingCanvas = GameObject.Find("DrawingCanvas").GetComponentsInChildren <Transform>()[1]; drawingArea = drawingCanvas.GetComponentsInChildren <Transform>()[1]; foreach (Transform child in drawingArea) { if (child.name == "Background") { background = child; } if (child.name == "Content") { content = child; foreach (Transform subchild in child) { if (subchild.name == "Parameters") { parameters = subchild; } if (subchild.name == "Graphics") { graphics = subchild; } if (subchild.name == "Navigation") { navigation = subchild; } } } } grapherManager = grapher.gameObject.GetComponent <GraphManager> (); foreach (Transform child in parameters) { if (child.name == "Dim1") { dim1SliderManager = child.GetComponent <SliderManager> (); } if (child.name == "Dim2") { dim2SliderManager = child.GetComponent <SliderManager> (); } } foreach (Transform child in graphics) { if (child.name == "Resolution") { resolutionSSBSManager = child.GetComponent <SliderSBSManager> (); } if (child.name == "ExtraGraphics") { foreach (Transform subchild in child) { if (subchild.name == "ActivateRotation") { activateRotationToggle = subchild.GetComponentsInChildren <Transform> () [1] .GetComponentsInChildren <Text> () [0]; } if (subchild.name == "FullGraphics") { fullGraphicsToggle = subchild.GetComponentsInChildren <Transform> () [1] .GetComponentsInChildren <Text> () [0]; } } } } foreach (Transform child in navigation) { if (child.name == "Dim1") { dim1StateDropdown = child.GetComponent <Dropdown> (); } if (child.name == "Dim2") { dim2StateDropdown = child.GetComponent <Dropdown> (); } } dataHandler = pom.data; Dimension[] dims = dataHandler.state.dimensions; grapherManager.Initialize(dataHandler, pom.function); cameraManager.Initialize(dataHandler); dim1SliderManager.Initialize(dims[2]); dim2SliderManager.Initialize(dims[3]); resolutionSSBSManager.Initialize(pom.function != Formula.Function.None); resolutionSSBSManager.UpdateName(dims[0].GetRes() + " x " + dims[1].GetRes()); interaction = new Interaction(Interaction.InteractionType.Mouse); if (pom.interaction3D) { interaction = new Interaction(Interaction.InteractionType.Mouse3D); } transition = new Transition(); UpdateCheckboxes(); UpdateNavigationDropdowns(dims); currentlyMovingCamera = false; staticCall = false; grapherManager.pointsValues = grapherManager.createPointsFrom(dataHandler.state); grapherManager.DrawPoints(grapherManager.pointsValues); int[] orders = dataHandler.state.current.Value; }
// Set to a given set of settings public void SetTo(PermanentObjectsManager pom) { beginByMagnitudeToggle.text = pom.beginByMagnitude ? "x" : ""; interaction3DToggle.text = pom.interaction3D ? "x" : ""; OnApply(); }