Example #1
0
        public static SolidColorBrush GetBrushColor(Cell.Color sourceColor)
        {
            switch (sourceColor)
            {
            case Cell.Color.Blue:
                return(Brushes.Blue);

            case Cell.Color.Cyan:
                return(Brushes.Cyan);

            case Cell.Color.Green:
                return(Brushes.Green);

            case Cell.Color.Magenta:
                return(Brushes.Magenta);

            case Cell.Color.Orange:
                return(Brushes.Orange);

            case Cell.Color.Red:
                return(Brushes.Red);

            case Cell.Color.Yellow:
                return(Brushes.Yellow);

            case Cell.Color.Brown:
                return(Brushes.Brown);

            case Cell.Color.DontUse:
                return(Brushes.White);

            default:
                return(Brushes.DarkGray);
            }
        }
        private FlowBoard.Endpoints AddIfMissing(Cell.Color color)
        {
            var existing = GetEndpoint(color);

            if (existing != null)
            {
                return(existing);
            }

            var emptyCells = (from cell in Game.Cells
                              where cell.CellColor == Cell.Color.Empty
                              select cell).ToList();

            int index1 = Rand.Next(emptyCells.Count());
            int index2 = Rand.Next(emptyCells.Count());

            while (index2 == index1)
            {
                index2 = Rand.Next(emptyCells.Count());
            }

            var endpoints = new FlowBoard.Endpoints()
            {
                FlowColor = color,
                Pt1       = Game.IndexToPoint(emptyCells[index1].Index),
                Pt2       = Game.IndexToPoint(emptyCells[index2].Index)
            };

            Game.AddEndpoints(endpoints);

            return(endpoints);
        }
Example #3
0
 public Cell.Chessman Type; //Переменная для возврата типа выбранной фигуры
 private void Drawing(Cell.Color Color)
 {
     for (int i = 0; i < 4; i++)
     {
         cells[i] = new Cell(i, Color)
         {
             Parent = this
         };
         cells[i].Click += new EventHandler(Click);
     }
 }
        private void Button_Click(Cell.Color color)
        {
            ActivePoint    = 1;
            ActiveEndpoint = AddIfMissing(color);
            foreach (var cell in Game.Cells)
            {
                if (cell.CellColor != Cell.Color.Empty && cell.CellColor != color)
                {
                    continue;
                }

                cell.PropertyChanged += Cell_PropertyChanged;
            }
        }
Example #5
0
        /// <summary>
        /// Конструктор для окна "Выбор фигуры"
        /// </summary>
        /// <param name="_columnNumber">Номер стол</param>
        /// <param name="Color">Цвет фигуры</param>
        public Cell(int _columnNumber, Cell.Color Color)
        {
            ColumnNumber  = _columnNumber;
            LineNumber    = 0;
            ChessmanColor = Color;
            Size          = new Size(50, 50);
            Location      = new Point(50 + ColumnNumber * 50, 20);
            switch (ColumnNumber)
            {
            case 0:
                ChessmanType    = Cell.Chessman.Bishop;
                BackgroundImage = (ChessmanColor == Color.White)
                        ? Properties.Resources.BishopWhite
                        : Properties.Resources.BishopBlack;
                break;

            case 1:
                ChessmanType    = Cell.Chessman.Queen;
                BackgroundImage = (ChessmanColor == Color.White)
                        ? Properties.Resources.QueenWhite
                        : Properties.Resources.QueenBlack;
                break;

            case 2:
                ChessmanType    = Cell.Chessman.Knigth;
                BackgroundImage = (ChessmanColor == Color.White)
                        ? Properties.Resources.KnightWhite
                        : Properties.Resources.KnightBlack;
                break;

            case 3:
                ChessmanType    = Cell.Chessman.Rook;
                BackgroundImage = (ChessmanColor == Color.White)
                        ? Properties.Resources.RookWhite
                        : Properties.Resources.RookBlack;
                break;
            }
        }
 private FlowBoard.Endpoints GetEndpoint(Cell.Color color)
 {
     return((from endpoint in Game.Puzzle
             where endpoint.FlowColor == color
             select endpoint).FirstOrDefault());
 }
Example #7
0
 public ChoiceStatuatte(Cell.Color color)
 {
     Color = color;
     Drawing(color);
     InitializeComponent();
 }