Example #1
0
 public static void ApplyBoardInfoToSlot(BoardSlotInfo boardSlotInfo, BoardSlot targetBoardSlot)
 {
     targetBoardSlot.Image    = Util.ImageFromBase64String(boardSlotInfo.ImageRef);
     targetBoardSlot.Letter   = boardSlotInfo.Letter;
     targetBoardSlot.Position = boardSlotInfo.Position;
     targetBoardSlot.Color    = boardSlotInfo.Color;
     targetBoardSlot.Tag      = boardSlotInfo.Tag;
 }
Example #2
0
 public static BoardSlotInfo FromBoardSlot(BoardSlot boardSlot)
 {
     return(new BoardSlotInfo
     {
         ImageRef = boardSlot.Image.ToBase64String(),
         Letter = boardSlot.Letter,
         Position = boardSlot.Position,
         Color = boardSlot.Color,
         Tag = (int)boardSlot.Tag
     });
 }
        private static void CreateSlot(Position position, string colorName)
        {
            // Add to visuals
            var slot = new BoardSlot
            {
                Width    = Board.SlotSize,
                Height   = Board.SlotSize,
                Location = new Point(position.PositionX, position.PositionY),

                Position = position,
                Color    = (Constants.Colors.TileColors)Enum.Parse(typeof(Constants.Colors.TileColors), colorName),

                Image = position != Constants.CenterPosition ?
                        Resources.ImageController.TileImages[colorName] :
                        Resources.ImageController.TileImages["Center"],

                Tag = (position.Row * Board.Columns + position.Column)
            };

            BoardControl.Controls.Add(slot);

            // Add to logic
            Board.Slots[position.Row, position.Column] = slot;
        }