コード例 #1
0
        /// <summary>
        /// Lorsqu'un item est déposée sur la scène
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void StagePanel_DragDrop(object sender, DragEventArgs e)
        {
            Point relativePosition;

            relativePosition = _Service.GetDragStageCoords(this.PointToClient(new Point(e.X, e.Y)));

            switch (EditorHelper.Instance.DragDropObjectType)
            {
            case Enums.StageObjectType.Decors:
                _Service.CreateDecor(relativePosition, EditorHelper.Instance.DragDropItemId);
                if (EditorHelper.Instance.CurrentStageState != Enums.StagePanelState.Decors)
                {
                    EditorHelper.Instance.CurrentStageState = Enums.StagePanelState.Decors;
                    this.CurrentModeHasChanged(this, new EventArgs());
                }
                break;

            case Enums.StageObjectType.Animations:
                _Service.CreateAnimation(relativePosition, new Guid(EditorHelper.Instance.DragDropItemId));
                if (EditorHelper.Instance.CurrentStageState != Enums.StagePanelState.Objects)
                {
                    EditorHelper.Instance.CurrentStageState = Enums.StagePanelState.Objects;
                    this.CurrentModeHasChanged(this, new EventArgs());
                }
                break;

            case Enums.StageObjectType.Characters:
                _Service.CreateCharacter(relativePosition, new Guid(EditorHelper.Instance.DragDropItemId));
                if (EditorHelper.Instance.CurrentStageState != Enums.StagePanelState.Characters)
                {
                    EditorHelper.Instance.CurrentStageState = Enums.StagePanelState.Characters;
                    this.CurrentModeHasChanged(this, new EventArgs());
                }
                break;
            }
            this.NeedToRefreshStageObjects(this, new EventArgs());
            RefreshStage();
        }