/** * @method Cause a bingo card's information to be copied intothis UI * @param card - The card whose information we wish to copy. * @returns None; the information held in the bingo card UI will be overwritten with the contents of this card. */ public void LoadBingoCard(BingoCard card) { // Set colors. ScreenBackground.color = card.ScreenBackgroundColor; CardBackground.color = card.CardBackgroundColor; TileBackground.color = card.TileBackgroundColor; TitleText.text = card.Title; TitleText.color = card.TitleTextColor; if (card.TitleFont != null) { TitleText.font = card.TitleFont; } // Obtain all tiles. BingoCardTileUI[] tiles = TileBackground.gameObject.GetComponentsInChildren <BingoCardTileUI>(); // Obtain all usable content and create a sorted list of content to place into the card. List <BingoCard.Content> validContent = card.GetValidContent(); List <RandomizedTileContent> randomizedContent = new List <RandomizedTileContent>(); foreach (BingoCard.Content content in validContent) { randomizedContent.Add(new RandomizedTileContent(content)); } // Sort our content. randomizedContent.Sort(); // Place content into all of our tiles. int count = 0; foreach (BingoCardTileUI tile in tiles) { // Is this tile the free space? if (tile.IsFreeSpace) { tile.Background.color = card.FreeSpaceLiningColor; tile.Interior.color = card.FreeSpaceInteriorColor; tile.ContentText.color = card.FreeSpaceTextColor; if (card.FreeSpaceFont != null) { tile.ContentText.font = card.FreeSpaceFont; } if (card.CustomFreeSpaceContent.IsValid) { tile.ContentText.text = card.CustomFreeSpaceContent.Text; } else { tile.ContentText.text = "FREE SPACE"; } } else { tile.Background.color = card.ContentLiningColor; tile.Interior.color = card.ContentInteriorColor; tile.ContentText.color = card.ContentTextColor; if (card.ContentFont != null) { tile.ContentText.font = card.ContentFont; } tile.ContentText.text = randomizedContent[count].Text; ++count; } } }