Ejemplo n.º 1
0
 void _Mover_OnMoved(object sender, BoardChangedEventArgs e)
 {
     if (OnChanged != null)
     {
         OnChanged(this, e);
     }
 }
Ejemplo n.º 2
0
 private void DoOnDropped(BoardChangedEventArgs e)
 {
     this._Board.BeginUpdate();
     try
     {
         for (int i = 0; i < this.Shape.Width; i++)
         {
             for (int j = 0; j < this.Shape.Height; j++)
             {
                 if (this.Shape[i, j] != 0)
                 {
                     this._Board[i + _positionX, j + _positionY] = this.Shape[i, j];
                 }
             }
         }
         _fallen = true;
     }
     finally
     {
         this._Board.EndUpdate();
     }
     if (OnDropped != null)
     {
         OnDropped(this, e);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// cette method est appelée quand une piece est tombé ou que l'option 'g'ravity est executer
        /// </summary>
        /// <param name="fromDrop">génère les événements drop si le paramètre vaut "true"</param>
        private void CheckAfterDrop(bool fromDrop, BoardChangedEventArgs e)
        {
            // prepare for deleting
            int[] linesCompleted = GetLinesCompleted();

            if (linesCompleted.Length == 0)
            {
                if (fromDrop && OnDropped != null)
                {
                    OnDropped(this, e);
                }
                return;
            }
            byte[,] blocks = GetBlocksWithoutMover();
            _InUpdate++;
            try
            {
                for (int i = 0; i < linesCompleted.Length; i++)
                {
                    int lineToDelete = linesCompleted[i];
                    ShiftSegmentDown(lineToDelete + 1, true);
                }
                AddOptions(linesCompleted.Length);
            }
            finally
            {
                _InUpdate--;
            }
            _Mover_OnMoved(this, new BoardChangedEventArgs(GetChangedBlock(blocks, this.GetBlocks())));

            if (OnLinesCompleted != null)
            {
                OnLinesCompleted(this, new LinesCompletedEventArgs(linesCompleted.Length));
            }

            if (fromDrop && OnDropped != null)
            {
                OnDropped(this, e);
            }
        }
Ejemplo n.º 4
0
 void _Mover_OnDropped(object sender, BoardChangedEventArgs e)
 {
     CheckAfterDrop(true, e);
 }
Ejemplo n.º 5
0
 void _Board_OnDropped(object sender, BoardChangedEventArgs e)
 {
     ThrowNewShape();
 }