public void UpdateBoardSlot(BoardSlot boardSlot, BoardSlotChangeOrigin origin) { BoardBlock bBlock = GetBoardBlock(boardSlot.GetPosition()); if (boardSlot.IsEmpty()) { bBlock.BlockColor = ""; bBlock.BlockTextColor = ""; bBlock.BlockValue = ""; } else { Block block = boardSlot.GetBlock(); if (origin == BoardSlotChangeOrigin.Spawned) { ScaleHelper.ScaleIn(bBlock); } else if (origin == BoardSlotChangeOrigin.MergedInto) { ScaleHelper.Pulse(bBlock); } bBlock.BlockColor = ColorTranslator.ToHtml(block.BackgroundColor); bBlock.BlockTextColor = ColorTranslator.ToHtml(block.Color); bBlock.BlockValue = block.Value.ToString(); } }
public void Init(int size, Dictionary <Position, BoardSlot> slots) { if (GameGrid.Children.Count > 0) { GameGrid.Children.Clear(); FadeHelper.FadeOut(GameOverUi); } Size = size; GameGrid.Children.Capacity = size * size; foreach (KeyValuePair <Position, BoardSlot> kv in slots) { BoardBlock block = new BoardBlock(); GameGrid.Children.Add(block); Grid.SetColumn(block, kv.Key.X); Grid.SetRow(block, kv.Key.Y); } }