Example #1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            switch (e.Button)
            {
            case MouseButtons.Left:
                LevelSettings settings = _editor?.Level?.Settings;
                if (settings != null && settings.Wads.All(wad => wad.LoadException != null))
                {
                    ReferencedWad wadToUpdate = settings.Wads.FirstOrDefault(wad => wad.LoadException != null);
                    if (wadToUpdate != null)
                    {
                        EditorActions.UpdateWadFilepath(Parent, wadToUpdate);
                    }
                    else
                    {
                        EditorActions.AddWad(Parent);
                    }
                }
                else if (_editor.ChosenItem != null)
                {
                    if (_editor.ChosenItem.Value.IsStatic)
                    {
                        var stat = _editor.Level.Settings.WadTryGetStatic(_editor.ChosenItem.Value.StaticId);
                        if (stat != null)
                        {
                            DoDragDrop(stat, DragDropEffects.Copy);
                        }
                    }
                    else
                    {
                        var mov = _editor.Level.Settings.WadTryGetMoveable(_editor.ChosenItem.Value.MoveableId);
                        if (mov != null)
                        {
                            DoDragDrop(mov, DragDropEffects.Copy);
                        }
                    }
                }
                break;
            }
        }