Ejemplo n.º 1
0
        /**
         * Adds tiles (from the selectedTiles buffer) to the given build row, overflowing to the floor line
         *
         * @param row
         *            the 0-indexed row number (>4 places tiles directly on the floor line)
         */
        public void addTilesToRow(object sender, EventArgs e)//(int row)
        {
            if (selectedTiles == null)
            {
                throw new InvalidOperationException("Tiles must be selected before they can be added to a row.");
            }
            int row = (int)((Button)sender).Tag;

            if (row > 4)
            {
                floorLine.AddRange(selectedTiles);
            }
            else
            {
                if (selectedTiles.Contains(Color.WHITE))
                {
                    floorLine.AddRange(selectedTiles.removeTilesOfColor(Color.WHITE));
                }
                floorLine.AddRange(buildRows[row].addTiles(selectedTiles));
            }
            selectedTiles = null;
            updateButtons();
            updateTiles();
            model.endTurn();
        }
Ejemplo n.º 2
0
        internal void PickTiles(object sender, EventArgs e)
        {
            int        factory = -1;
            TileButton btn     = (TileButton)sender;

            if (btn.Parent.GetType() == typeof(Factory))
            {
                factory = ((Factory)btn.Parent).Index;
            }
            Color color = (Color)btn.TileColor;

            TileCollection picked;

            // TODO the actual move stuff
            if (factory < 0)
            {
                picked = centerArea.removeTilesOfColor(color);
                if (centerArea.Contains(Color.WHITE))
                {
                    picked.AddRange(centerArea.removeTilesOfColor(Color.WHITE));
                }
            }
            else
            {
                picked = factories[factory].removeTilesOfColor(color);
                centerArea.AddRange(factories[factory]);
                factories[factory].Clear();
            }
            UpdateTiles();
            playerBoards[curPlayer].setSelectedTiles(picked);

            //if (netGame)
            //{
            //    connection.InvokeAsync("SendPick", curPlayer, factory, color);
            //}
        }