Esempio n. 1
0
        private async Task HighlightMoves()
        {
            if (selected == null)
            {
                return;
            }
            var pos = BoardLayout.GetPositionFromControl(selected);

            if (board[pos.Column, pos.Row].val != null)
            {
                HashSet <Move> list = board[pos.Column, pos.Row].val.GetMovesOrAttacks(board);
                foreach (Move move in list)
                {
                    var x = move.moveTo.x;
                    var y = move.moveTo.y;
                    var c = BoardLayout.GetControlFromPosition(x, y);
                    c.BackColor = SystemColors.Highlight;
                }
            }
        }