void OnBodyPartSelected(BodyPartUI partUI) { SelectedPartUI = partUI; //enter AR mode BodyPartMenu.gameObject.SetActive(!BodyPartMenu.gameObject.activeInHierarchy); MidAirPositioner.SetActive(true); //ToggleBodyMenu(); }
void OnBodyPartSaved(BodyPartUI partUI) { BodyPartMeasure modelPart = BodyParts.Find(x => x.Part.Equals(SelectedPartUI.BodyPart.Part)); if (modelPart != null) { Debug.Log("saving bodypart value"); //save on model modelPart.Cm = measurementController.GetUnityValue() * 100f; //update UI partUI.UpdateMeasure(System.Math.Round(modelPart.Cm, 2).ToString()); partUI.IsSet = true; txtSavedValue.text = measurementController.GetTextValue(); ResetPoints(); hitCounts = 0; SaveMenu.SetActive(false); MidAirPositioner.SetActive(false); } }
void SetGridValues() { //BodyPartMenu.GetComponent <> GameObject gridContent = BodyPartMenu.content.gameObject; for (int i = 1; i < System.Enum.GetValues(typeof(BodyPart)).Length; i++) { BodyParts.Add(new BodyPartMeasure((BodyPart)i, 0f)); GameObject bodyPrefab = Instantiate(Resources.Load("Prefabs/BodyPartUI")) as GameObject; BodyPartUI bodyUI = bodyPrefab.GetComponent <BodyPartUI>(); bodyUI.SetData(BodyParts[i - 1]); bodyUI.OnSelected = OnBodyPartSelected; bodyUI.OnSaved = OnBodyPartSaved; bodyUI.gameObject.transform.SetParent(gridContent.transform); //bodyUI.gameObject.transform.parent = gridContent.transform; bodyUI.gameObject.transform.localScale = Vector3.one; } BodyPartMenu.gameObject.SetActive(false); }