private void SaveButton() { // Create a list to hold new dataValues List <string> newDataInputList = new List <string>(); // Get list of values from newData InputFields foreach (GameObject dataInput in GameObject.FindGameObjectsWithTag("PCPNewDataInputField")) { newDataInputList.Add(dataInput.GetComponent <TMP_InputField>().text); dataInput.GetComponent <TMP_InputField>().text = null; } ; // Get & Set kValue InputField and weighted Toggle for KNN KNN.kValue = Convert.ToInt32(GameObject.FindGameObjectWithTag("PCPkValue").GetComponent <TMP_InputField>().text); KNN.trueOrFalse = GameObject.FindGameObjectWithTag("PCPWeighted").GetComponent <Toggle>().isOn; // Run Cancel() to clear and hide the NewData Panel after the values have been stored CancelButton(); // Add the new data NewDataPoint.AddDataPoint(newDataInputList); ColorManager.Blink(KNN.kPoints, pointList); // Target the last DataBall (column4) within the newly added instance GameObject newBall = (GameObject)pointList.Last()["DataBall4"] as GameObject; TargetingScript.selectedTarget = newBall; TargetingScript.colorOff = TargetingScript.selectedTarget.GetComponent <Renderer>().material.color; TargetingScript.selectedTarget.GetComponent <Renderer>().material.color = Color.white; TargetingScript.selectedTarget.transform.localScale += new Vector3(+0.01f, +0.01f, +0.01f); }
private void SaveInput() { CancelInvoke("SaveCheck"); dataPoint.Clear(); foreach (InputField data in newDataWindow.GetComponentsInChildren <InputField>()) { dataPoint.Add(data.text); data.text = null; } kValue = k.GetComponent <InputField>().text; if (Convert.ToInt32(kValue) < 1) { kValue = "1"; } if (Convert.ToInt32(kValue) > CSVläsare.pointList.Count()) { kValue = CSVläsare.pointList.Count().ToString(); } if (weighted.GetComponent <Toggle>().isOn == true) { weightedOrNot = true; } else { weightedOrNot = false; } newDataList.SetActive(false); foreach (Transform child in newDataWindow.transform) { Destroy(child.gameObject); } KUpdate.text = k.text; KNN.kValue = Convert.ToInt32(kValue); KNN.trueOrFalse = weightedOrNot; NewDataPoint.AddDataPoint(dataPoint); }