private void DataFromFile_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (_blocktype) { var item = DataFromFile.SelectedItem; Block3 newitem = (Block3)item; int index = _result1.FindIndex(a => a.Freq == newitem.Freq && a.Temp == newitem.Temp); if (_indexList.IndexOf(index) != -1) { } bool contain = _indexList.IndexOf(index) != -1; if (contain) { return; } _indexList.Add(index); } else { var item = DataFromFile.SelectedItem; Block4 newitem = (Block4)item; int index = _result2.FindIndex(a => a.Freq == newitem.Freq && a.Temp == newitem.Temp); bool contain = _indexList.IndexOf(index) != -1; if (contain) { return; } _indexList.Add(index); } }
public GameWorld(int width, int height, ContentManager Content) { screenWidth = width; screenHeight = height; random = new Random(); gameState = GameState.Menu; inputHelper = new InputHelper(); block = Content.Load<Texture2D>("block"); reset = Content.Load<Texture2D>("reset"); font = Content.Load<SpriteFont>("SpelFont"); font2 = Content.Load<SpriteFont>("SpriteFont1"); font3 = Content.Load<SpriteFont>("SpriteFont2"); playButton = Content.Load<Texture2D>("Play"); optionsButton = Content.Load<Texture2D>("Options"); backButton = Content.Load<Texture2D>("Back"); polytris = Content.Load<Texture2D>("Polytris"); grid = new TetrisGrid(block); level = 1; levelspeed = 1; score = 0; i = (int)random.Next(7) + 1; i2 = (int)random.Next(7) + 1; blockcounter = 1; blocks = new BlockList(block, Content); //Voegen de verschillende blockobjecten toe aan de lijst block1 = new Block1(block, Content); blocks.Add(block1, 1); block2 = new Block2(block, Content); blocks.Add(block2, 2); block3 = new Block3(block, Content); blocks.Add(block3, 3); block4 = new Block4(block, Content); blocks.Add(block4, 4); block5 = new Block5(block, Content); blocks.Add(block5, 5); block6 = new Block6(block, Content); blocks.Add(block6, 6); block7 = new Block7(block, Content); blocks.Add(block7, 7); //Voegen de verschillende blockobjecten toe aan een tweede lijst voor het tekenen van het volgende blokje block1res = new Block1(block, Content); blocks.AddToReserve(block1res, 1); block2res = new Block2(block, Content); blocks.AddToReserve(block2res, 2); block3res = new Block3(block, Content); blocks.AddToReserve(block3res, 3); block4res = new Block4(block, Content); blocks.AddToReserve(block4res, 4); block5res = new Block5(block, Content); blocks.AddToReserve(block5res, 5); block6res = new Block6(block, Content); blocks.AddToReserve(block6res, 6); block7res = new Block7(block, Content); blocks.AddToReserve(block7res, 7); options = new Options(block, reset, backButton, width, height, font, blocks); menu = new Menu(playButton, optionsButton, polytris, width, height); gameOver = new GameOver(backButton, width, height); }
void HideBlock() { Block1.Hide(); Block2.Hide(); Block3.Hide(); Block4.Hide(); Block5.Hide(); Block6.Hide(); Block7.Hide(); Block8.Hide(); Block9.Hide(); Block10.Hide(); }
public string Open(int blocktype) // Не лезь, она тебя сожрет! { OpenFileDialog openFileDialog = new OpenFileDialog { Filter = "Text files (*.txt)|*.txt" }; if (openFileDialog.ShowDialog() == true) { Path = openFileDialog.FileName; _blocktype = blocktype; } else { Path = String.Empty; return(Path); } ReadFile(); if (blocktype == 7 || blocktype == 4 || blocktype == 9) { if (Block.GetLength(0) == 1025) { for (int x = 0; x < Block.GetLength(0); x++) { if (blocktype == 7) { Block3 checkBlock = new Block3(Block[x, 0], Block[x, 1], Block[x, 2], Block[x, 3], Block[x, 4], Block[x, 5], Block[x, 6]); checkBlock.Freq = Block[x, 0]; } else if (blocktype == 4) { Block4 checkBlock = new Block4(Block[x, 0], Block[x, 1], Block[x, 2], Block[x, 3]); checkBlock.Freq = Block[x, 0]; } else if (blocktype == 9) { Block3 checkBlock3 = new Block3(Block[x, 0], Block[x, 1], Block[x, 2], Block[x, 3], Block[x, 4], Block[x, 5], Block[x, 6]); checkBlock3.Freq = Block[x, 0]; Block4 checkBlock4 = new Block4(Block[x, 0], Block[x, 1], Block[x, 7], Block[x, 8]); checkBlock4.Freq = Block[x, 0]; } } } else { throw new Exception(); } } return(Path); }
public int[,] createBlock() { if (r.Next(7) == 0) { Block1 newArray = new Block1(); currentBlock = newArray.getArray(); currentColor = Color.Cyan; } else if (r.Next(7) == 1) { Block2 newArray = new Block2(); currentBlock = newArray.getArray(); currentColor = Color.CornflowerBlue; } else if (r.Next(7) == 2) { Block3 newArray = new Block3(); currentBlock = newArray.getArray(); currentColor = Color.Orange; } else if (r.Next(7) == 3) { Block4 newArray = new Block4(); currentBlock = newArray.getArray(); currentColor = Color.Yellow; } else if (r.Next(7) == 4) { Block5 newArray = new Block5(); currentBlock = newArray.getArray(); currentColor = Color.LimeGreen; } else if (r.Next(7) == 5) { Block6 newArray = new Block6(); currentBlock = newArray.getArray(); currentColor = Color.Purple; } else { Block7 newArray = new Block7(); currentBlock = newArray.getArray(); currentColor = Color.Red; } return(currentBlock); }
private void DataFromFile_MouseDoubleClick(object sender, MouseButtonEventArgs e) { //var cellInfo = DataFromFile.SelectedCells[0]; //var content = cellInfo.Column.GetCellContent(cellInfo.Item); if (DataFromFile.HasItems && DataFromFile.SelectedItem != null) { if (_blocktype) { Block3 data = DataFromFile.SelectedItem as Block3; MainWindow.ShowResuiltBlock1InUi(data); } else { Block4 data = DataFromFile.SelectedItem as Block4; MainWindow.ShowResuiltBlock2InUi(data); } } }