コード例 #1
0
        /// <summary>
        /// 結合ピース全体のドラッグ完了処理
        /// </summary>
        public void DragCompleted()
        {
            var tmp      = CombiningPieces.ToArray();
            var complete = true;

            foreach (var piece in tmp)
            {
                if (!piece.CanCompletDrag())
                {
                    complete = false;
                    break;
                }
            }
            if (complete)
            {
                foreach (var piece in tmp)
                {
                    piece.EachDragCompleted();
                }
            }
            else
            {
                foreach (var piece in tmp)
                {
                    piece.ResetPlace();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 結合ピース全体のドラッグ中処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void DragDelta(double horizontalChange, double verticalChange, double canvasWidth, double canvasHeight)
        {
            var tmp = CombiningPieces.ToArray();

            foreach (var piece in tmp)
            {
                piece.EachDragDelta(horizontalChange, verticalChange, canvasWidth, canvasHeight);
            }
        }
コード例 #3
0
 /// <summary>
 /// 結合
 /// </summary>
 /// <returns></returns>
 private void Combine(Piece piece)
 {
     if (!CombiningPieces.Contains(piece))
     {
         CombiningPieces.AddRange(piece.CombiningPieces);
         foreach (var p in CombiningPieces)
         {
             p.CombiningPieces = CombiningPieces;
             var left = Left + (p.I - I) * (Width + 1);
             var top  = Top + (p.J - J) * (Height + 1);
             p.MoveTo(left, top);
             p.SelectCancel();
         }
     }
     Combined(this, piece);
 }
コード例 #4
0
        /// <summary>
        /// 結合ピース全体のドラッグ開始処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void DragStarted()
        {
            switch (SelectedState)
            {
            case EnumSelectedState.NotSelected:
                var   isSelected    = false;
                var   isColSelected = false;
                Piece selected      = null;
                foreach (var piece in _puzzle.Pieces)
                {
                    if (piece.SelectedState == EnumSelectedState.Selected)
                    {
                        selected   = piece;
                        isSelected = true;
                    }
                    if (piece.SelectedState == EnumSelectedState.CollaboraterSelected)
                    {
                        isColSelected = true;
                    }
                }
                if (!isColSelected)
                {
                    foreach (var cmb in CombiningPieces)
                    {
                        cmb.CollaboraterSelect();
                    }
                }
                else if (isColSelected && !isSelected)
                {
                    foreach (var cmb in CombiningPieces)
                    {
                        cmb.Select();
                    }
                }
                else
                {
                    foreach (var selectedCmb in selected.CombiningPieces)
                    {
                        selectedCmb.SelectCancel();
                    }
                    foreach (var cmb in CombiningPieces)
                    {
                        cmb.Select();
                    }
                }
                break;

            case EnumSelectedState.Selected:
                break;

            case EnumSelectedState.CollaboraterSelected:
                foreach (var cmb in CombiningPieces)
                {
                    cmb.SelectCancel();
                }
                break;
            }
            var tmp = CombiningPieces.ToArray();

            foreach (var piece in tmp)
            {
                piece.EachDragStarted();
            }
        }