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 CreateBarChart(BarChartSpecifications bcs) { if (bcs.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(bcs.canvas); var panel2 = GameObject.Find(bcs.Parent); DashboardElementBackground = (GameObject)Instantiate(DashboardElementBackgroundPrefab); DashboardElementBackground.transform.SetParent(panel.transform); DashboardElementBackground.name = bcs.BarChartName + "Background"; DashboardElementBackground.transform.localPosition = bcs.Position; DashboardElementBackground.transform.rotation = panel.transform.rotation; RectTransform rt_back = DashboardElementBackground.GetComponent <RectTransform>(); rt_back.sizeDelta = bcs.Size + new Vector2(bcs.Size.x * 0.28f, bcs.Size.y * 0.25f); barChart = (GameObject)Instantiate(BarChartPrefab); RectTransform rt = barChart.GetComponent <RectTransform>(); rt.sizeDelta = bcs.Size; barChart.name = bcs.BarChartName; barChart.GetComponent <RectTransform>().SetParent(DashboardElementBackground.transform); // if (panel2.transform.parent != panel.transform) // { // DashboardElementBackground.transform.localPosition = bcs.Position; // barChart.GetComponent<RectTransform>().SetPositionAndRotation(panel2.transform.localPosition + bcs.Position, new Quaternion(0, 0, 0, 0)); // } // else // { // DashboardElementBackground.transform.localPosition = bcs.Position + panel2.transform.localPosition; // barChart.GetComponent<RectTransform>().SetPositionAndRotation(panel2.transform.localPosition + panel.transform.localPosition + bcs.Position, new Quaternion(0, 0, 0, 0)); // } // barChart.transform.localPosition = bcs.Position; barChart.transform.rotation = panel.transform.rotation; barChart.transform.localPosition = new Vector3(0, 0, 0); barChart.GetComponent <CanvasBarChart>().AxisSeperation = 100f; barChart.GetComponent <CanvasBarChart>().BarSeperation = bcs.BarSeperation; barChart.GetComponent <CanvasBarChart>().BarSize = bcs.BarSize; barChart.GetComponent <ItemLabels>().FontSize = bcs.ItemLabelsFontSize; barChart.GetComponent <CategoryLabels>().FontSize = bcs.CategoryLabelsFontSize; barChart.GetComponent <GroupLabels>().FontSize = bcs.GroupLabelsFontSize; barChart.GetComponent <BarAnimation>().enabled = bcs.BarAnimation; barChart.GetComponent <BarFeed>().categories = bcs.categories; barChart.GetComponent <BarFeed>().values = bcs.values; onScreen[bcs.BarChartName] = barChart; onScreen[DashboardElementBackground.name] = DashboardElementBackground; // Toggle[UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name] = true; // } // else // { //Destroy the object // Destroy(onScreen[bcs.BarChartName]); //Also destroy the background // Destroy(onScreen[bcs.BarChartName + "Background"]); //Remove the destroyed objects from the Onscreen dictionary // onScreen.Remove(bcs.BarChartName); // onScreen.Remove(bcs.BarChartName + "Background"); //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(bcs.canvas); DashboardElementBackground = (GameObject)Instantiate(DashboardElementBackgroundPrefab); DashboardElementBackground.transform.SetParent(panel.transform); DashboardElementBackground.name = bcs.BarChartName + "Background"; DashboardElementBackground.transform.localPosition = bcs.Position; DashboardElementBackground.transform.rotation = panel.transform.rotation; RectTransform rt_back = DashboardElementBackground.GetComponent <RectTransform>(); rt_back.sizeDelta = bcs.Size + new Vector2(bcs.Size.x * 0.28f, bcs.Size.y * 0.25f); barChart = (GameObject)Instantiate(BarChartPrefab); RectTransform rt = barChart.GetComponent <RectTransform>(); rt.sizeDelta = bcs.Size; barChart.name = bcs.BarChartName; barChart.GetComponent <RectTransform>().SetParent(DashboardElementBackground.transform); barChart.transform.localPosition = new Vector3(0, 0, 0); barChart.transform.rotation = panel.transform.rotation; barChart.GetComponent <CanvasBarChart>().AxisSeperation = 100f; barChart.GetComponent <CanvasBarChart>().BarSeperation = bcs.BarSeperation; barChart.GetComponent <CanvasBarChart>().BarSize = bcs.BarSize; barChart.GetComponent <ItemLabels>().FontSize = bcs.ItemLabelsFontSize; barChart.GetComponent <CategoryLabels>().FontSize = bcs.CategoryLabelsFontSize; barChart.GetComponent <GroupLabels>().FontSize = bcs.GroupLabelsFontSize; barChart.GetComponent <BarAnimation>().enabled = bcs.BarAnimation; barChart.GetComponent <BarFeed>().categories = bcs.categories; barChart.GetComponent <BarFeed>().values = bcs.values; } }