Esempio n. 1
0
        /**
         * Returns the color of tiles in this collection if it is all one color, null otherwise; ignores WHITE tiles
         *
         * @return a <tt>Color</tt> object equal to those in this collection, or <tt>null</tt> if not all one color
         */
        public Color?getColorIgnoreWhite()
        {
            TileCollection temp = new TileCollection(this);

            temp.removeTilesOfColor(Color.WHITE);
            return(temp.getColor());
        }
Esempio n. 2
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();
        }
Esempio n. 3
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);
            //}
        }