コード例 #1
0
ファイル: BlockControl.xaml.cs プロジェクト: brunodfg/Tetris
        /// <summary>
        /// 
        /// </summary>
        /// <param name="block"></param>
        public BlockControl(Block block)
        {
            this.InitializeComponent();

            this.Block = block;
        }
コード例 #2
0
ファイル: TetrisGame.cs プロジェクト: brunodfg/Tetris
        private void CreateBlocks()
        {
            this.Blocks = new Dictionary<string, Block>();
            this.Rows = new Dictionary<int, List<Block>>();

            for (int y = 0; y < this.Definitions.Height; y++)
            {
                var row = new List<Block>();

                for (int x = 0; x < this.Definitions.Width; x++)
                {
                    var block = new Block(this, x, y);

                    // Index blocks by x,y position
                    this.Blocks.Add(this.GetCoordinateKey(x, y), block);
                    row.Add(block);
                }

                // Index blocks by row
                this.Rows.Add(y, row);
            }
        }