Beispiel #1
0
 private void GLControl_DragDrop(object sender, DragEventArgs e)
 {
     if (_BlockEvents)
     {
         return;
     }
     if (e.Data != null)
     {
         object LVData = e.Data.GetData("System.Windows.Forms.ListView+SelectedListViewItemCollection");
         ListView.SelectedListViewItemCollection Collection = (ListView.SelectedListViewItemCollection)LVData;
         foreach (ListViewItem Item in Collection)
         {
             object[] Info = (object[])Item.Tag;
             if (Info[0].ToString() == "Asset")
             {
                 int         Index = (int)Info[1];
                 SceneObject New   = null;
                 if (_Interface.CurrentGame.Assets[Index].Type == SceneObjectType.DrawnSceneObject)
                 {
                     New = new DrawnSceneObject((DrawnSceneObject)_Interface.CurrentGame.Assets[Index], _Interface.CurrentScene);
                 }
                 else if (_Interface.CurrentGame.Assets[Index].Type == SceneObjectType.ScriptSceneObject)
                 {
                     New = new ScriptSceneObject((ScriptSceneObject)_Interface.CurrentGame.Assets[Index], _Interface.CurrentScene);
                 }
                 if (New != null)
                 {
                     _Interface.CurrentScene.Objects.Add(New);
                     _Interface.ForceUpdate(InterfaceUpdateMessage.SceneObjectsUpdated);
                 }
                 else
                 {
                     MessageBox.Show("File type not supported for this scene type", "Not Supported");
                 }
             }
             if (Info[0].ToString() == "Library")
             {
                 string      Path = (string)Info[1];
                 SceneObject New  = SceneObject.FromFile(Path, _Interface.CurrentScene);
                 if (New != null)
                 {
                     _Interface.CurrentScene.Objects.Add(New);
                     _Interface.ForceUpdate(InterfaceUpdateMessage.SceneObjectsUpdated);
                 }
                 else
                 {
                     MessageBox.Show("File type not supported for this scene type", "Not Supported");
                 }
             }
         }
     }
 }