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(); }
// Start is called before the first frame update void Start() { Debug.Log(OVRGazePointer.instance.transform.position); gcs = 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"); cd = FindObjectOfType(typeof(CanvasData)) as CanvasData; LC = FindObjectOfType(typeof(LineChart)) as LineChart; UC = FindObjectOfType(typeof(UseCase)) as UseCase; // OnVRTriggerReleased(); }
void OnVRTriggerReleased() { this.transform.position = initialPos; this.transform.rotation = initialRot; if (cd.droppable) { if (GameObject.Find(cd.canvasName).transform.Find("DashboardName").GetComponent <Text>().text != "" && this.transform.parent.transform.name != cd.canvasName) { gcs = new GraphChartSpecifications(new Vector3(0, 0, 0), new Vector3(600, 400), this.transform.name, 2f, this.GetComponent <VerticalAxis>().GetComponent <Text>().fontSize, this.GetComponent <HorizontalAxis>().Format, 1f, this.GetComponent <HorizontalAxis>().GetComponent <Text>().fontSize, this.GetComponent <StreamingGraph>().lineThickness, this.GetComponent <StreamingGraph>().pointSize, cd.canvasName); LC.CreateLineChart(gcs); UC.saveLineChartToDashboard(GameObject.Find(cd.canvasName).transform.Find("DashboardName").GetComponent <Text>().text, gcs); } } }
public void CreateLineChart(GraphChartSpecifications gcs) { if (gcs.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]) { graphChart = (GameObject)Instantiate(GraphChartPrefab); RectTransform rt = graphChart.GetComponent <RectTransform>(); rt.sizeDelta = gcs.Size; graphChart.name = gcs.GraphChartName; graphChart.GetComponent <Text>().text = gcs.GraphChartName; var panel = GameObject.Find(gcs.Canvas); var panel2 = GameObject.Find(gcs.Parent); graphChart.GetComponent <RectTransform>().SetParent(panel.transform); if (panel2.transform.parent != panel.transform) { graphChart.transform.localPosition = gcs.Position; int from = canvasPositionIndex[gcs.Parent]; int to = canvasPositionIndex[gcs.Canvas]; int dif = to - from; if (dif > 3) { dif = dif - mc.positions.Length; } if (dif < -3) { dif = dif + mc.positions.Length; } for (int i = 0; i < Math.Abs(dif); i++) { if (dif < 0) { // mc.InitiateMovementRight(); } else { // mc.InitiateMovementLeft(); } } } else { graphChart.transform.localPosition = gcs.Position; } graphChart.GetComponent <VerticalAxis>().GetComponent <Text>().fontSize = gcs.VerticalAxisFontSize; graphChart.GetComponent <HorizontalAxis>().Format = gcs.HorizontalAxisFormat; graphChart.GetComponent <HorizontalAxis>().GetComponent <Text>().fontSize = gcs.HorizontalAxisFontSize; graphChart.GetComponent <StreamingGraph>().lineThickness = gcs.LineThickness; graphChart.GetComponent <StreamingGraph>().pointSize = gcs.PointSize; graphChart.GetComponent <StreamingGraph>().TotalPoints = 1; graphChart.GetComponent <StreamingGraph>().categories = new string[] { "sa2" }; graphChart.GetComponent <Draggable>().gcs = gcs; graphChart.transform.rotation = panel.transform.rotation; // GameObject text = new GameObject(); // text.transform.SetParent(panel.transform); // Text myText = text.AddComponent<Text>(); // myText.text = gcs.GraphChartName; // text.transform.SetPositionAndRotation(panel.transform.localPosition + gcs.Position, new Quaternion(0, 0, 0, 0)); onScreen[gcs.GraphChartName] = graphChart; Toggle[UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name] = true; } else { //Destroy the object Destroy(onScreen[gcs.GraphChartName]); //Also destroy the background // Destroy(onScreen[gcs.GraphChartName]); //Remove the destroyed objects from the Onscreen dictionary onScreen.Remove(gcs.GraphChartName); // onScreen.Remove(gcs.GraphChartName); //Set the buttons state to false indicating that it is not pressed yet Toggle[UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name] = false; } } else { // if (!onScreenClone.ContainsKey(gcs.GraphChartName)) // { graphChart = (GameObject)Instantiate(GraphChartPrefab); RectTransform rt = graphChart.GetComponent <RectTransform>(); rt.sizeDelta = gcs.Size; graphChart.name = gcs.GraphChartName; graphChart.GetComponent <Text>().text = gcs.GraphChartName; var panel = GameObject.Find(gcs.Canvas); graphChart.GetComponent <RectTransform>().SetParent(panel.transform); graphChart.transform.localPosition = gcs.Position; graphChart.GetComponent <VerticalAxis>().GetComponent <Text>().fontSize = gcs.VerticalAxisFontSize; graphChart.GetComponent <HorizontalAxis>().Format = gcs.HorizontalAxisFormat; graphChart.GetComponent <HorizontalAxis>().GetComponent <Text>().fontSize = gcs.HorizontalAxisFontSize; graphChart.GetComponent <StreamingGraph>().lineThickness = gcs.LineThickness; graphChart.GetComponent <StreamingGraph>().pointSize = gcs.PointSize; graphChart.GetComponent <StreamingGraph>().TotalPoints = 3; graphChart.GetComponent <StreamingGraph>().categories = new string[] { "sa2", "sa1", "sae" }; graphChart.GetComponent <Draggable>().gcs = gcs; graphChart.transform.rotation = panel.transform.rotation; // onScreenClone[gcs.GraphChartName] = graphChart; // GameObject text = new GameObject(); // text.transform.SetParent(panel.transform); // Text myText = text.AddComponent<Text>(); // myText.text = gcs.GraphChartName; // text.transform.SetPositionAndRotation(panel.transform.localPosition + gcs.Position, new Quaternion(0, 0, 0, 0)); // } // else // { //Destroy the object // Destroy(onScreenClone[gcs.GraphChartName]); //Also destroy the background // Destroy(onScreen[gcs.GraphChartName]); //Remove the destroyed objects from the Onscreen dictionary // onScreenClone.Remove(gcs.GraphChartName); // } } }