Ejemplo n.º 1
0
        public void SpotSelected(Position spotPos)
        {
            if (endGameLock || strokeLock)
            {
                return;
            }

            Program.Debug("Square selected: " + spotPos.X + ' ' + spotPos.Y);

            //action: move figure handler
            if (playWindow.matrix.IsHighlighted(spotPos) && spotPos != figurePos)
            {
                //send network message to client\server
                if (networkGame)
                {
                    network.Add_MoveFigure(figurePos, spotPos);
                    strokeLock = true;
                }
                MoveFigure(figurePos, spotPos);
                return;
            }

            //action: selecet figure and highlight spots handler
            if (matrix.HasFigureAt(spotPos))
            {
                Figure figure = matrix.FigureAt(spotPos);

                if (figure.Color == runColor && playWindow.matrix.SetSelected(spotPos))
                {
                    playWindow.matrix.SetHighlighted(figure.GetAvailableOnCheckPositons(spotPos, matrix));
                    figurePos = spotPos;
                }
            }
        }