// Attempts to add a tile to the hand. Will only work if the hand is not already full. public void AddTileToHand(Tile tile) { if (hand.Count < 3) { hand.Add(tile); } }
// Custom initialization. // TODO: Maybe split into several different functions? private void MyInit() { // Gets the paths to all tile images. tilePaths = Directory.GetFiles(tileFolder); // Extracts the tile connection codes from the paths. tileCodes = new string[tileCount]; for (int n = 0; n < tileCount; n++) { tileCodes[n] = TileCodeFromPath(tilePaths[n]); } // Creates a deck full of the tiles specified by the connection codes. // TODO: Shuffle the deck. deck = new List<Tile>(); for (int n = 0; n < tileCount; n++) { Image image = Image.FromFile(tilePaths[n]); Tile tile = new Tile(tileCodes[n], image); deck.Add(tile); } // Loads components into ordered lists. LoadPlayerLabels(); LoadBoardSlots(); // ---Temp test code--- int[] sPosX = {0, 1, 5, 3}; int[] sPosY = {3, 0, 2, 5}; int[] tPos = {1, 6, 4, 2}; playerCount = 4; players = new List<Player>(); for (int n = 0; n < playerCount; n++) { currentPlayer = new Player(n, sPosX[n], sPosY[n], tPos[n]); players.Add(currentPlayer); } currentPlayer = players[0]; // -------------------- // TODO: Instead of above, implement manual selection. // TODO: Player positioning should be done after cards are dealt, // but DealTilesFromDeck() needs players first. Fix this! // Deals cards to all players. DealTilesFromDeck(); // Displays the current players hand on the screen. DisplayCurrentPlayerHand(); // Displays the text data. DisplayTextData(); // Highlights where the next tile will be placed. HighlightBoardSlot(currentPlayer.GetBoardPosX(), currentPlayer.GetBoardPosY()); }