Ejemplo n.º 1
0
        /// <summary>
        /// Indicates whether the given markups have the same type.
        /// </summary>
        /// <param name="simpleMarkupKind">Markup kind.</param>
        /// <param name="markupKind">Other markup kind.</param>
        /// <returns>True, if the type of given markups equals.</returns>
        private bool IsMarkupEqual(SimpleMarkupKind simpleMarkupKind, MarkupKind markupKind)
        {
            switch (simpleMarkupKind)
            {
            case SimpleMarkupKind.Circle:
                return(markupKind == MarkupKind.Circle);

            case SimpleMarkupKind.Cross:
                return(markupKind == MarkupKind.Cross);

            case SimpleMarkupKind.Square:
                return(markupKind == MarkupKind.Square);

            case SimpleMarkupKind.Triangle:
                return(markupKind == MarkupKind.Triangle);
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Fills the map of shadow items based on the state of markups.
        /// </summary>
        /// <param name="boardSize">Size of game board.</param>
        /// <param name="kind">Kind of simple markup. (Circle, Cross, Square, Triangle)</param>
        /// <returns>Map of shadow items.</returns>
        public char[,] FillSimpleShadowMap(GameBoardSize boardSize, SimpleMarkupKind kind)
        {
            char[,] shadows = new char[boardSize.Width, boardSize.Height];

            switch (kind)
            {
            case SimpleMarkupKind.Circle:
            {
                for (int x = 0; x < boardSize.Width; x++)
                {
                    for (int y = 0; y < boardSize.Height; y++)
                    {
                        shadows[x, y] = 'c';
                    }
                }

                foreach (var circle in GetMarkups <Circle>())
                {
                    shadows[circle.Position.X, circle.Position.Y] = 'r';
                }
            }
                return(shadows);

            case SimpleMarkupKind.Cross:
            {
                for (int x = 0; x < boardSize.Width; x++)
                {
                    for (int y = 0; y < boardSize.Height; y++)
                    {
                        shadows[x, y] = 'x';
                    }
                }

                foreach (var cross in GetMarkups <Cross>())
                {
                    shadows[cross.Position.X, cross.Position.Y] = 'r';
                }
            }
                return(shadows);

            case SimpleMarkupKind.Square:
            {
                for (int x = 0; x < boardSize.Width; x++)
                {
                    for (int y = 0; y < boardSize.Height; y++)
                    {
                        shadows[x, y] = 's';
                    }
                }

                foreach (var square in GetMarkups <Square>())
                {
                    shadows[square.Position.X, square.Position.Y] = 'r';
                }
            }
                return(shadows);

            case SimpleMarkupKind.Triangle:
            {
                for (int x = 0; x < boardSize.Width; x++)
                {
                    for (int y = 0; y < boardSize.Height; y++)
                    {
                        shadows[x, y] = 't';
                    }
                }

                foreach (var triangle in GetMarkups <Triangle>())
                {
                    shadows[triangle.Position.X, triangle.Position.Y] = 'r';
                }
            }
                return(shadows);
            }

            return(shadows);
        }
Ejemplo n.º 3
0
 public SimpleMarkupTool(SimpleMarkupKind markupKind)
 {
     SimpleMarkup = markupKind;
 }