void Start() { its = new InfoTextSpecifications("Canvas_Right", "Merih", "Merih_Asansör_hub1", "Kapı ve punch makinasının bağlı olduğu hub ile ilgili sensör bilgilerini içermektedir.", new Vector2(320f, 320f), new Vector3(-180f, 0, 0)); its_child = new InfoTextSpecifications("MainMenu", "Canvas_Right", "fam", "fam", "Lorem ipsum dolor sit FAM FAM", new Vector2(100f, 100f), new Vector3(189f, 56f, 0)); ms_right = new MenuSpecifications("Canvas_Left", "MainMenu", "menunameee", new string[] { "Show Analysis", "Show Analysis 2" }, 2, new Vector2(200, 200), ffb2, new Vector3(250, 0, 0)); IT = FindObjectOfType(typeof(InfoText)) as InfoText; fillDummyVar(); MS = new MenuSpecifications("Canvas_Right", menuName, bNames, noOfButtons, size, ffb, menuPosition); ms_child = new MenuSpecifications("Canvas_Left", "Canvas_Right", "SubMenu1", new string[] { "Graph Chart 1", "Bar Chart 2" }, 2, new Vector2(200, 200), ffb2, new Vector3(250, 0, 0)); bcs = new BarChartSpecifications(new Vector3(0, 0, 0), new Vector2(400, 400), "Month Breakdown", 48.77f, 23.77f, 13, 13, 13, true, "Canvas_Right", "Canvas_Left_Left", new string[] { "Jan", "Feb", "March" }, new float[] { 5f, 3f, 10f }); bcs2 = new BarChartSpecifications(new Vector3(0, 0, 0), new Vector2(317, 317), "Region Breakdown", 38.77f, 33.77f, 16, 16, 16, true, "Canvas_Right", "Canvas_Left_Left", new string[] { "Jan", "Feb", "March" }, new float[] { 5f, 3f, 10f }); gcs = new GraphChartSpecifications(new Vector3(0, 0, 0), new Vector2(600, 400), "Merih kapı2 sıcaklık", 2f, 13, AxisFormat.Time, 1f, 12, 2.569, 11.19, "Canvas_Right", "Canvas_Left_Left"); gcs1 = new GraphChartSpecifications(new Vector3(0, 0, 0), new Vector2(600, 400), "Merih kapı1 titreşim", 2f, 13, AxisFormat.Time, 1f, 12, 2.569, 11.19, "Canvas_Right", "Canvas_Left_Left"); gcs2 = new GraphChartSpecifications(new Vector3(0, 0, 0), new Vector2(600, 400), "Merih punch1 sıcaklık", 2f, 13, AxisFormat.Time, 1f, 12, 2.569, 11.19, "Canvas_Right", "Canvas_Left_Left"); gcs3 = new GraphChartSpecifications(new Vector3(0, 0, 0), new Vector2(600, 400), "Merih Kapı2 sıcaklık1", 2f, 13, AxisFormat.Time, 1f, 12, 2.569, 11.19, "Canvas_Right", "Canvas_Left_Left"); Uicont = FindObjectOfType(typeof(UIController)) as UIController; BC = FindObjectOfType(typeof(BarChartClass)) as BarChartClass; SBM = FindObjectOfType(typeof(ScrollBarMenu)) as ScrollBarMenu; LC = FindObjectOfType(typeof(LineChart)) as LineChart; // Uicont.CreateScrollBarMenu(MS); // OnVRTriggerPressed(new Vector3(0, 0, 0)); // SBM.CreateScrollBarMenu(MS); // SBM.CreateScrollBarMenu(MS); GameObject.Find("Month Breakdown").GetComponent <Button>().onClick.Invoke(); }
public void CreateInfoText(InfoTextSpecifications its) { if (its.parent != null) { /* * if (!Toggle.ContainsKey(UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name)) * { * string pressedButtonName = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name; * Toggle[pressedButtonName] = false; * } * if (!Toggle[UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name]) * { */ var panel = GameObject.Find(its.canvas); var panel2 = GameObject.Find(its.parent + "Background"); infoText = (GameObject)Instantiate(InfoTextPrefab); RectTransform rt = infoText.GetComponent <RectTransform>(); rt.sizeDelta = its.size; infoText.name = its.name; infoText.GetComponent <RectTransform>().SetParent(panel.transform); if (panel2.transform.parent != panel.transform) { infoText.transform.localPosition = its.position; } else { infoText.transform.localPosition = its.position + panel2.transform.localPosition; } infoText.name = its.name; infoText.transform.rotation = panel.transform.rotation; infoText.transform.GetChild(0).GetComponent <Text>().text = its.body; RectTransform rt_body = infoText.transform.GetChild(0).GetComponent <RectTransform>(); rt_body.sizeDelta = its.size * new Vector2(0.8f, 0.8f); infoText.transform.GetChild(1).GetComponent <Text>().text = its.head; infoText.transform.GetChild(1).transform.localPosition = new Vector3(0, its.size.y / 1.9f, 0); RectTransform rt_head = infoText.transform.GetChild(1).GetComponent <RectTransform>(); rt_head.sizeDelta = its.size * new Vector2(1f, 0.2f); onScreen[its.name] = infoText; // Toggle[UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name] = true; /* * } * * else * { * //Destroy the object * Destroy(onScreen[its.name]); * //Remove the destroyed objects from the Onscreen dictionary * onScreen.Remove(its.name); * //Set the buttons state to false indicating that it is not pressed yet * Toggle[UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name] = false; * } */ } else { var panel = GameObject.Find(its.canvas); infoText = (GameObject)Instantiate(InfoTextPrefab); RectTransform rt = infoText.GetComponent <RectTransform>(); rt.sizeDelta = its.size; infoText.name = its.name; infoText.GetComponent <RectTransform>().SetParent(panel.transform); infoText.transform.localPosition = its.position; infoText.transform.rotation = panel.transform.rotation; infoText.name = its.name; infoText.transform.GetChild(0).GetComponent <Text>().text = its.body; RectTransform rt_body = infoText.transform.GetChild(0).GetComponent <RectTransform>(); rt_body.sizeDelta = its.size * new Vector2(0.8f, 0.8f); infoText.transform.GetChild(1).GetComponent <Text>().text = its.head; infoText.transform.GetChild(1).transform.localPosition = new Vector3(0, its.size.y / 1.9f, 0); RectTransform rt_head = infoText.transform.GetChild(1).GetComponent <RectTransform>(); rt_head.sizeDelta = its.size * new Vector2(1f, 0.2f); } }