private void ViewPort_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent("SceneItem")) { string item = e.Data.GetData("SceneItem") as string; var pos = e.GetPosition(m_Viewport); var hitRes = VisualTreeHelper.HitTest(m_Viewport, pos); RayMeshGeometry3DHitTestResult rayMeshRes = hitRes as RayMeshGeometry3DHitTestResult; if (rayMeshRes != null) { double x = (double)rayMeshRes.PointHit.X; double y = (double)rayMeshRes.PointHit.Y; Scene.SceneItem s = null; if (item == typeof(SceneRect).ToString()) { s = new Scene.SceneRect(x, y, 50, 50, System.Windows.Media.Color.FromRgb(0, 255, 0)); } else if (item == typeof(SceneText).ToString()) { s = new Scene.SceneText(x, y, "Text", System.Windows.Media.Color.FromRgb(255, 255, 255), 10.0, new FontFamily("Arial")); } else if (item == typeof(SceneTextViewer).ToString()) { s = new Scene.SceneTextViewer(x, y, 0.2, 0.2, "Text", new FontFamily("Arial"), 10.0, System.Windows.Media.Color.FromRgb(255, 255, 255)); } else if (item == typeof(SceneCircle).ToString()) { s = new Scene.SceneCircle(x, y, 10, 0.0, Math.PI * 2.0, System.Windows.Media.Color.FromRgb(0, 255, 0)); } else if (item == typeof(SceneImage).ToString()) { s = new Scene.SceneImage(x, y, 100, 100, null); } else if (item == typeof(SceneVideo).ToString()) { s = new Scene.SceneVideo(x, y, 100, 100, null); } else if (item == typeof(ScenePolygon).ToString()) { s = new Scene.ScenePolygon(new Polygon(new Vector2[] { new Vector2(0 + x, 0 + y), new Vector2(50 + x, 50 + y), new Vector2(50 + x, y) }), System.Windows.Media.Color.FromRgb(0, 255, 0)); } else if (item == typeof(SceneAudio).ToString()) { s = new Scene.SceneAudio(null); } if (s != null) { SceneManager.Instance.CurrentScene.Add(s); } else { throw new NotImplementedException(); } } } }
public static void Init() { m_Notifications = new List <string>(); m_NotificationItem = new Scene.SceneTextViewer(0.8f, 0.05f, 0.2f, 0.2f, "", new FontFamily("Arial"), 10.0, System.Windows.Media.Color.FromRgb(255, 255, 255)); }